PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 3.1.0
Defender Security – Malware Scanner, Login Security & Firewall v3.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / thecodingmachine / safe / generated / oci8.php

oci8.php in Defender Security – Malware Scanner, Login Security & Firewall 3.1.0, at vendor/thecodingmachine/safe/generated/oci8.php

1,722 lines 49.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Safe;
4
5 use Safe\Exceptions\Oci8Exception;
6
7 /**
8 * Binds the PHP array var_array to the Oracle
9 * placeholder name, which points to an Oracle PL/SQL
10 * array. Whether it will be used for input or output will be determined at
11 * run-time.
12 *
13 * @param resource $statement A valid OCI statement identifier.
14 * @param string $name The Oracle placeholder.
15 * @param array $var_array An array.
16 * @param int $max_table_length Sets the maximum length both for incoming and result arrays.
17 * @param int $max_item_length Sets maximum length for array items. If not specified or equals to -1,
18 * oci_bind_array_by_name will find the longest
19 * element in the incoming array and will use it as the maximum length.
20 * @param int $type Should be used to set the type of PL/SQL array items. See list of
21 * available types below:
22 *
23 *
24 *
25 *
26 * SQLT_NUM - for arrays of NUMBER.
27 *
28 *
29 *
30 *
31 * SQLT_INT - for arrays of INTEGER (Note: INTEGER
32 * it is actually a synonym for NUMBER(38), but
33 * SQLT_NUM type won't work in this case even
34 * though they are synonyms).
35 *
36 *
37 *
38 *
39 * SQLT_FLT - for arrays of FLOAT.
40 *
41 *
42 *
43 *
44 * SQLT_AFC - for arrays of CHAR.
45 *
46 *
47 *
48 *
49 * SQLT_CHR - for arrays of VARCHAR2.
50 *
51 *
52 *
53 *
54 * SQLT_VCS - for arrays of VARCHAR.
55 *
56 *
57 *
58 *
59 * SQLT_AVC - for arrays of CHARZ.
60 *
61 *
62 *
63 *
64 * SQLT_STR - for arrays of STRING.
65 *
66 *
67 *
68 *
69 * SQLT_LVC - for arrays of LONG VARCHAR.
70 *
71 *
72 *
73 *
74 * SQLT_ODT - for arrays of DATE.
75 *
76 *
77 *
78 *
79 * SQLT_NUM - for arrays of NUMBER.
80 *
81 * SQLT_INT - for arrays of INTEGER (Note: INTEGER
82 * it is actually a synonym for NUMBER(38), but
83 * SQLT_NUM type won't work in this case even
84 * though they are synonyms).
85 *
86 * SQLT_FLT - for arrays of FLOAT.
87 *
88 * SQLT_AFC - for arrays of CHAR.
89 *
90 * SQLT_CHR - for arrays of VARCHAR2.
91 *
92 * SQLT_VCS - for arrays of VARCHAR.
93 *
94 * SQLT_AVC - for arrays of CHARZ.
95 *
96 * SQLT_STR - for arrays of STRING.
97 *
98 * SQLT_LVC - for arrays of LONG VARCHAR.
99 *
100 * SQLT_ODT - for arrays of DATE.
101 * @throws Oci8Exception
102 *
103 */
104 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
105 {
106 error_clear_last();
107 $result = \oci_bind_array_by_name($statement, $name, $var_array, $max_table_length, $max_item_length, $type);
108 if ($result === false) {
109 throw Oci8Exception::createFromPhpError();
110 }
111 }
112
113
114 /**
115 * Binds a PHP variable variable to the Oracle
116 * bind variable placeholder bv_name. Binding
117 * is important for Oracle database performance and also as a way to
118 * avoid SQL Injection security issues.
119 *
120 * Binding allows the database to reuse the statement context and
121 * caches from previous executions of the statement, even if another
122 * user or process originally executed it. Binding reduces SQL
123 * Injection concerns because the data associated with a bind
124 * variable is never treated as part of the SQL statement. It does
125 * not need quoting or escaping.
126 *
127 * PHP variables that have been bound can be changed and the
128 * statement re-executed without needing to re-parse the statement or
129 * re-bind.
130 *
131 * In Oracle, bind variables are commonly divided
132 * into IN binds for values that are passed into
133 * the database, and OUT binds for values that are
134 * returned to PHP. A bind variable may be
135 * both IN and OUT. Whether a
136 * bind variable will be used for input or output is determined at
137 * run-time.
138 *
139 * You must specify maxlength when using
140 * an OUT bind so that PHP allocates enough memory
141 * to hold the returned value.
142 *
143 * For IN binds it is recommended to set
144 * the maxlength length if the statement is
145 * re-executed multiple times with different values for the PHP
146 * variable. Otherwise Oracle may truncate data to the length of the
147 * initial PHP variable value. If you don't know what the maximum
148 * length will be, then re-call oci_bind_by_name
149 * with the current data size prior to
150 * each oci_execute call. Binding an
151 * unnecessarily large length will have an impact on process memory
152 * in the database.
153 *
154 * A bind call tells Oracle which memory address to read data from.
155 * For IN binds that address needs to contain
156 * valid data when oci_execute is called. This
157 * means that the variable bound must remain in scope until
158 * execution. If it doesn't, unexpected results or errors such as
159 * "ORA-01460: unimplemented or unreasonable conversion requested"
160 * may occur. For OUT binds one symptom is no
161 * value being set in the PHP variable.
162 *
163 * For a statement that is repeatedly executed, binding values that
164 * never change may reduce the ability of the Oracle optimizer to
165 * choose the best statement execution plan. Long running statements
166 * that are rarely re-executed may not benefit from binding. However
167 * in both cases, binding might be safer than joining strings into a
168 * SQL statement, as this can be a security risk if unfiltered user
169 * text is concatenated.
170 *
171 * @param resource $statement A valid OCI8 statement identifer.
172 * @param string $bv_name The colon-prefixed bind variable placeholder used in the
173 * statement. The colon is optional
174 * in bv_name. Oracle does not use question
175 * marks for placeholders.
176 * @param mixed $variable The PHP variable to be associated with bv_name
177 * @param int $maxlength Sets the maximum length for the data. If you set it to -1, this
178 * function will use the current length
179 * of variable to set the maximum
180 * length. In this case the variable must
181 * exist and contain data
182 * when oci_bind_by_name is called.
183 * @param int $type The datatype that Oracle will treat the data as. The
184 * default type used
185 * is SQLT_CHR. Oracle will convert the data
186 * between this type and the database column (or PL/SQL variable
187 * type), when possible.
188 *
189 * If you need to bind an abstract datatype (LOB/ROWID/BFILE) you
190 * need to allocate it first using the
191 * oci_new_descriptor function. The
192 * length is not used for abstract datatypes
193 * and should be set to -1.
194 *
195 * Possible values for type are:
196 *
197 *
198 *
199 * SQLT_BFILEE or OCI_B_BFILE
200 * - for BFILEs;
201 *
202 *
203 *
204 *
205 * SQLT_CFILEE or OCI_B_CFILEE
206 * - for CFILEs;
207 *
208 *
209 *
210 *
211 * SQLT_CLOB or OCI_B_CLOB
212 * - for CLOBs;
213 *
214 *
215 *
216 *
217 * SQLT_BLOB or OCI_B_BLOB
218 * - for BLOBs;
219 *
220 *
221 *
222 *
223 * SQLT_RDD or OCI_B_ROWID
224 * - for ROWIDs;
225 *
226 *
227 *
228 *
229 * SQLT_NTY or OCI_B_NTY
230 * - for named datatypes;
231 *
232 *
233 *
234 *
235 * SQLT_INT or OCI_B_INT - for integers;
236 *
237 *
238 *
239 *
240 * SQLT_CHR - for VARCHARs;
241 *
242 *
243 *
244 *
245 * SQLT_BIN or OCI_B_BIN
246 * - for RAW columns;
247 *
248 *
249 *
250 *
251 * SQLT_LNG - for LONG columns;
252 *
253 *
254 *
255 *
256 * SQLT_LBI - for LONG RAW columns;
257 *
258 *
259 *
260 *
261 * SQLT_RSET - for cursors created
262 * with oci_new_cursor;
263 *
264 *
265 *
266 *
267 * SQLT_BOL or OCI_B_BOL
268 * - for PL/SQL BOOLEANs (Requires OCI8 2.0.7 and Oracle Database 12c)
269 *
270 *
271 *
272 *
273 * SQLT_BFILEE or OCI_B_BFILE
274 * - for BFILEs;
275 *
276 * SQLT_CFILEE or OCI_B_CFILEE
277 * - for CFILEs;
278 *
279 * SQLT_CLOB or OCI_B_CLOB
280 * - for CLOBs;
281 *
282 * SQLT_BLOB or OCI_B_BLOB
283 * - for BLOBs;
284 *
285 * SQLT_RDD or OCI_B_ROWID
286 * - for ROWIDs;
287 *
288 * SQLT_NTY or OCI_B_NTY
289 * - for named datatypes;
290 *
291 * SQLT_INT or OCI_B_INT - for integers;
292 *
293 * SQLT_CHR - for VARCHARs;
294 *
295 * SQLT_BIN or OCI_B_BIN
296 * - for RAW columns;
297 *
298 * SQLT_LNG - for LONG columns;
299 *
300 * SQLT_LBI - for LONG RAW columns;
301 *
302 * SQLT_RSET - for cursors created
303 * with oci_new_cursor;
304 *
305 * SQLT_BOL or OCI_B_BOL
306 * - for PL/SQL BOOLEANs (Requires OCI8 2.0.7 and Oracle Database 12c)
307 * @throws Oci8Exception
308 *
309 */
310 function oci_bind_by_name($statement, string $bv_name, &$variable, int $maxlength = -1, int $type = SQLT_CHR): void
311 {
312 error_clear_last();
313 $result = \oci_bind_by_name($statement, $bv_name, $variable, $maxlength, $type);
314 if ($result === false) {
315 throw Oci8Exception::createFromPhpError();
316 }
317 }
318
319
320 /**
321 * Invalidates a cursor, freeing all associated resources and cancels the
322 * ability to read from it.
323 *
324 * @param resource $statement An OCI statement.
325 * @throws Oci8Exception
326 *
327 */
328 function oci_cancel($statement): void
329 {
330 error_clear_last();
331 $result = \oci_cancel($statement);
332 if ($result === false) {
333 throw Oci8Exception::createFromPhpError();
334 }
335 }
336
337
338 /**
339 * Unsets connection. The underlying database
340 * connection is closed if no other resources are using it and if it
341 * was created with oci_connect
342 * or oci_new_connect.
343 *
344 * It is recommended to close connections that are no longer needed
345 * because this makes database resources available for other users.
346 *
347 * @param resource $connection An Oracle connection identifier returned by
348 * oci_connect, oci_pconnect,
349 * or oci_new_connect.
350 * @throws Oci8Exception
351 *
352 */
353 function oci_close($connection): void
354 {
355 error_clear_last();
356 $result = \oci_close($connection);
357 if ($result === false) {
358 throw Oci8Exception::createFromPhpError();
359 }
360 }
361
362
363 /**
364 * Commits the outstanding transaction for the
365 * Oracle connection. A commit ends the
366 * current transaction and makes permanent all changes. It releases
367 * all locks held.
368 *
369 * A transaction begins when the first SQL statement that changes data
370 * is executed with oci_execute using
371 * the OCI_NO_AUTO_COMMIT flag. Further data
372 * changes made by other statements become part of the same
373 * transaction. Data changes made in a transaction are temporary
374 * until the transaction is committed or rolled back. Other users of
375 * the database will not see the changes until they are committed.
376 *
377 * When inserting or updating data, using transactions is recommended
378 * for relational data consistency and for performance reasons.
379 *
380 * @param resource $connection An Oracle connection identifier, returned by
381 * oci_connect, oci_pconnect, or oci_new_connect.
382 * @throws Oci8Exception
383 *
384 */
385 function oci_commit($connection): void
386 {
387 error_clear_last();
388 $result = \oci_commit($connection);
389 if ($result === false) {
390 throw Oci8Exception::createFromPhpError();
391 }
392 }
393
394
395 /**
396 * Returns a connection identifier needed for most other OCI8 operations.
397 *
398 * See Connection Handling for
399 * general information on connection management and connection
400 * pooling.
401 *
402 * From PHP 5.1.2 (PECL OCI8 1.1) oci_close can
403 * be used to close the connection.
404 *
405 * The second and subsequent calls to oci_connect
406 * with the same parameters will return the connection handle returned
407 * from the first call. This means that transactions in one handle are
408 * also in the other handles, because they use the
409 * same underlying database connection. If two
410 * handles need to be transactionally isolated from each other, use
411 * oci_new_connect instead.
412 *
413 * @param string $username The Oracle user name.
414 * @param string $password The password for username.
415 * @param string $connection_string Contains
416 * the Oracle instance to connect to. It can be
417 * an Easy Connect
418 * string, or a Connect Name from
419 * the tnsnames.ora file, or the name of a local
420 * Oracle instance.
421 *
422 * If not specified, PHP uses
423 * environment variables such as TWO_TASK (on Linux)
424 * or LOCAL (on Windows)
425 * and ORACLE_SID to determine the
426 * Oracle instance to connect to.
427 *
428 *
429 * To use the Easy Connect naming method, PHP must be linked with Oracle
430 * 10g or greater Client libraries. The Easy Connect string for Oracle
431 * 10g is of the form:
432 * [//]host_name[:port][/service_name]. From Oracle
433 * 11g, the syntax is:
434 * [//]host_name[:port][/service_name][:server_type][/instance_name].
435 * Service names can be found by running the Oracle
436 * utility lsnrctl status on the database server
437 * machine.
438 *
439 *
440 * The tnsnames.ora file can be in the Oracle Net
441 * search path, which
442 * includes $ORACLE_HOME/network/admin
443 * and /etc. Alternatively
444 * set TNS_ADMIN so
445 * that $TNS_ADMIN/tnsnames.ora is read. Make sure
446 * the web daemon has read access to the file.
447 * @param string $character_set Determines
448 * the character set used by the Oracle Client libraries. The character
449 * set does not need to match the character set used by the database. If
450 * it doesn't match, Oracle will do its best to convert data to and from
451 * the database character set. Depending on the character sets this may
452 * not give usable results. Conversion also adds some time overhead.
453 *
454 * If not specified, the
455 * Oracle Client libraries determine a character set from
456 * the NLS_LANG environment variable.
457 *
458 * Passing this parameter can
459 * reduce the time taken to connect.
460 * @param int $session_mode This
461 * parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the
462 * following values: OCI_DEFAULT,
463 * OCI_SYSOPER and OCI_SYSDBA.
464 * If either OCI_SYSOPER or
465 * OCI_SYSDBA were specified, this function will try
466 * to establish privileged connection using external credentials.
467 * Privileged connections are disabled by default. To enable them you
468 * need to set oci8.privileged_connect
469 * to On.
470 *
471 *
472 * PHP 5.3 (PECL OCI8 1.3.4) introduced the
473 * OCI_CRED_EXT mode value. This tells Oracle to use
474 * External or OS authentication, which must be configured in the
475 * database. The OCI_CRED_EXT flag can only be used
476 * with username of "/" and a empty password.
477 * oci8.privileged_connect
478 * may be On or Off.
479 *
480 *
481 * OCI_CRED_EXT may be combined with the
482 * OCI_SYSOPER or
483 * OCI_SYSDBA modes.
484 *
485 *
486 * OCI_CRED_EXT is not supported on Windows for
487 * security reasons.
488 * @return resource Returns a connection identifier.
489 * @throws Oci8Exception
490 *
491 */
492 function oci_connect(string $username, string $password, string $connection_string = null, string $character_set = null, int $session_mode = null)
493 {
494 error_clear_last();
495 if ($session_mode !== null) {
496 $result = \oci_connect($username, $password, $connection_string, $character_set, $session_mode);
497 } elseif ($character_set !== null) {
498 $result = \oci_connect($username, $password, $connection_string, $character_set);
499 } elseif ($connection_string !== null) {
500 $result = \oci_connect($username, $password, $connection_string);
501 } else {
502 $result = \oci_connect($username, $password);
503 }
504 if ($result === false) {
505 throw Oci8Exception::createFromPhpError();
506 }
507 return $result;
508 }
509
510
511 /**
512 * Associates a PHP variable with a column for query fetches using oci_fetch.
513 *
514 * The oci_define_by_name call must occur before
515 * executing oci_execute.
516 *
517 * @param resource $statement A valid OCI8 statement
518 * identifier created by oci_parse and executed
519 * by oci_execute, or a REF
520 * CURSOR statement identifier.
521 * @param string $column_name The column name used in the query.
522 *
523 * Use uppercase for Oracle's default, non-case sensitive column
524 * names. Use the exact column name case for case-sensitive
525 * column names.
526 * @param mixed $variable The PHP variable that will contain the returned column value.
527 * @param int $type The data type to be returned. Generally not needed. Note that
528 * Oracle-style data conversions are not performed. For example,
529 * SQLT_INT will be ignored and the returned
530 * data type will still be SQLT_CHR.
531 *
532 * You can optionally use oci_new_descriptor
533 * to allocate LOB/ROWID/BFILE descriptors.
534 * @throws Oci8Exception
535 *
536 */
537 function oci_define_by_name($statement, string $column_name, &$variable, int $type = SQLT_CHR): void
538 {
539 error_clear_last();
540 $result = \oci_define_by_name($statement, $column_name, $variable, $type);
541 if ($result === false) {
542 throw Oci8Exception::createFromPhpError();
543 }
544 }
545
546
547 /**
548 * Executes a statement previously returned
549 * from oci_parse.
550 *
551 * After execution, statements like INSERT will
552 * have data committed to the database by default. For statements
553 * like SELECT, execution performs the logic of the
554 * query. Query results can subsequently be fetched in PHP with
555 * functions like oci_fetch_array.
556 *
557 * Each parsed statement may be executed multiple times, saving the
558 * cost of re-parsing. This is commonly used
559 * for INSERT statements when data is bound
560 * with oci_bind_by_name.
561 *
562 * @param resource $statement A valid OCI statement identifier.
563 * @param int $mode An optional second parameter can be one of the following constants:
564 *
565 * Execution Modes
566 *
567 *
568 *
569 * Constant
570 * Description
571 *
572 *
573 *
574 *
575 * OCI_COMMIT_ON_SUCCESS
576 * Automatically commit all outstanding changes for
577 * this connection when the statement has succeeded. This
578 * is the default.
579 *
580 *
581 * OCI_DESCRIBE_ONLY
582 * Make query meta data available to functions
583 * like oci_field_name but do not
584 * create a result set. Any subsequent fetch call such
585 * as oci_fetch_array will
586 * fail.
587 *
588 *
589 * OCI_NO_AUTO_COMMIT
590 * Do not automatically commit changes. Prior to PHP
591 * 5.3.2 (PECL OCI8 1.4)
592 * use OCI_DEFAULT which is equivalent
593 * to OCI_NO_AUTO_COMMIT.
594 *
595 *
596 *
597 *
598 *
599 * Using OCI_NO_AUTO_COMMIT mode starts or continues a
600 * transaction. Transactions are automatically rolled back when
601 * the connection is closed, or when the script ends. Explicitly
602 * call oci_commit to commit a transaction,
603 * or oci_rollback to abort it.
604 *
605 * When inserting or updating data, using transactions is
606 * recommended for relational data consistency and for performance
607 * reasons.
608 *
609 * If OCI_NO_AUTO_COMMIT mode is used for any
610 * statement including queries, and
611 * oci_commit
612 * or oci_rollback is not subsequently
613 * called, then OCI8 will perform a rollback at the end of the
614 * script even if no data was changed. To avoid an unnecessary
615 * rollback, many scripts do not
616 * use OCI_NO_AUTO_COMMIT mode for queries or
617 * PL/SQL. Be careful to ensure the appropriate transactional
618 * consistency for the application when
619 * using oci_execute with different modes in
620 * the same script.
621 * @throws Oci8Exception
622 *
623 */
624 function oci_execute($statement, int $mode = OCI_COMMIT_ON_SUCCESS): void
625 {
626 error_clear_last();
627 $result = \oci_execute($statement, $mode);
628 if ($result === false) {
629 throw Oci8Exception::createFromPhpError();
630 }
631 }
632
633
634 /**
635 * Fetches multiple rows from a query into a two-dimensional array.
636 * By default, all rows are returned.
637 *
638 * This function can be called only once for each query executed
639 * with oci_execute.
640 *
641 * @param resource $statement A valid OCI8 statement
642 * identifier created by oci_parse and executed
643 * by oci_execute, or a REF
644 * CURSOR statement identifier.
645 * @param array|null $output The variable to contain the returned rows.
646 *
647 * LOB columns are returned as strings, where Oracle supports
648 * conversion.
649 *
650 * See oci_fetch_array for more information
651 * on how data and types are fetched.
652 * @param int $skip The number of initial rows to discard when fetching the
653 * result. The default value is 0, so the first row onwards is
654 * returned.
655 * @param int $maxrows The number of rows to return. The default is -1 meaning return
656 * all the rows from skip + 1 onwards.
657 * @param int $flags Parameter flags indicates the array
658 * structure and whether associative arrays should be used.
659 *
660 * oci_fetch_all Array Structure Modes
661 *
662 *
663 *
664 * Constant
665 * Description
666 *
667 *
668 *
669 *
670 * OCI_FETCHSTATEMENT_BY_ROW
671 * The outer array will contain one sub-array per query
672 * row.
673 *
674 *
675 * OCI_FETCHSTATEMENT_BY_COLUMN
676 * The outer array will contain one sub-array per query
677 * column. This is the default.
678 *
679 *
680 *
681 *
682 *
683 * Arrays can be indexed either by column heading or numerically.
684 * Only one index mode will be returned.
685 *
686 * oci_fetch_all Array Index Modes
687 *
688 *
689 *
690 * Constant
691 * Description
692 *
693 *
694 *
695 *
696 * OCI_NUM
697 * Numeric indexes are used for each column's array.
698 *
699 *
700 * OCI_ASSOC
701 * Associative indexes are used for each column's
702 * array. This is the default.
703 *
704 *
705 *
706 *
707 *
708 * Use the addition operator "+" to choose a combination
709 * of array structure and index modes.
710 *
711 * Oracle's default, non-case sensitive column names will have
712 * uppercase array keys. Case-sensitive column names will have
713 * array keys using the exact column case.
714 * Use var_dump
715 * on output to verify the appropriate case
716 * to use for each query.
717 *
718 * Queries that have more than one column with the same name
719 * should use column aliases. Otherwise only one of the columns
720 * will appear in an associative array.
721 * @return int Returns the number of rows in output, which
722 * may be 0 or more.
723 * @throws Oci8Exception
724 *
725 */
726 function oci_fetch_all($statement, ?array &$output, int $skip = 0, int $maxrows = -1, int $flags = OCI_FETCHSTATEMENT_BY_COLUMN + OCI_ASSOC): int
727 {
728 error_clear_last();
729 $result = \oci_fetch_all($statement, $output, $skip, $maxrows, $flags);
730 if ($result === false) {
731 throw Oci8Exception::createFromPhpError();
732 }
733 return $result;
734 }
735
736
737 /**
738 * Returns the name of the field.
739 *
740 * @param resource $statement A valid OCI statement identifier.
741 * @param mixed $field Can be the field's index (1-based) or name.
742 * @return string Returns the name as a strings.
743 * @throws Oci8Exception
744 *
745 */
746 function oci_field_name($statement, $field): string
747 {
748 error_clear_last();
749 $result = \oci_field_name($statement, $field);
750 if ($result === false) {
751 throw Oci8Exception::createFromPhpError();
752 }
753 return $result;
754 }
755
756
757 /**
758 * Returns precision of the field.
759 *
760 * For FLOAT columns, precision is nonzero and scale is -127.
761 * If precision is 0, then column is NUMBER. Else it's
762 * NUMBER(precision, scale).
763 *
764 * @param resource $statement A valid OCI statement identifier.
765 * @param mixed $field Can be the field's index (1-based) or name.
766 * @return int Returns the precision as an integers.
767 * @throws Oci8Exception
768 *
769 */
770 function oci_field_precision($statement, $field): int
771 {
772 error_clear_last();
773 $result = \oci_field_precision($statement, $field);
774 if ($result === false) {
775 throw Oci8Exception::createFromPhpError();
776 }
777 return $result;
778 }
779
780
781 /**
782 * Returns the scale of the column with field index.
783 *
784 * For FLOAT columns, precision is nonzero and scale is -127.
785 * If precision is 0, then column is NUMBER. Else it's
786 * NUMBER(precision, scale).
787 *
788 * @param resource $statement A valid OCI statement identifier.
789 * @param mixed $field Can be the field's index (1-based) or name.
790 * @return int Returns the scale as an integers.
791 * @throws Oci8Exception
792 *
793 */
794 function oci_field_scale($statement, $field): int
795 {
796 error_clear_last();
797 $result = \oci_field_scale($statement, $field);
798 if ($result === false) {
799 throw Oci8Exception::createFromPhpError();
800 }
801 return $result;
802 }
803
804
805 /**
806 * Returns the size of a field.
807 *
808 * @param resource $statement A valid OCI statement identifier.
809 * @param mixed $field Can be the field's index (1-based) or name.
810 * @return int Returns the size of a field in bytess.
811 * @throws Oci8Exception
812 *
813 */
814 function oci_field_size($statement, $field): int
815 {
816 error_clear_last();
817 $result = \oci_field_size($statement, $field);
818 if ($result === false) {
819 throw Oci8Exception::createFromPhpError();
820 }
821 return $result;
822 }
823
824
825 /**
826 * Returns Oracle's raw "SQLT" data type of the field.
827 *
828 * If you want a field's type name, then use oci_field_type instead.
829 *
830 * @param resource $statement A valid OCI statement identifier.
831 * @param mixed $field Can be the field's index (1-based) or name.
832 * @return int Returns Oracle's raw data type as a numbers.
833 * @throws Oci8Exception
834 *
835 */
836 function oci_field_type_raw($statement, $field): int
837 {
838 error_clear_last();
839 $result = \oci_field_type_raw($statement, $field);
840 if ($result === false) {
841 throw Oci8Exception::createFromPhpError();
842 }
843 return $result;
844 }
845
846
847 /**
848 * Returns a field's data type name.
849 *
850 * @param resource $statement A valid OCI statement identifier.
851 * @param mixed $field Can be the field's index (1-based) or name.
852 * @return mixed Returns the field data type as a strings.
853 * @throws Oci8Exception
854 *
855 */
856 function oci_field_type($statement, $field)
857 {
858 error_clear_last();
859 $result = \oci_field_type($statement, $field);
860 if ($result === false) {
861 throw Oci8Exception::createFromPhpError();
862 }
863 return $result;
864 }
865
866
867 /**
868 * Frees a descriptor allocated by oci_new_descriptor.
869 *
870 * @param resource $descriptor
871 * @throws Oci8Exception
872 *
873 */
874 function oci_free_descriptor($descriptor): void
875 {
876 error_clear_last();
877 $result = \oci_free_descriptor($descriptor);
878 if ($result === false) {
879 throw Oci8Exception::createFromPhpError();
880 }
881 }
882
883
884 /**
885 * Frees resources associated with Oracle's cursor or statement, which was
886 * received from as a result of oci_parse or obtained
887 * from Oracle.
888 *
889 * @param resource $statement A valid OCI statement identifier.
890 * @throws Oci8Exception
891 *
892 */
893 function oci_free_statement($statement): void
894 {
895 error_clear_last();
896 $result = \oci_free_statement($statement);
897 if ($result === false) {
898 throw Oci8Exception::createFromPhpError();
899 }
900 }
901
902
903 /**
904 * Allocates a new collection object.
905 *
906 * @param resource $connection An Oracle connection identifier, returned by
907 * oci_connect or oci_pconnect.
908 * @param string $tdo Should be a valid named type (uppercase).
909 * @param string $schema Should point to the scheme, where the named type was created. The name
910 * of the current user is the default value.
911 * @return \OCI-Collection Returns a new OCICollection object.
912 * @throws Oci8Exception
913 *
914 */
915 function oci_new_collection($connection, string $tdo, string $schema = null)
916 {
917 error_clear_last();
918 $result = \oci_new_collection($connection, $tdo, $schema);
919 if ($result === false) {
920 throw Oci8Exception::createFromPhpError();
921 }
922 return $result;
923 }
924
925
926 /**
927 * Establishes a new connection to an Oracle server and logs on.
928 *
929 * Unlike oci_connect and
930 * oci_pconnect, oci_new_connect
931 * does not cache connections and will always return a brand-new freshly
932 * opened connection handle. This is useful if your application needs
933 * transactional isolation between two sets of queries.
934 *
935 * @param string $username The Oracle user name.
936 * @param string $password The password for username.
937 * @param string $connection_string Contains
938 * the Oracle instance to connect to. It can be
939 * an Easy Connect
940 * string, or a Connect Name from
941 * the tnsnames.ora file, or the name of a local
942 * Oracle instance.
943 *
944 * If not specified, PHP uses
945 * environment variables such as TWO_TASK (on Linux)
946 * or LOCAL (on Windows)
947 * and ORACLE_SID to determine the
948 * Oracle instance to connect to.
949 *
950 *
951 * To use the Easy Connect naming method, PHP must be linked with Oracle
952 * 10g or greater Client libraries. The Easy Connect string for Oracle
953 * 10g is of the form:
954 * [//]host_name[:port][/service_name]. From Oracle
955 * 11g, the syntax is:
956 * [//]host_name[:port][/service_name][:server_type][/instance_name].
957 * Service names can be found by running the Oracle
958 * utility lsnrctl status on the database server
959 * machine.
960 *
961 *
962 * The tnsnames.ora file can be in the Oracle Net
963 * search path, which
964 * includes $ORACLE_HOME/network/admin
965 * and /etc. Alternatively
966 * set TNS_ADMIN so
967 * that $TNS_ADMIN/tnsnames.ora is read. Make sure
968 * the web daemon has read access to the file.
969 * @param string $character_set Determines
970 * the character set used by the Oracle Client libraries. The character
971 * set does not need to match the character set used by the database. If
972 * it doesn't match, Oracle will do its best to convert data to and from
973 * the database character set. Depending on the character sets this may
974 * not give usable results. Conversion also adds some time overhead.
975 *
976 * If not specified, the
977 * Oracle Client libraries determine a character set from
978 * the NLS_LANG environment variable.
979 *
980 * Passing this parameter can
981 * reduce the time taken to connect.
982 * @param int $session_mode This
983 * parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the
984 * following values: OCI_DEFAULT,
985 * OCI_SYSOPER and OCI_SYSDBA.
986 * If either OCI_SYSOPER or
987 * OCI_SYSDBA were specified, this function will try
988 * to establish privileged connection using external credentials.
989 * Privileged connections are disabled by default. To enable them you
990 * need to set oci8.privileged_connect
991 * to On.
992 *
993 *
994 * PHP 5.3 (PECL OCI8 1.3.4) introduced the
995 * OCI_CRED_EXT mode value. This tells Oracle to use
996 * External or OS authentication, which must be configured in the
997 * database. The OCI_CRED_EXT flag can only be used
998 * with username of "/" and a empty password.
999 * oci8.privileged_connect
1000 * may be On or Off.
1001 *
1002 *
1003 * OCI_CRED_EXT may be combined with the
1004 * OCI_SYSOPER or
1005 * OCI_SYSDBA modes.
1006 *
1007 *
1008 * OCI_CRED_EXT is not supported on Windows for
1009 * security reasons.
1010 * @return resource Returns a connection identifier.
1011 * @throws Oci8Exception
1012 *
1013 */
1014 function oci_new_connect(string $username, string $password, string $connection_string = null, string $character_set = null, int $session_mode = null)
1015 {
1016 error_clear_last();
1017 if ($session_mode !== null) {
1018 $result = \oci_new_connect($username, $password, $connection_string, $character_set, $session_mode);
1019 } elseif ($character_set !== null) {
1020 $result = \oci_new_connect($username, $password, $connection_string, $character_set);
1021 } elseif ($connection_string !== null) {
1022 $result = \oci_new_connect($username, $password, $connection_string);
1023 } else {
1024 $result = \oci_new_connect($username, $password);
1025 }
1026 if ($result === false) {
1027 throw Oci8Exception::createFromPhpError();
1028 }
1029 return $result;
1030 }
1031
1032
1033 /**
1034 * Allocates a new statement handle on the specified connection.
1035 *
1036 * @param resource $connection An Oracle connection identifier, returned by
1037 * oci_connect or oci_pconnect.
1038 * @return resource Returns a new statement handle.
1039 * @throws Oci8Exception
1040 *
1041 */
1042 function oci_new_cursor($connection)
1043 {
1044 error_clear_last();
1045 $result = \oci_new_cursor($connection);
1046 if ($result === false) {
1047 throw Oci8Exception::createFromPhpError();
1048 }
1049 return $result;
1050 }
1051
1052
1053 /**
1054 * Allocates resources to hold descriptor or LOB locator.
1055 *
1056 * @param resource $connection An Oracle connection identifier, returned by
1057 * oci_connect or oci_pconnect.
1058 * @param int $type Valid values for type are:
1059 * OCI_DTYPE_FILE, OCI_DTYPE_LOB and
1060 * OCI_DTYPE_ROWID.
1061 * @return \OCI-Lob Returns a new LOB or FILE descriptor on success, FALSE on error.
1062 * @throws Oci8Exception
1063 *
1064 */
1065 function oci_new_descriptor($connection, int $type = OCI_DTYPE_LOB)
1066 {
1067 error_clear_last();
1068 $result = \oci_new_descriptor($connection, $type);
1069 if ($result === false) {
1070 throw Oci8Exception::createFromPhpError();
1071 }
1072 return $result;
1073 }
1074
1075
1076 /**
1077 * Gets the number of columns in the given statement.
1078 *
1079 * @param resource $statement A valid OCI statement identifier.
1080 * @return int Returns the number of columns as an integers.
1081 * @throws Oci8Exception
1082 *
1083 */
1084 function oci_num_fields($statement): int
1085 {
1086 error_clear_last();
1087 $result = \oci_num_fields($statement);
1088 if ($result === false) {
1089 throw Oci8Exception::createFromPhpError();
1090 }
1091 return $result;
1092 }
1093
1094
1095 /**
1096 * Gets the number of rows affected during statement execution.
1097 *
1098 * @param resource $statement A valid OCI statement identifier.
1099 * @return int Returns the number of rows affected as an integers.
1100 * @throws Oci8Exception
1101 *
1102 */
1103 function oci_num_rows($statement): int
1104 {
1105 error_clear_last();
1106 $result = \oci_num_rows($statement);
1107 if ($result === false) {
1108 throw Oci8Exception::createFromPhpError();
1109 }
1110 return $result;
1111 }
1112
1113
1114 /**
1115 * Prepares sql_text using
1116 * connection and returns the statement identifier,
1117 * which can be used with oci_bind_by_name,
1118 * oci_execute and other functions.
1119 *
1120 * Statement identifiers can be freed
1121 * with oci_free_statement or by setting the
1122 * variable to NULL.
1123 *
1124 * @param resource $connection An Oracle connection identifier, returned by
1125 * oci_connect, oci_pconnect, or oci_new_connect.
1126 * @param string $sql_text The SQL or PL/SQL statement.
1127 *
1128 * SQL statements should not end with a
1129 * semi-colon (";"). PL/SQL
1130 * statements should end with a semi-colon
1131 * (";").
1132 * @return resource Returns a statement handle on success.
1133 * @throws Oci8Exception
1134 *
1135 */
1136 function oci_parse($connection, string $sql_text)
1137 {
1138 error_clear_last();
1139 $result = \oci_parse($connection, $sql_text);
1140 if ($result === false) {
1141 throw Oci8Exception::createFromPhpError();
1142 }
1143 return $result;
1144 }
1145
1146
1147 /**
1148 * Creates a persistent connection to an Oracle server and logs on.
1149 *
1150 * Persistent connections are cached and re-used between requests, resulting
1151 * in reduced overhead on each page load; a typical PHP application will have
1152 * a single persistent connection open against an Oracle server per Apache
1153 * child process (or PHP FastCGI/CGI process). See the Persistent Database
1154 * Connections section for more information.
1155 *
1156 * @param string $username The Oracle user name.
1157 * @param string $password The password for username.
1158 * @param string $connection_string Contains
1159 * the Oracle instance to connect to. It can be
1160 * an Easy Connect
1161 * string, or a Connect Name from
1162 * the tnsnames.ora file, or the name of a local
1163 * Oracle instance.
1164 *
1165 * If not specified, PHP uses
1166 * environment variables such as TWO_TASK (on Linux)
1167 * or LOCAL (on Windows)
1168 * and ORACLE_SID to determine the
1169 * Oracle instance to connect to.
1170 *
1171 *
1172 * To use the Easy Connect naming method, PHP must be linked with Oracle
1173 * 10g or greater Client libraries. The Easy Connect string for Oracle
1174 * 10g is of the form:
1175 * [//]host_name[:port][/service_name]. From Oracle
1176 * 11g, the syntax is:
1177 * [//]host_name[:port][/service_name][:server_type][/instance_name].
1178 * Service names can be found by running the Oracle
1179 * utility lsnrctl status on the database server
1180 * machine.
1181 *
1182 *
1183 * The tnsnames.ora file can be in the Oracle Net
1184 * search path, which
1185 * includes $ORACLE_HOME/network/admin
1186 * and /etc. Alternatively
1187 * set TNS_ADMIN so
1188 * that $TNS_ADMIN/tnsnames.ora is read. Make sure
1189 * the web daemon has read access to the file.
1190 * @param string $character_set Determines
1191 * the character set used by the Oracle Client libraries. The character
1192 * set does not need to match the character set used by the database. If
1193 * it doesn't match, Oracle will do its best to convert data to and from
1194 * the database character set. Depending on the character sets this may
1195 * not give usable results. Conversion also adds some time overhead.
1196 *
1197 * If not specified, the
1198 * Oracle Client libraries determine a character set from
1199 * the NLS_LANG environment variable.
1200 *
1201 * Passing this parameter can
1202 * reduce the time taken to connect.
1203 * @param int $session_mode This
1204 * parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the
1205 * following values: OCI_DEFAULT,
1206 * OCI_SYSOPER and OCI_SYSDBA.
1207 * If either OCI_SYSOPER or
1208 * OCI_SYSDBA were specified, this function will try
1209 * to establish privileged connection using external credentials.
1210 * Privileged connections are disabled by default. To enable them you
1211 * need to set oci8.privileged_connect
1212 * to On.
1213 *
1214 *
1215 * PHP 5.3 (PECL OCI8 1.3.4) introduced the
1216 * OCI_CRED_EXT mode value. This tells Oracle to use
1217 * External or OS authentication, which must be configured in the
1218 * database. The OCI_CRED_EXT flag can only be used
1219 * with username of "/" and a empty password.
1220 * oci8.privileged_connect
1221 * may be On or Off.
1222 *
1223 *
1224 * OCI_CRED_EXT may be combined with the
1225 * OCI_SYSOPER or
1226 * OCI_SYSDBA modes.
1227 *
1228 *
1229 * OCI_CRED_EXT is not supported on Windows for
1230 * security reasons.
1231 * @return resource Returns a connection identifier.
1232 * @throws Oci8Exception
1233 *
1234 */
1235 function oci_pconnect(string $username, string $password, string $connection_string = null, string $character_set = null, int $session_mode = null)
1236 {
1237 error_clear_last();
1238 if ($session_mode !== null) {
1239 $result = \oci_pconnect($username, $password, $connection_string, $character_set, $session_mode);
1240 } elseif ($character_set !== null) {
1241 $result = \oci_pconnect($username, $password, $connection_string, $character_set);
1242 } elseif ($connection_string !== null) {
1243 $result = \oci_pconnect($username, $password, $connection_string);
1244 } else {
1245 $result = \oci_pconnect($username, $password);
1246 }
1247 if ($result === false) {
1248 throw Oci8Exception::createFromPhpError();
1249 }
1250 return $result;
1251 }
1252
1253
1254 /**
1255 * Returns the data from field in the current row,
1256 * fetched by oci_fetch.
1257 *
1258 * For details on the data type mapping performed by
1259 * the OCI8 extension, see the datatypes
1260 * supported by the driver
1261 *
1262 * @param resource $statement
1263 * @param mixed $field Can be either use the column number (1-based) or the column name.
1264 * The case of the column name must be the case that Oracle meta data
1265 * describes the column as, which is uppercase for columns created
1266 * case insensitively.
1267 * @return string Returns everything as strings except for abstract types (ROWIDs, LOBs and
1268 * FILEs).
1269 * @throws Oci8Exception
1270 *
1271 */
1272 function oci_result($statement, $field): string
1273 {
1274 error_clear_last();
1275 $result = \oci_result($statement, $field);
1276 if ($result === false) {
1277 throw Oci8Exception::createFromPhpError();
1278 }
1279 return $result;
1280 }
1281
1282
1283 /**
1284 * Reverts all uncommitted changes for the Oracle
1285 * connection and ends the transaction. It
1286 * releases all locks held. All Oracle SAVEPOINTS
1287 * are erased.
1288 *
1289 * A transaction begins when the first SQL statement that changes data
1290 * is executed with oci_execute using
1291 * the OCI_NO_AUTO_COMMIT flag. Further data
1292 * changes made by other statements become part of the same
1293 * transaction. Data changes made in a transaction are temporary
1294 * until the transaction is committed or rolled back. Other users of
1295 * the database will not see the changes until they are committed.
1296 *
1297 * When inserting or updating data, using transactions is recommended
1298 * for relational data consistency and for performance reasons.
1299 *
1300 * @param resource $connection An Oracle connection identifier, returned by
1301 * oci_connect, oci_pconnect
1302 * or oci_new_connect.
1303 * @throws Oci8Exception
1304 *
1305 */
1306 function oci_rollback($connection): void
1307 {
1308 error_clear_last();
1309 $result = \oci_rollback($connection);
1310 if ($result === false) {
1311 throw Oci8Exception::createFromPhpError();
1312 }
1313 }
1314
1315
1316 /**
1317 * Returns a string with the Oracle Database version and available options
1318 *
1319 * @param resource $connection
1320 * @return string Returns the version information as a string.
1321 * @throws Oci8Exception
1322 *
1323 */
1324 function oci_server_version($connection): string
1325 {
1326 error_clear_last();
1327 $result = \oci_server_version($connection);
1328 if ($result === false) {
1329 throw Oci8Exception::createFromPhpError();
1330 }
1331 return $result;
1332 }
1333
1334
1335 /**
1336 * Sets the action name for Oracle tracing.
1337 *
1338 * The action name is registered with the database when the next
1339 * 'round-trip' from PHP to the database occurs, typically when an SQL
1340 * statement is executed.
1341 *
1342 * The action name can subsequently be queried from database administration
1343 * views such as V$SESSION. It can be used for
1344 * tracing and monitoring such as with V$SQLAREA
1345 * and DBMS_MONITOR.SERV_MOD_ACT_STAT_ENABLE.
1346 *
1347 * The value may be retained across persistent connections.
1348 *
1349 * @param resource $connection An Oracle connection identifier,
1350 * returned by oci_connect, oci_pconnect,
1351 * or oci_new_connect.
1352 * @param string $action_name User chosen string up to 32 bytes long.
1353 * @throws Oci8Exception
1354 *
1355 */
1356 function oci_set_action($connection, string $action_name): void
1357 {
1358 error_clear_last();
1359 $result = \oci_set_action($connection, $action_name);
1360 if ($result === false) {
1361 throw Oci8Exception::createFromPhpError();
1362 }
1363 }
1364
1365
1366 /**
1367 * Sets a timeout limiting the maxium time a database round-trip using this connection may take.
1368 *
1369 * Each OCI8 operation may make zero or more calls to Oracle's client
1370 * library. These internal calls may then may make zero or more
1371 * round-trips to Oracle Database. If any one of those round-trips
1372 * takes more than time_out milliseconds, then the
1373 * operation is cancelled and an error is returned to the application.
1374 *
1375 * The time_out value applies to each round-trip
1376 * individually, not to the sum of all round-trips. Time spent
1377 * processing in PHP OCI8 before or after the completion of each
1378 * round-trip is not counted.
1379 *
1380 * When a call is interrupted, Oracle will attempt to clean up the
1381 * connection for reuse. This operation is allowed to run for
1382 * another time_out period. Depending on the
1383 * outcome of the cleanup, the connection may or may not be reusable.
1384 *
1385 * When persistent connections are used, the timeout value will be
1386 * retained across PHP requests.
1387 *
1388 * The oci_set_call_timeout function is available
1389 * when OCI8 uses Oracle 18 (or later) Client libraries.
1390 *
1391 * @param resource $connection An Oracle connection identifier,
1392 * returned by oci_connect, oci_pconnect,
1393 * or oci_new_connect.
1394 * @param int $time_out The maximum time in milliseconds that any single round-trip between PHP and Oracle Database may take.
1395 * @throws Oci8Exception
1396 *
1397 */
1398 function oci_set_call_timeout($connection, int $time_out): void
1399 {
1400 error_clear_last();
1401 $result = \oci_set_call_timeout($connection, $time_out);
1402 if ($result === false) {
1403 throw Oci8Exception::createFromPhpError();
1404 }
1405 }
1406
1407
1408 /**
1409 * Sets the client identifier used by various database components to
1410 * identify lightweight application users who authenticate as the same
1411 * database user.
1412 *
1413 * The client identifier is registered with the database when the next
1414 * 'round-trip' from PHP to the database occurs, typically when an SQL
1415 * statement is executed.
1416 *
1417 * The identifier can subsequently be queried, for example
1418 * with SELECT SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER')
1419 * FROM DUAL. Database administration views such
1420 * as V$SESSION will also contain the value. It
1421 * can be used with DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE
1422 * for tracing and can also be used for auditing.
1423 *
1424 * The value may be retained across page requests that use the same persistent connection.
1425 *
1426 * @param resource $connection An Oracle connection identifier,
1427 * returned by oci_connect, oci_pconnect,
1428 * or oci_new_connect.
1429 * @param string $client_identifier User chosen string up to 64 bytes long.
1430 * @throws Oci8Exception
1431 *
1432 */
1433 function oci_set_client_identifier($connection, string $client_identifier): void
1434 {
1435 error_clear_last();
1436 $result = \oci_set_client_identifier($connection, $client_identifier);
1437 if ($result === false) {
1438 throw Oci8Exception::createFromPhpError();
1439 }
1440 }
1441
1442
1443 /**
1444 * Sets the client information for Oracle tracing.
1445 *
1446 * The client information is registered with the database when the next
1447 * 'round-trip' from PHP to the database occurs, typically when an SQL
1448 * statement is executed.
1449 *
1450 * The client information can subsequently be queried from database
1451 * administration views such as V$SESSION.
1452 *
1453 * The value may be retained across persistent connections.
1454 *
1455 * @param resource $connection An Oracle connection identifier,
1456 * returned by oci_connect, oci_pconnect,
1457 * or oci_new_connect.
1458 * @param string $client_info User chosen string up to 64 bytes long.
1459 * @throws Oci8Exception
1460 *
1461 */
1462 function oci_set_client_info($connection, string $client_info): void
1463 {
1464 error_clear_last();
1465 $result = \oci_set_client_info($connection, $client_info);
1466 if ($result === false) {
1467 throw Oci8Exception::createFromPhpError();
1468 }
1469 }
1470
1471
1472 /**
1473 * Sets the DBOP for Oracle tracing.
1474 *
1475 * The database operation name is registered with the database when the next
1476 * 'round-trip' from PHP to the database occurs, typically when a SQL
1477 * statement is executed.
1478 *
1479 * The database operation can subsequently be queried from database administration
1480 * views such as V$SQL_MONITOR.
1481 *
1482 * The oci_set_db_operation function is available
1483 * when OCI8 uses Oracle 12 (or later) Client libraries and Oracle Database 12 (or later).
1484 *
1485 * @param resource $connection An Oracle connection identifier,
1486 * returned by oci_connect, oci_pconnect,
1487 * or oci_new_connect.
1488 * @param string $dbop User chosen string.
1489 * @throws Oci8Exception
1490 *
1491 */
1492 function oci_set_db_operation($connection, string $dbop): void
1493 {
1494 error_clear_last();
1495 $result = \oci_set_db_operation($connection, $dbop);
1496 if ($result === false) {
1497 throw Oci8Exception::createFromPhpError();
1498 }
1499 }
1500
1501
1502 /**
1503 * Sets the database "edition" of objects to be used by a subsequent
1504 * connections.
1505 *
1506 * Oracle Editions allow concurrent versions of applications to run
1507 * using the same schema and object names. This is useful for
1508 * upgrading live systems.
1509 *
1510 * Call oci_set_edition before calling
1511 * oci_connect, oci_pconnect
1512 * or oci_new_connect.
1513 *
1514 * If an edition is set that is not valid in the database, connection
1515 * will fail even if oci_set_edition returns success.
1516 *
1517 * When using persistent connections, if a connection with the
1518 * requested edition setting already exists, it is reused. Otherwise,
1519 * a different persistent connection is created
1520 *
1521 * @param string $edition Oracle Database edition name previously created with the SQL
1522 * "CREATE EDITION" command.
1523 * @throws Oci8Exception
1524 *
1525 */
1526 function oci_set_edition(string $edition): void
1527 {
1528 error_clear_last();
1529 $result = \oci_set_edition($edition);
1530 if ($result === false) {
1531 throw Oci8Exception::createFromPhpError();
1532 }
1533 }
1534
1535
1536 /**
1537 * Sets the module name for Oracle tracing.
1538 *
1539 * The module name is registered with the database when the next
1540 * 'round-trip' from PHP to the database occurs, typically when an SQL
1541 * statement is executed.
1542 *
1543 * The name can subsequently be queried from database administration
1544 * views such as V$SESSION. It can be used for
1545 * tracing and monitoring such as with V$SQLAREA
1546 * and DBMS_MONITOR.SERV_MOD_ACT_STAT_ENABLE.
1547 *
1548 * The value may be retained across persistent connections.
1549 *
1550 * @param resource $connection An Oracle connection identifier,
1551 * returned by oci_connect, oci_pconnect,
1552 * or oci_new_connect.
1553 * @param string $module_name User chosen string up to 48 bytes long.
1554 * @throws Oci8Exception
1555 *
1556 */
1557 function oci_set_module_name($connection, string $module_name): void
1558 {
1559 error_clear_last();
1560 $result = \oci_set_module_name($connection, $module_name);
1561 if ($result === false) {
1562 throw Oci8Exception::createFromPhpError();
1563 }
1564 }
1565
1566
1567 /**
1568 * Sets the number of rows to be buffered by the Oracle Client
1569 * libraries after a successful query call
1570 * to oci_execute and for each subsequent
1571 * internal fetch request to the database. For queries returning a
1572 * large number of rows, performance can be significantly improved by
1573 * increasing the prefetch count above the
1574 * default oci8.default_prefetch
1575 * value.
1576 *
1577 * Prefetching is Oracle's efficient way of returning more than one
1578 * data row from the database in each network request. This can
1579 * result in better network and CPU utilization. The buffering of
1580 * rows is internal to OCI8 and the behavior of OCI8 fetching
1581 * functions is unchanged regardless of the prefetch count. For
1582 * example, oci_fetch_row will always return one
1583 * row. The prefetch buffer is per-statement and is not used by
1584 * re-executed statements or by other connections.
1585 *
1586 * Call oci_set_prefetch before
1587 * calling oci_execute.
1588 *
1589 * A tuning goal is to set the prefetch value to a reasonable size for
1590 * the network and database to handle. For queries returning a very
1591 * large number of rows, overall system efficiency might be better if
1592 * rows are retrieved from the database in several chunks (i.e set the
1593 * prefetch value smaller than the number of rows). This allows the
1594 * database to handle other users' statements while the PHP script is
1595 * processing the current set of rows.
1596 *
1597 * Query prefetching was introduced in Oracle 8i. REF CURSOR
1598 * prefetching was introduced in Oracle 11gR2 and occurs when PHP is
1599 * linked with Oracle 11gR2 (or later) Client libraries.
1600 * Nested cursor prefetching was
1601 * introduced in Oracle 11gR2 and requires both the Oracle Client
1602 * libraries and the database to be version 11gR2 or greater.
1603 *
1604 * Prefetching is not supported when queries contain LONG or LOB
1605 * columns. The prefetch value is ignored and single-row fetches will
1606 * be used in all the situations when prefetching is not supported.
1607 *
1608 * When using Oracle Database 12c, the prefetch
1609 * value set by PHP can be overridden by Oracle's
1610 * client oraaccess.xml configuration file. Refer
1611 * to Oracle documentation for more detail.
1612 *
1613 * @param resource $statement A valid OCI8 statement
1614 * identifier created by oci_parse and executed
1615 * by oci_execute, or a REF
1616 * CURSOR statement identifier.
1617 * @param int $rows The number of rows to be prefetched, &gt;= 0
1618 * @throws Oci8Exception
1619 *
1620 */
1621 function oci_set_prefetch($statement, int $rows): void
1622 {
1623 error_clear_last();
1624 $result = \oci_set_prefetch($statement, $rows);
1625 if ($result === false) {
1626 throw Oci8Exception::createFromPhpError();
1627 }
1628 }
1629
1630
1631 /**
1632 * Returns a keyword identifying the type of the
1633 * OCI8 statement.
1634 *
1635 * @param resource $statement A valid OCI8 statement identifier from oci_parse.
1636 * @return string Returns the type of statement as one of the
1637 * following strings.
1638 *
1639 * Statement type
1640 *
1641 *
1642 *
1643 * Return String
1644 * Notes
1645 *
1646 *
1647 *
1648 *
1649 * ALTER
1650 *
1651 *
1652 *
1653 * BEGIN
1654 *
1655 *
1656 *
1657 * CALL
1658 * Introduced in PHP 5.2.1 (PECL OCI8 1.2.3)
1659 *
1660 *
1661 * CREATE
1662 *
1663 *
1664 *
1665 * DECLARE
1666 *
1667 *
1668 *
1669 * DELETE
1670 *
1671 *
1672 *
1673 * DROP
1674 *
1675 *
1676 *
1677 * INSERT
1678 *
1679 *
1680 *
1681 * SELECT
1682 *
1683 *
1684 *
1685 * UPDATE
1686 *
1687 *
1688 *
1689 * UNKNOW.
1690 * @throws Oci8Exception
1691 *
1692 */
1693 function oci_statement_type($statement): string
1694 {
1695 error_clear_last();
1696 $result = \oci_statement_type($statement);
1697 if ($result === false) {
1698 throw Oci8Exception::createFromPhpError();
1699 }
1700 return $result;
1701 }
1702
1703
1704 /**
1705 * Unregister the user-defined callback function registered to connection
1706 * by oci_register_taf_callback. See
1707 * OCI8 Transparent Application Failover (TAF) Support
1708 * for information.
1709 *
1710 * @param resource $connection An Oracle connection identifier.
1711 * @throws Oci8Exception
1712 *
1713 */
1714 function oci_unregister_taf_callback($connection): void
1715 {
1716 error_clear_last();
1717 $result = \oci_unregister_taf_callback($connection);
1718 if ($result === false) {
1719 throw Oci8Exception::createFromPhpError();
1720 }
1721 }
1722