Home > Backend Development > PHP Tutorial > Instructions for using ORACLE functions in PHP_PHP Tutorial

Instructions for using ORACLE functions in PHP_PHP Tutorial

WBOY
Release: 2016-07-15 13:23:01
Original
1271 people have browsed it

OCIDefineByName
Makes PHP variables available to SELECT instructions.
Syntax: boolean OCIDefineByName(int stmt, string ColumnName, mixed &variable, int [type]);
Return value: Boolean value
Function type: Database function

Content description
This function is used to define the specified PHP variable so that it can be used by the SELECT instruction in the SQL instruction. Pay attention to the case issue, because the column names in the Oracle database are actually uppercase names. The parameter stmt is the string pointer after Oracle parsing (OCIParse). Parameter ColumnName is the column name on the Oracle table. The parameter variable must be preceded by the & symbol to represent the PHP variable address. The type parameter is usually omitted. It is worth noting that when you want to use the new data types LOB/ROWID/BFILE, etc. unique to Oracle 8, you need to execute the OCINewDescriptor() function first. If this function is executed successfully, a true value will be returned.
OCIBindByName
Enables dynamic SQL to use PHP variables.
Syntax: boolean OCIBindByName(int stmt, string ph_name, mixed &variable, int length, int [type]);
Return value: Boolean value
Function type: Database function
Content Description
This function is used to define the specified PHP variables so that they can be used by dynamic SQL instructions (Oracle Placeholder). Pay attention to the case issue, because the column names in the Oracle database are actually uppercase names. The parameter stmt is the string pointer after Oracle parsing (OCIParse). The parameter ph_name is the variable to be used by the dynamic SQL instruction. The parameter variable must be preceded by the & symbol to represent the PHP variable address. The parameter length is the length of the data. If set to -1, the maximum value of the specified variable data will be used. The parameter type can be omitted, and its values ​​include OCI_B_FILE (binary file), OCI_B_CFILE (text file), OCI_B_CLOB (text LOB), OCI_B_BLOB (bit LOB) and OCI_B_ROWID (ROWID). It is worth noting that when you want to use the new data types LOB/ROWID/BFILE, etc. unique to Oracle 8, you need to execute the OCINewDescriptor() function first, and you must set the length parameter to -1. If this function is executed successfully, a true value will be returned.
OCILogon
Opens a connection to Oracle.
Syntax: int OCILogon(string username, string password, string [OCACLE_SID]);
Return value: integer
Function type: Database function
Content description
This function uses PHP connects with Oracle. The parameters username and password are the connection account and password respectively. The parameter OCACLE_SID is the database name and can be omitted. Returns a code whose value is a wire.
OCILogOff
Close the connection to Oracle.
Syntax: boolean OCILogOff(int connection);
Return value: Boolean value
Function type: Database function
Content description
This function ends the connection between PHP and Oracle . The parameter connection is the connection code to connect to Oracle. Returns a value of true for success or false for an error.
OCIExecute
Execute Oracle's command section.
Syntax: boolean OCIExecute(int statement, int [mode]);
Return value: Boolean value
Function type: Database function
Content description
This function is used To execute the specified Oracle command section, the SQL syntax of this section must be parsed by OCIParse() before execution. The parameter statement is the parsed code. The mode parameter can be omitted and defaults to OCI_COMMIT_ON_SUCCESS. Returns a value of true for success or false for an error.
OCICommit
Puts Oracle's transaction processing into practice.
Syntax: boolean OCICommit(int connection);
Return value: Boolean value
Function type: Database function
Content description
This function will roll back the latest commit/rollback Make permanent changes to the subsequent transaction. The parameter connection is the connection code to connect to Oracle. Returns a value of true for success or false for an error.
OCIRollback
Undo the current transaction.
Syntax: boolean OCIRollback(int connection);
Return value: Boolean value
Function type: Database function
Content description
This function cancels Oracle transaction processing (transaction) Modifications made to the database. The parameter connection is the connection code to connect to Oracle. If successful, return true, otherwise return false.
OCINumRows
Get the number of affected fields.
Syntax: int OCINumRows(int statement);
Return value: integer
Function type: Database function
Content description
This function returns the columns affected by UPDATE and other instructions The number of bits (column) will not be affected if you use SQL instructions such as SELECT. The parameter statement is the parsed code.
OCIResult
Get a column (column) from the data of the current column (row).
Syntax: string OCIResult(int statement, mixed column);
Return value: String
Function type: Database function
Content description
This function returns a column information. The parameter statement is the parsed code. The parameter column is the column name. If new data forms (ROWIDs, LOBs and FILEs) are used, the returned data will also be strings.
OCIFetch
Gets a row of returned data.
Syntax: int OCIFetch(int statement);
Return value: integer
Function type: Database function
Content description
This function is used to obtain a column of non-empty data. The parameter statement is the profiled code. The return value true indicates that a column was successfully retrieved, false indicates that the column is empty or other errors occurred.
OCIFetchInto
Retrieve Oracle data and put it into the array.
Syntax: int OCIFetchInto(array &result, int [mode]);
Return value: integer
Function type: Database function
Content description

This function will put the data retrieved by Oracle into the array result. Returns the number of fields in each column, or false on failure. The parameter mode can be omitted, and the default value is OCI_NUM. Others include OCI_ASSOC, OCI_RETURN_NULLS, OCI_RETURN_LOBS, etc.
OCIColumnIsNULL
Tests whether the returned row is empty.
Syntax: boolean OCIColumnIsNULL(int stmt, mixed column);
Return value: Boolean value
Function type: Database function
Content description
This function is used to test the transmission Whether the returned row (column) is NULL. Returns true to indicate a null value.
OCIColumnSize
Get the size of the column type.
Syntax: int OCIColumnSize(int stmt, mixed column);
Return value: integer
Function type: Database function
Content description
This function can get the column (column ) size of the type.
OCINewDescriptor
Initial new LOB/FILE description.
Syntax: string OCINewDescriptor(int connection, int [type]);
Return value: string
Function type: Database function
Content description
This function is used to initialize New LOB/FILE description value.
OCIParse
Parses SQL syntax.
Syntax: int OCIParse(int connection, string query);
Return value: integer
Function type: Database function
Content description
This function can be used to analyze SQL syntax or Is there any error in the PL/SQL section. The parameter connection is the connection code. The parameter query is a SQL command string.



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446887.htmlTechArticleOCIDefineByName allows the SELECT instruction to use PHP variables. Syntax: boolean OCIDefineByName(int stmt, string ColumnName, mixed Return value: Boolean value Function type: Database function Content says...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template