diff options
author | Andrew Dolgov <[email protected]> | 2022-07-12 22:26:21 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-07-12 22:26:21 +0300 |
commit | 80d3db1dcf8fe9ca66d4e3f2e2116d3bc39ae2b4 (patch) | |
tree | 04b33bfb9c9368c4a31e287153abec690b9014e0 /vendor/thecodingmachine/safe/generated/oci8.php | |
parent | 4b6161892000cb2b8392dce92a9cf2cabdf2d20e (diff) |
upgrade idiorm to php8.1-patched version (aaronpk/idiorm)
Diffstat (limited to 'vendor/thecodingmachine/safe/generated/oci8.php')
-rw-r--r-- | vendor/thecodingmachine/safe/generated/oci8.php | 512 |
1 files changed, 223 insertions, 289 deletions
diff --git a/vendor/thecodingmachine/safe/generated/oci8.php b/vendor/thecodingmachine/safe/generated/oci8.php index f2bac2781..4a7e38806 100644 --- a/vendor/thecodingmachine/safe/generated/oci8.php +++ b/vendor/thecodingmachine/safe/generated/oci8.php @@ -5,15 +5,15 @@ namespace Safe; use Safe\Exceptions\Oci8Exception; /** - * Binds the PHP array var_array to the Oracle - * placeholder name, which points to an Oracle PL/SQL + * Binds the PHP array var to the Oracle + * placeholder param, which points to an Oracle PL/SQL * array. Whether it will be used for input or output will be determined at * run-time. * * @param resource $statement A valid OCI statement identifier. - * @param string $name The Oracle placeholder. - * @param array $var_array An array. - * @param int $max_table_length Sets the maximum length both for incoming and result arrays. + * @param string $param The Oracle placeholder. + * @param array $var An array. + * @param int $max_array_length Sets the maximum length both for incoming and result arrays. * @param int $max_item_length Sets maximum length for array items. If not specified or equals to -1, * oci_bind_array_by_name will find the longest * element in the incoming array and will use it as the maximum length. @@ -101,10 +101,10 @@ use Safe\Exceptions\Oci8Exception; * @throws Oci8Exception * */ -function oci_bind_array_by_name($statement, string $name, array &$var_array, int $max_table_length, int $max_item_length = -1, int $type = SQLT_AFC): void +function oci_bind_array_by_name($statement, string $param, array &$var, int $max_array_length, int $max_item_length = -1, int $type = SQLT_AFC): void { error_clear_last(); - $result = \oci_bind_array_by_name($statement, $name, $var_array, $max_table_length, $max_item_length, $type); + $result = \oci_bind_array_by_name($statement, $param, $var, $max_array_length, $max_item_length, $type); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -112,8 +112,8 @@ function oci_bind_array_by_name($statement, string $name, array &$var_array, int /** - * Binds a PHP variable variable to the Oracle - * bind variable placeholder bv_name. Binding + * Binds a PHP variable var to the Oracle + * bind variable placeholder param. Binding * is important for Oracle database performance and also as a way to * avoid SQL Injection security issues. * @@ -136,12 +136,12 @@ function oci_bind_array_by_name($statement, string $name, array &$var_array, int * bind variable will be used for input or output is determined at * run-time. * - * You must specify maxlength when using + * You must specify max_length when using * an OUT bind so that PHP allocates enough memory * to hold the returned value. * * For IN binds it is recommended to set - * the maxlength length if the statement is + * the max_length length if the statement is * re-executed multiple times with different values for the PHP * variable. Otherwise Oracle may truncate data to the length of the * initial PHP variable value. If you don't know what the maximum @@ -168,16 +168,16 @@ function oci_bind_array_by_name($statement, string $name, array &$var_array, int * SQL statement, as this can be a security risk if unfiltered user * text is concatenated. * - * @param resource $statement A valid OCI8 statement identifer. - * @param string $bv_name The colon-prefixed bind variable placeholder used in the + * @param resource $statement A valid OCI8 statement identifier. + * @param string $param The colon-prefixed bind variable placeholder used in the * statement. The colon is optional - * in bv_name. Oracle does not use question + * in param. Oracle does not use question * marks for placeholders. - * @param mixed $variable The PHP variable to be associated with bv_name - * @param int $maxlength Sets the maximum length for the data. If you set it to -1, this + * @param mixed $var The PHP variable to be associated with param + * @param int $max_length Sets the maximum length for the data. If you set it to -1, this * function will use the current length - * of variable to set the maximum - * length. In this case the variable must + * of var to set the maximum + * length. In this case the var must * exist and contain data * when oci_bind_by_name is called. * @param int $type The datatype that Oracle will treat the data as. The @@ -307,10 +307,10 @@ function oci_bind_array_by_name($statement, string $name, array &$var_array, int * @throws Oci8Exception * */ -function oci_bind_by_name($statement, string $bv_name, &$variable, int $maxlength = -1, int $type = SQLT_CHR): void +function oci_bind_by_name($statement, string $param, &$var, int $max_length = -1, int $type = 0): void { error_clear_last(); - $result = \oci_bind_by_name($statement, $bv_name, $variable, $maxlength, $type); + $result = \oci_bind_by_name($statement, $param, $var, $max_length, $type); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -336,31 +336,6 @@ function oci_cancel($statement): void /** - * Unsets connection. The underlying database - * connection is closed if no other resources are using it and if it - * was created with oci_connect - * or oci_new_connect. - * - * It is recommended to close connections that are no longer needed - * because this makes database resources available for other users. - * - * @param resource $connection An Oracle connection identifier returned by - * oci_connect, oci_pconnect, - * or oci_new_connect. - * @throws Oci8Exception - * - */ -function oci_close($connection): void -{ - error_clear_last(); - $result = \oci_close($connection); - if ($result === false) { - throw Oci8Exception::createFromPhpError(); - } -} - - -/** * Commits the outstanding transaction for the * Oracle connection. A commit ends the * current transaction and makes permanent all changes. It releases @@ -395,9 +370,11 @@ function oci_commit($connection): void /** * Returns a connection identifier needed for most other OCI8 operations. * - * See Connection Handling for - * general information on connection management and connection - * pooling. + * For performance, most applications should use persistent connections + * with oci_pconnect instead + * of oci_connect. + * See Connection Handling for general + * information on connection management and connection pooling. * * From PHP 5.1.2 (PECL OCI8 1.1) oci_close can * be used to close the connection. @@ -419,7 +396,7 @@ function oci_commit($connection): void * the tnsnames.ora file, or the name of a local * Oracle instance. * - * If not specified, PHP uses + * If not specified or NULL, PHP uses * environment variables such as TWO_TASK (on Linux) * or LOCAL (on Windows) * and ORACLE_SID to determine the @@ -432,19 +409,19 @@ function oci_commit($connection): void * [//]host_name[:port][/service_name]. From Oracle * 11g, the syntax is: * [//]host_name[:port][/service_name][:server_type][/instance_name]. - * Service names can be found by running the Oracle - * utility lsnrctl status on the database server + * Further options were introduced with Oracle 19c, including timeout and keep-alive + * settings. Refer to Oracle documentation. Service names can be found by running + * the Oracle utility lsnrctl status on the database server * machine. * * - * The tnsnames.ora file can be in the Oracle Net - * search path, which - * includes $ORACLE_HOME/network/admin - * and /etc. Alternatively - * set TNS_ADMIN so - * that $TNS_ADMIN/tnsnames.ora is read. Make sure - * the web daemon has read access to the file. - * @param string $character_set Determines + * The tnsnames.ora file can be in the Oracle Net search path, + * which + * includes /your/path/to/instantclient/network/admin, $ORACLE_HOME/network/admin + * and /etc. Alternatively set TNS_ADMIN + * so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web + * daemon has read access to the file. + * @param string $encoding Determines * the character set used by the Oracle Client libraries. The character * set does not need to match the character set used by the database. If * it doesn't match, Oracle will do its best to convert data to and from @@ -489,13 +466,13 @@ function oci_commit($connection): void * @throws Oci8Exception * */ -function oci_connect(string $username, string $password, string $connection_string = null, string $character_set = null, int $session_mode = null) +function oci_connect(string $username, string $password, string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) { error_clear_last(); - if ($session_mode !== null) { - $result = \oci_connect($username, $password, $connection_string, $character_set, $session_mode); - } elseif ($character_set !== null) { - $result = \oci_connect($username, $password, $connection_string, $character_set); + if ($session_mode !== OCI_DEFAULT) { + $result = \oci_connect($username, $password, $connection_string, $encoding, $session_mode); + } elseif ($encoding !== "") { + $result = \oci_connect($username, $password, $connection_string, $encoding); } elseif ($connection_string !== null) { $result = \oci_connect($username, $password, $connection_string); } else { @@ -518,12 +495,12 @@ function oci_connect(string $username, string $password, string $connection_stri * identifier created by oci_parse and executed * by oci_execute, or a REF * CURSOR statement identifier. - * @param string $column_name The column name used in the query. + * @param string $column The column name used in the query. * * Use uppercase for Oracle's default, non-case sensitive column * names. Use the exact column name case for case-sensitive * column names. - * @param mixed $variable The PHP variable that will contain the returned column value. + * @param mixed $var The PHP variable that will contain the returned column value. * @param int $type The data type to be returned. Generally not needed. Note that * Oracle-style data conversions are not performed. For example, * SQLT_INT will be ignored and the returned @@ -534,10 +511,10 @@ function oci_connect(string $username, string $password, string $connection_stri * @throws Oci8Exception * */ -function oci_define_by_name($statement, string $column_name, &$variable, int $type = SQLT_CHR): void +function oci_define_by_name($statement, string $column, &$var, int $type = 0): void { error_clear_last(); - $result = \oci_define_by_name($statement, $column_name, $variable, $type); + $result = \oci_define_by_name($statement, $column, $var, $type); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -632,121 +609,18 @@ function oci_execute($statement, int $mode = OCI_COMMIT_ON_SUCCESS): void /** - * Fetches multiple rows from a query into a two-dimensional array. - * By default, all rows are returned. - * - * This function can be called only once for each query executed - * with oci_execute. - * - * @param resource $statement A valid OCI8 statement - * identifier created by oci_parse and executed - * by oci_execute, or a REF - * CURSOR statement identifier. - * @param array|null $output The variable to contain the returned rows. - * - * LOB columns are returned as strings, where Oracle supports - * conversion. - * - * See oci_fetch_array for more information - * on how data and types are fetched. - * @param int $skip The number of initial rows to discard when fetching the - * result. The default value is 0, so the first row onwards is - * returned. - * @param int $maxrows The number of rows to return. The default is -1 meaning return - * all the rows from skip + 1 onwards. - * @param int $flags Parameter flags indicates the array - * structure and whether associative arrays should be used. - * - * oci_fetch_all Array Structure Modes - * - * - * - * Constant - * Description - * - * - * - * - * OCI_FETCHSTATEMENT_BY_ROW - * The outer array will contain one sub-array per query - * row. - * - * - * OCI_FETCHSTATEMENT_BY_COLUMN - * The outer array will contain one sub-array per query - * column. This is the default. - * - * - * - * - * - * Arrays can be indexed either by column heading or numerically. - * Only one index mode will be returned. - * - * oci_fetch_all Array Index Modes - * - * - * - * Constant - * Description - * - * - * - * - * OCI_NUM - * Numeric indexes are used for each column's array. - * - * - * OCI_ASSOC - * Associative indexes are used for each column's - * array. This is the default. - * - * - * - * - * - * Use the addition operator "+" to choose a combination - * of array structure and index modes. - * - * Oracle's default, non-case sensitive column names will have - * uppercase array keys. Case-sensitive column names will have - * array keys using the exact column case. - * Use var_dump - * on output to verify the appropriate case - * to use for each query. - * - * Queries that have more than one column with the same name - * should use column aliases. Otherwise only one of the columns - * will appear in an associative array. - * @return int Returns the number of rows in output, which - * may be 0 or more. - * @throws Oci8Exception - * - */ -function oci_fetch_all($statement, ?array &$output, int $skip = 0, int $maxrows = -1, int $flags = OCI_FETCHSTATEMENT_BY_COLUMN + OCI_ASSOC): int -{ - error_clear_last(); - $result = \oci_fetch_all($statement, $output, $skip, $maxrows, $flags); - if ($result === false) { - throw Oci8Exception::createFromPhpError(); - } - return $result; -} - - -/** - * Returns the name of the field. + * Returns the name of the column. * * @param resource $statement A valid OCI statement identifier. - * @param mixed $field Can be the field's index (1-based) or name. - * @return string Returns the name as a strings. + * @param mixed $column Can be the field's index (1-based) or name. + * @return string Returns the name as a string * @throws Oci8Exception * */ -function oci_field_name($statement, $field): string +function oci_field_name($statement, $column): string { error_clear_last(); - $result = \oci_field_name($statement, $field); + $result = \oci_field_name($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -755,22 +629,22 @@ function oci_field_name($statement, $field): string /** - * Returns precision of the field. + * Returns precision of the column. * * For FLOAT columns, precision is nonzero and scale is -127. * If precision is 0, then column is NUMBER. Else it's * NUMBER(precision, scale). * * @param resource $statement A valid OCI statement identifier. - * @param mixed $field Can be the field's index (1-based) or name. - * @return int Returns the precision as an integers. + * @param mixed $column Can be the field's index (1-based) or name. + * @return int Returns the precision as an integer * @throws Oci8Exception * */ -function oci_field_precision($statement, $field): int +function oci_field_precision($statement, $column): int { error_clear_last(); - $result = \oci_field_precision($statement, $field); + $result = \oci_field_precision($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -779,22 +653,22 @@ function oci_field_precision($statement, $field): int /** - * Returns the scale of the column with field index. + * Returns the scale of the column with column index. * * For FLOAT columns, precision is nonzero and scale is -127. * If precision is 0, then column is NUMBER. Else it's * NUMBER(precision, scale). * * @param resource $statement A valid OCI statement identifier. - * @param mixed $field Can be the field's index (1-based) or name. - * @return int Returns the scale as an integers. + * @param mixed $column Can be the field's index (1-based) or name. + * @return int Returns the scale as an integer * @throws Oci8Exception * */ -function oci_field_scale($statement, $field): int +function oci_field_scale($statement, $column): int { error_clear_last(); - $result = \oci_field_scale($statement, $field); + $result = \oci_field_scale($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -803,18 +677,18 @@ function oci_field_scale($statement, $field): int /** - * Returns the size of a field. + * Returns the size of a column. * * @param resource $statement A valid OCI statement identifier. - * @param mixed $field Can be the field's index (1-based) or name. - * @return int Returns the size of a field in bytess. + * @param mixed $column Can be the field's index (1-based) or name. + * @return int Returns the size of a column in bytes * @throws Oci8Exception * */ -function oci_field_size($statement, $field): int +function oci_field_size($statement, $column): int { error_clear_last(); - $result = \oci_field_size($statement, $field); + $result = \oci_field_size($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -823,20 +697,20 @@ function oci_field_size($statement, $field): int /** - * Returns Oracle's raw "SQLT" data type of the field. + * Returns Oracle's raw "SQLT" data type of the column. * * If you want a field's type name, then use oci_field_type instead. * * @param resource $statement A valid OCI statement identifier. - * @param mixed $field Can be the field's index (1-based) or name. - * @return int Returns Oracle's raw data type as a numbers. + * @param mixed $column Can be the field's index (1-based) or name. + * @return int Returns Oracle's raw data type as a number * @throws Oci8Exception * */ -function oci_field_type_raw($statement, $field): int +function oci_field_type_raw($statement, $column): int { error_clear_last(); - $result = \oci_field_type_raw($statement, $field); + $result = \oci_field_type_raw($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -848,15 +722,15 @@ function oci_field_type_raw($statement, $field): int * Returns a field's data type name. * * @param resource $statement A valid OCI statement identifier. - * @param mixed $field Can be the field's index (1-based) or name. - * @return mixed Returns the field data type as a strings. + * @param mixed $column Can be the field's index (1-based) or name. + * @return mixed Returns the field data type as a string or an integer * @throws Oci8Exception * */ -function oci_field_type($statement, $field) +function oci_field_type($statement, $column) { error_clear_last(); - $result = \oci_field_type($statement, $field); + $result = \oci_field_type($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -867,14 +741,14 @@ function oci_field_type($statement, $field) /** * Frees a descriptor allocated by oci_new_descriptor. * - * @param resource $descriptor + * @param \OCILob $lob Descriptor allocated by oci_new_descriptor. * @throws Oci8Exception * */ -function oci_free_descriptor($descriptor): void +function oci_free_descriptor(\OCILob $lob): void { error_clear_last(); - $result = \oci_free_descriptor($descriptor); + $result = \oci_free_descriptor($lob); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -905,17 +779,21 @@ function oci_free_statement($statement): void * * @param resource $connection An Oracle connection identifier, returned by * oci_connect or oci_pconnect. - * @param string $tdo Should be a valid named type (uppercase). + * @param string $type_name Should be a valid named type (uppercase). * @param string $schema Should point to the scheme, where the named type was created. The name - * of the current user is the default value. + * of the current user is used when NULL is passed. * @return \OCI-Collection Returns a new OCICollection object. * @throws Oci8Exception * */ -function oci_new_collection($connection, string $tdo, string $schema = null) +function oci_new_collection($connection, string $type_name, string $schema = null) { error_clear_last(); - $result = \oci_new_collection($connection, $tdo, $schema); + if ($schema !== null) { + $result = \oci_new_collection($connection, $type_name, $schema); + } else { + $result = \oci_new_collection($connection, $type_name); + } if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -941,7 +819,7 @@ function oci_new_collection($connection, string $tdo, string $schema = null) * the tnsnames.ora file, or the name of a local * Oracle instance. * - * If not specified, PHP uses + * If not specified or NULL, PHP uses * environment variables such as TWO_TASK (on Linux) * or LOCAL (on Windows) * and ORACLE_SID to determine the @@ -954,19 +832,19 @@ function oci_new_collection($connection, string $tdo, string $schema = null) * [//]host_name[:port][/service_name]. From Oracle * 11g, the syntax is: * [//]host_name[:port][/service_name][:server_type][/instance_name]. - * Service names can be found by running the Oracle - * utility lsnrctl status on the database server + * Further options were introduced with Oracle 19c, including timeout and keep-alive + * settings. Refer to Oracle documentation. Service names can be found by running + * the Oracle utility lsnrctl status on the database server * machine. * * - * The tnsnames.ora file can be in the Oracle Net - * search path, which - * includes $ORACLE_HOME/network/admin - * and /etc. Alternatively - * set TNS_ADMIN so - * that $TNS_ADMIN/tnsnames.ora is read. Make sure - * the web daemon has read access to the file. - * @param string $character_set Determines + * The tnsnames.ora file can be in the Oracle Net search path, + * which + * includes /your/path/to/instantclient/network/admin, $ORACLE_HOME/network/admin + * and /etc. Alternatively set TNS_ADMIN + * so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web + * daemon has read access to the file. + * @param string $encoding Determines * the character set used by the Oracle Client libraries. The character * set does not need to match the character set used by the database. If * it doesn't match, Oracle will do its best to convert data to and from @@ -1011,13 +889,13 @@ function oci_new_collection($connection, string $tdo, string $schema = null) * @throws Oci8Exception * */ -function oci_new_connect(string $username, string $password, string $connection_string = null, string $character_set = null, int $session_mode = null) +function oci_new_connect(string $username, string $password, string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) { error_clear_last(); - if ($session_mode !== null) { - $result = \oci_new_connect($username, $password, $connection_string, $character_set, $session_mode); - } elseif ($character_set !== null) { - $result = \oci_new_connect($username, $password, $connection_string, $character_set); + if ($session_mode !== OCI_DEFAULT) { + $result = \oci_new_connect($username, $password, $connection_string, $encoding, $session_mode); + } elseif ($encoding !== "") { + $result = \oci_new_connect($username, $password, $connection_string, $encoding); } elseif ($connection_string !== null) { $result = \oci_new_connect($username, $password, $connection_string); } else { @@ -1058,7 +936,7 @@ function oci_new_cursor($connection) * @param int $type Valid values for type are: * OCI_DTYPE_FILE, OCI_DTYPE_LOB and * OCI_DTYPE_ROWID. - * @return \OCI-Lob Returns a new LOB or FILE descriptor on success, FALSE on error. + * @return \OCI-Lob|false Returns a new LOB or FILE descriptor on success. * @throws Oci8Exception * */ @@ -1066,26 +944,7 @@ function oci_new_descriptor($connection, int $type = OCI_DTYPE_LOB) { error_clear_last(); $result = \oci_new_descriptor($connection, $type); - if ($result === false) { - throw Oci8Exception::createFromPhpError(); - } - return $result; -} - - -/** - * Gets the number of columns in the given statement. - * - * @param resource $statement A valid OCI statement identifier. - * @return int Returns the number of columns as an integers. - * @throws Oci8Exception - * - */ -function oci_num_fields($statement): int -{ - error_clear_last(); - $result = \oci_num_fields($statement); - if ($result === false) { + if ($result === null) { throw Oci8Exception::createFromPhpError(); } return $result; @@ -1096,7 +955,7 @@ function oci_num_fields($statement): int * Gets the number of rows affected during statement execution. * * @param resource $statement A valid OCI statement identifier. - * @return int Returns the number of rows affected as an integers. + * @return int Returns the number of rows affected as an integer * @throws Oci8Exception * */ @@ -1112,7 +971,7 @@ function oci_num_rows($statement): int /** - * Prepares sql_text using + * Prepares sql using * connection and returns the statement identifier, * which can be used with oci_bind_by_name, * oci_execute and other functions. @@ -1123,7 +982,7 @@ function oci_num_rows($statement): int * * @param resource $connection An Oracle connection identifier, returned by * oci_connect, oci_pconnect, or oci_new_connect. - * @param string $sql_text The SQL or PL/SQL statement. + * @param string $sql The SQL or PL/SQL statement. * * SQL statements should not end with a * semi-colon (";"). PL/SQL @@ -1133,10 +992,10 @@ function oci_num_rows($statement): int * @throws Oci8Exception * */ -function oci_parse($connection, string $sql_text) +function oci_parse($connection, string $sql) { error_clear_last(); - $result = \oci_parse($connection, $sql_text); + $result = \oci_parse($connection, $sql); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -1147,11 +1006,12 @@ function oci_parse($connection, string $sql_text) /** * Creates a persistent connection to an Oracle server and logs on. * - * Persistent connections are cached and re-used between requests, resulting - * in reduced overhead on each page load; a typical PHP application will have - * a single persistent connection open against an Oracle server per Apache - * child process (or PHP FastCGI/CGI process). See the Persistent Database - * Connections section for more information. + * Persistent connections are cached and re-used between requests, resulting in + * reduced overhead on each page load; a typical PHP application will have a + * single persistent connection open against an Oracle server per Apache child + * process (or PHP FPM process). See the OCI8 + * Connection Handling and Connection Pooling section for more + * information. * * @param string $username The Oracle user name. * @param string $password The password for username. @@ -1162,7 +1022,7 @@ function oci_parse($connection, string $sql_text) * the tnsnames.ora file, or the name of a local * Oracle instance. * - * If not specified, PHP uses + * If not specified or NULL, PHP uses * environment variables such as TWO_TASK (on Linux) * or LOCAL (on Windows) * and ORACLE_SID to determine the @@ -1175,19 +1035,19 @@ function oci_parse($connection, string $sql_text) * [//]host_name[:port][/service_name]. From Oracle * 11g, the syntax is: * [//]host_name[:port][/service_name][:server_type][/instance_name]. - * Service names can be found by running the Oracle - * utility lsnrctl status on the database server + * Further options were introduced with Oracle 19c, including timeout and keep-alive + * settings. Refer to Oracle documentation. Service names can be found by running + * the Oracle utility lsnrctl status on the database server * machine. * * - * The tnsnames.ora file can be in the Oracle Net - * search path, which - * includes $ORACLE_HOME/network/admin - * and /etc. Alternatively - * set TNS_ADMIN so - * that $TNS_ADMIN/tnsnames.ora is read. Make sure - * the web daemon has read access to the file. - * @param string $character_set Determines + * The tnsnames.ora file can be in the Oracle Net search path, + * which + * includes /your/path/to/instantclient/network/admin, $ORACLE_HOME/network/admin + * and /etc. Alternatively set TNS_ADMIN + * so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web + * daemon has read access to the file. + * @param string $encoding Determines * the character set used by the Oracle Client libraries. The character * set does not need to match the character set used by the database. If * it doesn't match, Oracle will do its best to convert data to and from @@ -1232,13 +1092,13 @@ function oci_parse($connection, string $sql_text) * @throws Oci8Exception * */ -function oci_pconnect(string $username, string $password, string $connection_string = null, string $character_set = null, int $session_mode = null) +function oci_pconnect(string $username, string $password, string $connection_string = null, string $encoding = "", int $session_mode = OCI_DEFAULT) { error_clear_last(); - if ($session_mode !== null) { - $result = \oci_pconnect($username, $password, $connection_string, $character_set, $session_mode); - } elseif ($character_set !== null) { - $result = \oci_pconnect($username, $password, $connection_string, $character_set); + if ($session_mode !== OCI_DEFAULT) { + $result = \oci_pconnect($username, $password, $connection_string, $encoding, $session_mode); + } elseif ($encoding !== "") { + $result = \oci_pconnect($username, $password, $connection_string, $encoding); } elseif ($connection_string !== null) { $result = \oci_pconnect($username, $password, $connection_string); } else { @@ -1252,7 +1112,45 @@ function oci_pconnect(string $username, string $password, string $connection_str /** - * Returns the data from field in the current row, + * Registers a user-defined callback function to connection. + * If connection fails due to instance or network failure, + * the registered callback function will be invoked for several times during + * failover. See OCI8 Transparent Application Failover + * (TAF) Support for information. + * + * When oci_register_taf_callback is called multiple times, + * each registration overwrites the previous one. + * + * Use oci_unregister_taf_callback to explicitly unregister a + * user-defined callback. + * + * TAF callback registration will NOT be saved across + * persistent connections, therefore the callback needs to be re-registered for + * a new persistent connection. + * + * @param resource $connection An Oracle connection identifier. + * @param callable $callback A user-defined callback to register for Oracle TAF. It can be a + * string of the function name or a Closure (anonymous function). + * + * The interface of a TAF user-defined callback function is as follows: + * + * See the parameter description and an example on + * OCI8 Transparent Application Failover (TAF) Support page. + * @throws Oci8Exception + * + */ +function oci_register_taf_callback($connection, callable $callback): void +{ + error_clear_last(); + $result = \oci_register_taf_callback($connection, $callback); + if ($result === false) { + throw Oci8Exception::createFromPhpError(); + } +} + + +/** + * Returns the data from column in the current row, * fetched by oci_fetch. * * For details on the data type mapping performed by @@ -1260,7 +1158,7 @@ function oci_pconnect(string $username, string $password, string $connection_str * supported by the driver * * @param resource $statement - * @param mixed $field Can be either use the column number (1-based) or the column name. + * @param mixed $column Can be either use the column number (1-based) or the column name. * The case of the column name must be the case that Oracle meta data * describes the column as, which is uppercase for columns created * case insensitively. @@ -1269,10 +1167,10 @@ function oci_pconnect(string $username, string $password, string $connection_str * @throws Oci8Exception * */ -function oci_result($statement, $field): string +function oci_result($statement, $column): string { error_clear_last(); - $result = \oci_result($statement, $field); + $result = \oci_result($statement, $column); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -1349,14 +1247,14 @@ function oci_server_version($connection): string * @param resource $connection An Oracle connection identifier, * returned by oci_connect, oci_pconnect, * or oci_new_connect. - * @param string $action_name User chosen string up to 32 bytes long. + * @param string $action User chosen string up to 32 bytes long. * @throws Oci8Exception * */ -function oci_set_action($connection, string $action_name): void +function oci_set_action($connection, string $action): void { error_clear_last(); - $result = \oci_set_action($connection, $action_name); + $result = \oci_set_action($connection, $action); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -1391,14 +1289,14 @@ function oci_set_action($connection, string $action_name): void * @param resource $connection An Oracle connection identifier, * returned by oci_connect, oci_pconnect, * or oci_new_connect. - * @param int $time_out The maximum time in milliseconds that any single round-trip between PHP and Oracle Database may take. + * @param int $timeout The maximum time in milliseconds that any single round-trip between PHP and Oracle Database may take. * @throws Oci8Exception * */ -function oci_set_call_timeout($connection, int $time_out): void +function oci_set_call_timeout($connection, int $timeout): void { error_clear_last(); - $result = \oci_set_call_timeout($connection, $time_out); + $result = \oci_set_call_timeout($connection, $timeout); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -1426,14 +1324,14 @@ function oci_set_call_timeout($connection, int $time_out): void * @param resource $connection An Oracle connection identifier, * returned by oci_connect, oci_pconnect, * or oci_new_connect. - * @param string $client_identifier User chosen string up to 64 bytes long. + * @param string $client_id User chosen string up to 64 bytes long. * @throws Oci8Exception * */ -function oci_set_client_identifier($connection, string $client_identifier): void +function oci_set_client_identifier($connection, string $client_id): void { error_clear_last(); - $result = \oci_set_client_identifier($connection, $client_identifier); + $result = \oci_set_client_identifier($connection, $client_id); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -1485,14 +1383,14 @@ function oci_set_client_info($connection, string $client_info): void * @param resource $connection An Oracle connection identifier, * returned by oci_connect, oci_pconnect, * or oci_new_connect. - * @param string $dbop User chosen string. + * @param string $action User chosen string. * @throws Oci8Exception * */ -function oci_set_db_operation($connection, string $dbop): void +function oci_set_db_operation($connection, string $action): void { error_clear_last(); - $result = \oci_set_db_operation($connection, $dbop); + $result = \oci_set_db_operation($connection, $action); if ($result === false) { throw Oci8Exception::createFromPhpError(); } @@ -1550,14 +1448,50 @@ function oci_set_edition(string $edition): void * @param resource $connection An Oracle connection identifier, * returned by oci_connect, oci_pconnect, * or oci_new_connect. - * @param string $module_name User chosen string up to 48 bytes long. + * @param string $name User chosen string up to 48 bytes long. + * @throws Oci8Exception + * + */ +function oci_set_module_name($connection, string $name): void +{ + error_clear_last(); + $result = \oci_set_module_name($connection, $name); + if ($result === false) { + throw Oci8Exception::createFromPhpError(); + } +} + + +/** + * Sets the internal buffer size used to fetch each CLOB or BLOB value when the + * implementation gets the internal Oracle LOB locator from the database after + * a successful query call to oci_execute and for each + * subsequent internal fetch request to the database. Increasing this value + * can improve the performance of fetching smaller LOBs by reducing round-trips + * between PHP and the database. Memory usage will change. + * + * The value affects LOBs returned as OCILob instances and also those returned + * using OCI_RETURN_LOBS. + * + * Call oci_set_prefetch_lob before + * calling oci_execute. If it is not called, the value + * of oci8.prefetch_lob_size + * is used. + * + * The LOB prefetch value should only be set with Oracle Database 12.2 or later. + * + * @param resource $statement A valid OCI8 statement + * identifier created by oci_parse and executed + * by oci_execute, or a REF + * CURSOR statement identifier. + * @param int $prefetch_lob_size The number of bytes of each LOB to be prefetched, >= 0 * @throws Oci8Exception * */ -function oci_set_module_name($connection, string $module_name): void +function oci_set_prefetch_lob($statement, int $prefetch_lob_size): void { error_clear_last(); - $result = \oci_set_module_name($connection, $module_name); + $result = \oci_set_prefetch_lob($statement, $prefetch_lob_size); if ($result === false) { throw Oci8Exception::createFromPhpError(); } |