Instructions for using Oracle functions in PHP3

Source: Internet
Author: User
Tags empty execution functions sql variables php and stmt variable
oracle| function (author: Star Prodigal zhongcfido@126.com)
Ocidefinebyname
Allow the SELECT command to use PHP variables.

Syntax: boolean ocidefinebyname (int stmt, string ColumnName, mixed &variable, int [type]);

Return Value: Boolean value

Types of functions: Database features




Content Description


This function is used to define the specified PHP variable so that it can be used by the SELECT command in the SQL directive. Be careful about the case, because the names of the fields in the Oracle repository are in fact uppercase names. Parameter stmt is a string index after Oracle parsing (ociparse). The parameter ColumnName is the name of the field on the Oracle table. Parameter variable must add & symbol, table PHP variable address. The parameter type is usually omitted. It is worth noting that the Ocinewdescriptor () function is required to use the new data type Lob/rowid/bfile, which is unique to Oracle 8. Returns a true value if the execution of this function succeeds.

Ocibindbyname
Allow dynamic SQL to use PHP variables.

Syntax: boolean ocibindbyname (int stmt, string ph_name, mixed &variable, int length, int [type]);

Return Value: Boolean value

Types of functions: Database features




Content Description


This function is used to define a specified PHP variable that can be used by a dynamic SQL instruction (Oracle placeholder). Be careful about the case, because the names of the fields in the Oracle repository are in fact uppercase names. Parameter stmt is a string index after Oracle parsing (ociparse). Parameter ph_name is the variable that is intended for use by dynamic SQL directives. Parameter variable must add & symbol, table PHP variable address. Parameter length is the length of the data and, if set to-1, uses the specified variable data maximum value. The parameter type can be omitted with values such as 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 type Lob/rowid/bfile, which is unique to Oracle 8, you need to perform the Ocinewdescriptor () function, and you must set the length parameter to 1. Returns a true value if the execution of this function succeeds.

Ocilogon
Open a link with Oracle.

Syntax: int Ocilogon (string username, string password, string [Ocacle_sid]);

return value: Integer

Types of functions: Database features




Content Description


This function enables PHP to establish a link with Oracle. Parameter username and password are connected with the account number and password respectively. Parameter ocacle_sid is a database name and can be omitted. Returns code that has a connection value.
Ocilogoff
Close the link to Oracle.

Syntax: boolean ocilogoff (int connection);

Return Value: Boolean value

Types of functions: Database features




Content Description


This function ends the link between PHP and Oracle. The parameter connection to the line code attached to Oracle. A return value of TRUE indicates success and False indicates an error occurred.
Ociexecute
Executes Oracle's instruction section.

Syntax: boolean ociexecute (int statement, int [mode]);

Return Value: Boolean value

Types of functions: Database features




Content Description


This function is used to execute a specified Oracle instruction section, and the SQL syntax for that section must be parsed by ociparse () before execution. The parameter statement to the parsed code. The parameter mode can be omitted and its value is oci_commit_on_success. A return value of TRUE indicates success and False indicates an error occurred.
Ocicommit
Put Oracle's deal into practice.

Syntax: boolean ocicommit (int connection);

Return Value: Boolean value

Types of functions: Database features




Content Description


This function will make permanent changes to the last Commit/rollback transaction (transaction). The parameter connection to the line code attached to Oracle. A return value of TRUE indicates success and False indicates an error occurred.
Ocirollback
Undo the current transaction.

Syntax: boolean ocirollback (int connection);

Return Value: Boolean value

Types of functions: Database features




Content Description


This function cancels the changes made to the database by Oracle transaction processing (transaction). The parameter connection to the line code attached to Oracle. Returns true if successful, and returns false on the contrary.
Ocinumrows
Gets the number of affected fields.

Syntax: int ocinumrows (int statement);

return value: Integer

Types of functions: Database features




Content Description


This function returns the number of fields (column) affected by an instruction such as UPDATE, which is not affected by using SQL instructions such as SELECT. The parameter statement to the parsed code.
Ociresult
Gets a column (column) from the current column (row) data.

Syntax: string ociresult (int statement, mixed column);

return value: String

Types of functions: Database features




Content Description


This function returns a column of data. The parameter statement to the parsed code. The parameter column is a field name. If the new data form (Rowids, lobs and FILEs) is returned, it is also a string.
Ocifetch
Gets a column (row) in which the data is returned.

Syntax: int ocifetch (int statement);

return value: Integer

Types of functions: Database features




Content Description


This function is used to obtain a column of non-empty data. The parameter statement to the parsed code. A return value of TRUE indicates that a column was successfully retrieved, false to indicate that this column is empty, or that another error occurred.
Ocifetchinto
Retrieve Oracle data into the array.

Syntax: int ocifetchinto (array &result, int [mode]);

return value: Integer

Types of functions: Database features




Content Description


This function puts the data retrieved from Oracle into array result. Returns the number of fields per column, False if it fails. Parameter mode can be omitted, the default value is Oci_num, and others are Oci_assoc, Oci_return_nulls and Oci_return_lobs.
Ocicolumnisnull
Tests whether the returned row is empty.

Syntax: boolean ocicolumnisnull (int stmt, mixed column);

Return Value: Boolean value

Types of functions: Database features




Content Description


Use this function to test whether the returned row (column) is a null value (NULL). Return true is represented as a null value.
Ocicolumnsize
Gets the size of the field type.

Syntax: int ocicolumnsize (int stmt, mixed column);

return value: Integer

Types of functions: Database features




Content Description


This function can get the size of the field (column) type (type).
Ocinewdescriptor
The initial new lob/file description.

Syntax: string ocinewdescriptor (int connection, int [type]);

return value: String

Types of functions: Database features




Content Description


This function is used to initialize the new Lob/file description value.
Ociparse
Parse SQL syntax.

Syntax: int ociparse (int connection, string query);

return value: Integer

Types of functions: Database features




Content Description


This function can be used to parse SQL syntax or pl/sql extents for errors. Parameter connection is the line code. parameter query is an SQL instruction string.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.