From 53a06e022f79007c610fc7335467e9676af737aa Mon Sep 17 00:00:00 2001 From: Ron Chmara Date: Wed, 23 Aug 2000 09:44:41 +0000 Subject: [PATCH] Updating/adding functions git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@30949 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/oracle.xml | 322 ++++++++++++++++++++++++++++++++----------- 1 file changed, 241 insertions(+), 81 deletions(-) diff --git a/functions/oracle.xml b/functions/oracle.xml index c6b75d8b31..88b3091b6d 100644 --- a/functions/oracle.xml +++ b/functions/oracle.xml @@ -23,24 +23,23 @@ Returns true if the bind succeeds, otherwise false. Details about the error can be retrieved using the ora_error and - ora_errorcode functions. - + ora_errorcode functions. + This function binds the named PHP variable with a SQL parameter. The SQL parameter must be in the form ":name". With the optional type parameter, you can define whether the SQL parameter is an in/out (0, default), in (1) or out (2) parameter. As of PHP 3.0.1, you can use the constants ORA_BIND_INOUT, ORA_BIND_IN and - ORA_BIND_OUT instead of the numbers. - + ORA_BIND_OUT instead of the numbers. + ora_bind must be called after ora_parse and before ora_exec. Input values can be given by assignment to the bound PHP variables, after calling ora_exec the bound PHP variables contain the output values if available. - - + <?php ora_parse($curs, "declare tmp INTEGER; begin tmp := :in; :out := tmp; :x := 7.77; end;"); @@ -51,9 +50,9 @@ $input = 765; ora_exec($curs); echo "Result: $result<BR>Out: $output<BR>In: $input"; ?> - - - + + + @@ -74,16 +73,15 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; Returns true if the close succeeds, otherwise false. Details about the error can be retrieved using the ora_error and - ora_errorcode functions. - + ora_errorcode functions. + This function closes a data cursor opened with - ora_open. - + ora_open. + - Ora_ColumnName @@ -102,15 +100,38 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; Returns the name of the field/column column on the cursor cursor. The returned name is in all - uppercase letters. + uppercase letters. + - - + - Ora_ColumnType - get type of Oracle result column + Ora_ColumnName + get name of Oracle result column + + + Description + + + string Ora_ColumnName + int cursor + int column + + + + Returns the name of the field/column + column on the cursor + cursor. The returned name is in all + uppercase letters. + + + + + + + Ora_ColumnSize + get size of Oracle result column Description @@ -155,16 +176,15 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; Returns true on success, false on error. Details about the - error can be retrieved using the ora_error - and ora_errorcode functions. This function - commits an Oracle transaction. A transaction is defined as all - the changes on a given connection since the last commit/rollback, - autocommit was turned off or when the connection was established. - + error can be retrieved using the ora_error + and ora_errorcode functions. This function + commits an Oracle transaction. A transaction is defined as all + the changes on a given connection since the last commit/rollback, + autocommit was turned off or when the connection was established. + - Ora_CommitOff @@ -181,16 +201,15 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; Returns true on success, false on error. Details about the error can be retrieved using the ora_error and - ora_errorcode functions. - + ora_errorcode functions. + This function turns off automatic commit after each - ora_exec. - + ora_exec. + - Ora_CommitOn @@ -206,16 +225,44 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; This function turns on automatic commit after each - ora_exec on the given connection. - + ora_exec on the given connection. + Returns true on success, false on error. Details about the error can be retrieved using the ora_error and - ora_errorcode functions. - + ora_errorcode functions. + + + + Ora_Do + Parse, Exec, Fetch + + + Description + + + int ora_do + int conn + string query + + + + This function is quick combination of ora_parse, + ora_exec and ora_fetch. + It will parse and execute a statement, then fetch the first result row. + + + Returns true on success, false on error. Details about the error + can be retrieved using the ora_error and + ora_errorcode functions. + See also Ora_Parse,Ora_Exec, + and Ora_Fetch. + + + @@ -236,9 +283,10 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; where XXX is where the error comes from and NNNNN identifies the error message. - - Support for connection ids was added in 3.0.4. - + + Support for connection ids was added in 3.0.4. + + On UNIX versions of Oracle, you can find details about an error message like this: @@ -247,12 +295,11 @@ echo "Result: $result<BR>Out: $output<BR>In: $input"; statement attempted to insert a duplicate key // For Trusted ORACLE configured in DBMS MAC mode, you may see // this message if a duplicate entry exists at a different level. // *Action: Either -remove the unique restriction or do not insert the key - +remove the unique restriction or do not insert the key + - Ora_ErrorCode @@ -270,14 +317,13 @@ remove the unique restriction or do not insert the key Returns the numeric error code of the last executed statement on the specified cursor or connection. FIXME: should possible values be listed? - - Support for connection ids was added in 3.0.4. - - + + Support for connection ids was added in 3.0.4. + + - Ora_Exec @@ -294,12 +340,15 @@ remove the unique restriction or do not insert the key Returns true on success, false on error. Details about the error can be retrieved using the ora_error and - ora_errorcode functions. - + ora_errorcode functions. + + + See also Ora_Parse, + Ora_Fetch, and Ora_Do. + - Ora_Fetch @@ -319,11 +368,55 @@ remove the unique restriction or do not insert the key using the ora_error and ora_errorcode functions. If there was no error, ora_errorcode will return 0. - Retrieves a row of data from the specified cursor. - + Retrieves a row of data from the specified cursor. + + + See also Ora_Parse,Ora_Exec, + and Ora_Do. + + + + Ora_FetchInto + Fetch a row into the specified result array + + + Description + + + int ora_fetchinto + int cursor + array result + int + + flags + + + + + + You can fetch a row into an array with this function. + + Oracle fetch into array + +<?php +array($results); +ora_fetch_into($cursor, &$results); +echo $results[0]; +echo $results[1]; +?> + + + Note that you need to fetch the array by reference. + + + See also Ora_Parse,Ora_Exec, + Ora_Fetch, and Ora_Do. + + + @@ -346,12 +439,11 @@ remove the unique restriction or do not insert the key on the results from this function may be true in cases where there is not error as well (NULL result, empty string, the number 0, the string "0"). Fetches the data for a column or function - result. - + result. + - Ora_Logoff @@ -369,12 +461,11 @@ remove the unique restriction or do not insert the key Returns true on success, False on error. Details about the error can be retrieved using the ora_error and ora_errorcode functions. Logs out the user and disconnects from the - server. - + server. + - Ora_Logon @@ -391,8 +482,8 @@ remove the unique restriction or do not insert the key Establishes a connection between PHP and an Oracle database with the - given username and password. - + given username and password. + Connections can be made using SQL*Net by supplying the TNS name to @@ -401,22 +492,91 @@ remove the unique restriction or do not insert the key $conn = Ora_Logon("user@TNSNAME", "pass"); - - + + If you have character data with non-ASCII characters, you should make sure that NLS_LANG is set in your environment. For server modules, you should set it in the - server's environment before starting the server. - + server's environment before starting the server. + Returns a connection index on success, or false on failure. - Details about the error can be retrieved using the ora_error and ora_errorcode - functions. - + Details about the error can be retrieved using the + ora_error and ora_errorcode + functions. + + + + Ora_pLogon + + Open a persistent Oracle connection + + + + Description + + + int ora_logon + string user + string password + + + + Establishes a persistant connection between PHP and an Oracle database with the + given username and password. + + + See also Ora_Logon. + + + + + + + Ora_Numcols + Returns the number of columns + + + Description + + + int ora_numcols + int cursor_ind + + + + ora_numcols returns the number of columns in a result. + Only returns meaningful values after an parse/exec/fetch sequence. + + + See also Ora_Parse,Ora_Exec, + Ora_Fetch, and Ora_Do. + + + + + + + Ora_Numrows + Returns the number of rows + + + Description + + + int ora_numrows + int cursor_ind + + + + ora_numcols returns the number of rows in a result. + + + @@ -432,17 +592,16 @@ $conn = Ora_Logon("user@TNSNAME", "pass"); - Opens an Oracle cursor associated with connection. - + Opens an Oracle cursor associated with connection. + Returns a cursor index or False on failure. Details about the - error can be retrieved using the ora_error and ora_errorcode - functions. - + error can be retrieved using the ora_error + and ora_errorcode functions. + - Ora_Parse @@ -461,12 +620,15 @@ $conn = Ora_Logon("user@TNSNAME", "pass"); This function parses an SQL statement or a PL/SQL block and associates it with the given cursor. Returns 0 on success or -1 on - error. - + error. + + + See also Ora_Exec, + Ora_Fetch, and Ora_Do. + - Ora_Rollback @@ -483,17 +645,15 @@ $conn = Ora_Logon("user@TNSNAME", "pass"); This function undoes an Oracle transaction. (See ora_commit for the definition of a - transaction.) - + transaction.) + Returns true on success, false on error. Details about the error can be retrieved using the ora_error and - ora_errorcode functions. - + ora_errorcode functions. + - -