├── tests ├── lob_009.txt ├── test.gif ├── CONFLICTS ├── drop_type.inc ├── drop_table.inc ├── clientversion.phpt ├── create_table.inc ├── close.phpt ├── minfo.phpt ├── uncommitted.phpt ├── connect.inc ├── test.txt ├── create_type.inc ├── connect.phpt ├── execute_mode.phpt ├── skipif.inc ├── select_null.phpt ├── array_bind_009.phpt ├── testping.phpt ├── exec_fetch.phpt ├── serverversion.phpt ├── b47243_1.phpt ├── old_oci_close.phpt ├── b47243_2.phpt ├── error1.phpt ├── skipifconnectfailure.inc ├── b47243_3.phpt ├── array_bind_012.phpt ├── old_oci_close1.phpt ├── bug36096.phpt ├── privileged_connect1.phpt ├── array_bind_uin.phpt ├── coll_004.phpt ├── error2.phpt ├── bug36010.phpt ├── bug38161.phpt ├── coll_004_func.phpt ├── privileged_connect.phpt ├── coll_001.phpt ├── pecl_bug6109.phpt ├── connect_1.phpt ├── drcp_connection_class.phpt ├── array_bind_bfloat.phpt ├── lob_temp1.phpt ├── array_bind_bdouble.phpt ├── pecl_bug16035.phpt ├── array_bind_010.phpt ├── persistent.phpt ├── bind_unsupported_2.phpt ├── coll_003.phpt ├── statement_cache.phpt ├── coll_002_func.phpt ├── lob_temp.phpt ├── coll_015.phpt ├── coll_017.phpt ├── coll_014.phpt ├── coll_013.phpt ├── define.phpt ├── lob_temp2.phpt ├── null_byte_3.phpt ├── bug26133.phpt ├── coll_003_func.phpt ├── coll_010.phpt ├── coll_015_func.phpt ├── coll_017_func.phpt ├── coll_012.phpt ├── coll_014_func.phpt ├── coll_013_func.phpt ├── coll_010_func.phpt ├── error.phpt ├── coll_002.phpt ├── coll_011.phpt ├── coll_012_func.phpt ├── lob_032.phpt ├── drcp_newconnect.phpt ├── gh-4.phpt ├── lob_036.phpt ├── coll_009.phpt ├── null_byte_1.phpt ├── lob_033.phpt ├── gh-4-return-lob.phpt ├── coll_011_func.phpt ├── connect_without_oracle_home.phpt ├── bind_sqltchr_2.phpt ├── bug35973.phpt ├── coll_009_func.phpt ├── bind_long_raw.phpt ├── bug32325.phpt ├── null_byte_2.phpt ├── prefetch.phpt ├── statement_type.phpt ├── bug44113.phpt ├── connect_with_charset_001.phpt ├── bind_raw.phpt ├── bug36403.phpt ├── bug44008.phpt ├── bind_raw_2.phpt ├── bug68298.phpt ├── bug44206.phpt ├── default_prefetch0.phpt ├── default_prefetch1.phpt ├── define0.phpt ├── fetch.phpt ├── bug47189.phpt ├── drcp_conn_close2.phpt ├── extauth_04.phpt ├── drcp_conn_close1.phpt ├── define1.phpt ├── bind_unsupported_3.phpt ├── default_prefetch2.phpt ├── drcp_pconn_close1.phpt ├── lob_010.phpt ├── drcp_pconn_close2.phpt ├── fetch_row.phpt ├── array_bind_013.phpt ├── descriptors.phpt ├── imp_res_get_none.phpt ├── fetch_all4.phpt ├── connect_without_oracle_home_11.phpt ├── coll_016.phpt ├── fetch_all1.phpt ├── lob_014.phpt ├── lob_012.phpt ├── lob_034.phpt ├── cursor_bind_err.phpt ├── fetch_assoc.phpt ├── bug42496_2.phpt ├── bug74625.phpt ├── lob_aliases.phpt ├── lob_005.phpt ├── lob_013.phpt ├── calltimeout1.phpt ├── coll_016_func.phpt ├── error_bind_3.phpt ├── error_set.phpt ├── bug40078.phpt ├── oci_execute_segfault.phpt ├── bug42496_1.phpt ├── bug45458.phpt ├── imp_res_get_exec.phpt ├── db_op_1.phpt ├── pecl_bug16842.phpt ├── lob_039.phpt ├── bug51291_2.phpt ├── imp_res_get_cancel.phpt ├── lob_002.phpt ├── cursors.phpt ├── pecl_bug10194.phpt ├── cursor_bind.phpt ├── lob_008.phpt ├── bind_query.phpt ├── bug37581.phpt ├── lob_016.phpt ├── bind_unsupported_1.phpt ├── imp_res_call_error.phpt ├── define4.phpt ├── lob_007.phpt ├── pecl_bug10194_blob.phpt ├── lob_044.phpt ├── bug71422.phpt ├── pecl_bug10194_blob_64.phpt ├── drcp_characterset.phpt ├── drcp_scope4.phpt ├── lob_009.phpt ├── imp_res_get_close_3.phpt ├── imp_res_cancel.phpt ├── lob_017.phpt ├── bug38173.phpt ├── drcp_scope3.phpt ├── define5.phpt ├── imp_res_func_error.phpt ├── lob_019.phpt ├── bug37220.phpt └── array_bind_001.phpt ├── CREDITS ├── .gitignore └── README.md /tests/lob_009.txt: -------------------------------------------------------------------------------- 1 | this 2 | is 3 | a 4 | test 5 | file for 6 | test lob_009.phpt 7 | -------------------------------------------------------------------------------- /tests/test.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php/pecl-database-oci8/main/tests/test.gif -------------------------------------------------------------------------------- /tests/CONFLICTS: -------------------------------------------------------------------------------- 1 | # OCI tests are network intensive and may cause timeouts in other tests 2 | all 3 | -------------------------------------------------------------------------------- /tests/drop_type.inc: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | OCI8 2 | Stig Bakken, Thies C. Arntzen, Andy Sautins, David Benson, Maxim Maletsky, Harald Radi, Antony Dovgal, Andi Gutmans, Wez Furlong, Christopher Jones, Oracle Corporation 3 | -------------------------------------------------------------------------------- /tests/drop_table.inc: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /tests/clientversion.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_client_version() 3 | --EXTENSIONS-- 4 | oci8 5 | --FILE-- 6 | 11 | --EXPECTF-- 12 | %d.%d.%d.%d.%d 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile.fragments 2 | Makefile.objects 3 | autom4te.cache/ 4 | build/ 5 | config.h.in 6 | config.log 7 | config.nice 8 | configure 9 | configure.ac 10 | run-tests.php 11 | tests/details_local.inc 12 | -------------------------------------------------------------------------------- /tests/create_table.inc: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /tests/close.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | connect/close/connect 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 20 | --EXPECT-- 21 | Done 22 | -------------------------------------------------------------------------------- /tests/minfo.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Code coverage for PHP_MINFO_FUNCTION(oci) 3 | --EXTENSIONS-- 4 | oci8 5 | --FILE-- 6 | 18 | --EXPECT-- 19 | Done 20 | -------------------------------------------------------------------------------- /tests/uncommitted.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | uncommitted connection 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 19 | --EXPECT-- 20 | Done 21 | -------------------------------------------------------------------------------- /tests/connect.inc: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /tests/test.txt: -------------------------------------------------------------------------------- 1 | Ipsum lorem, IPSUM Lorem Ipsum lorem Ipsum lorem 2 | Ipsum lorem IPSum Lorem Ipsum lorem ipsum Lorem 3 | Ipsum Lorem ipsum Lorem - ipsum Lorem ipsum lorem 4 | Ipsum lorem IPSUM Lorem Ipsum lorem, Ipsum lorem. 5 | 6 | Ipsum LOREM, ipsum Lorem Ipsum lorem Ipsum lorem 7 | Ipsum lorem Ipsum Lorem Ipsum lorem ipsum Lorem 8 | Ipsum Lorem ipsum Lorem ipsum Lorem; ipsum lorem 9 | Ipsum lorem ipsum LOREM Ipsum lorem Ipsum lorem! 10 | -------------------------------------------------------------------------------- /tests/create_type.inc: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /tests/connect.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_connect() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 24 | --EXPECTF-- 25 | resource(%d) of type (oci8 connection) 26 | Done 27 | -------------------------------------------------------------------------------- /tests/execute_mode.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_execute() and invalid execute mode 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 21 | --EXPECTF-- 22 | Warning: oci_execute(): Invalid execute mode given: -1 in %s on line %d 23 | Done 24 | -------------------------------------------------------------------------------- /tests/skipif.inc: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /tests/select_null.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | SELECTing NULL values 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 22 | --EXPECTF-- 23 | array(2) { 24 | [0]=> 25 | NULL 26 | ["%r(NULL|EXP)%r"]=> 27 | NULL 28 | } 29 | Done 30 | -------------------------------------------------------------------------------- /tests/array_bind_009.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_bind_array_by_name() and invalid values 9 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 16 | --EXPECTF-- 17 | Fatal error: Uncaught TypeError: oci_bind_array_by_name(): supplied resource is not a valid oci8 statement resource in %s:%d 18 | Stack trace: 19 | #0 %s: oci_bind_array_by_name(%s) 20 | #1 {main} 21 | thrown in %s on line %d -------------------------------------------------------------------------------- /tests/testping.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Exercise OCIPing functionality on reconnect (code coverage test) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.ping_interval=0 11 | --FILE-- 12 | 28 | --EXPECT-- 29 | Done 30 | -------------------------------------------------------------------------------- /tests/exec_fetch.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | fetch after failed oci_execute() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 22 | --EXPECTF-- 23 | Warning: oci_execute(): ORA-00942: %s in %s on line %d 24 | bool(false) 25 | 26 | Warning: oci_fetch_array(): ORA-24374: %s in %s on line %d 27 | bool(false) 28 | Done 29 | -------------------------------------------------------------------------------- /tests/serverversion.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_server_version() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 27 | --EXPECTF-- 28 | resource(%d) of type (oci8 connection) 29 | string(%d) "Oracle %s" 30 | Done 31 | -------------------------------------------------------------------------------- /tests/b47243_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #47243 (Crash on exit with ZTS mode) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 25 | ===DONE=== 26 | --EXPECT-- 27 | ===DONE=== 28 | -------------------------------------------------------------------------------- /tests/old_oci_close.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci8.old_oci_close_semantics On 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=1 11 | --FILE-- 12 | 23 | --EXPECTF-- 24 | Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s 25 | resource(%d) of type (oci8 connection) 26 | NULL 27 | resource(%d) of type (oci8 statement) 28 | Done 29 | -------------------------------------------------------------------------------- /tests/b47243_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #47243 (Crash on exit with ZTS mode) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 26 | ===DONE=== 27 | --EXPECT-- 28 | ===DONE=== 29 | -------------------------------------------------------------------------------- /tests/error1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_error() when oci_connect() fails 3 | --EXTENSIONS-- 4 | oci8 5 | --FILE-- 6 | 16 | --EXPECTF-- 17 | Warning: oci_connect(): ORA-12154: %s in %s on line %d 18 | bool(false) 19 | array(4) { 20 | ["code"]=> 21 | int(12154) 22 | ["message"]=> 23 | string(%d) "ORA-12154: %s" 24 | ["offset"]=> 25 | int(0) 26 | ["sqltext"]=> 27 | string(0) "" 28 | } 29 | Done 30 | -------------------------------------------------------------------------------- /tests/skipifconnectfailure.inc: -------------------------------------------------------------------------------- 1 | "; 19 | } 20 | else { 21 | $msg .= "\"$dbase\""; 22 | } 23 | $msg .= " as user \"$user\""; 24 | $e = oci_error(); 25 | $msg .= ": {$e['message']}"; 26 | die($msg); 27 | } 28 | 29 | ?> 30 | -------------------------------------------------------------------------------- /tests/b47243_3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #47243 (Crash on exit with ZTS mode) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 27 | ===DONE=== 28 | --EXPECT-- 29 | ===DONE=== 30 | -------------------------------------------------------------------------------- /tests/array_bind_012.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 26 | --EXPECTF-- 27 | Warning: oci_bind_array_by_name(): Invalid max length value (-10) in %s on line %d 28 | array(0) { 29 | } 30 | Done 31 | -------------------------------------------------------------------------------- /tests/old_oci_close1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci8.old_oci_close_semantics Off 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=0 11 | --FILE-- 12 | getMessage()); 23 | } 24 | 25 | echo "Done\n"; 26 | 27 | ?> 28 | --EXPECTF-- 29 | resource(%d) of type (oci8 connection) 30 | bool(true) 31 | string(%d) "oci_parse(): supplied resource is not a valid oci8 connection resource" 32 | Done 33 | -------------------------------------------------------------------------------- /tests/bug36096.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #36096 (oci_result() returns garbage after oci_fetch() failed) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 1"; 15 | $stmt = oci_parse($c, $sql); 16 | 17 | if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){ 18 | var_dump(oci_fetch($stmt)); 19 | var_dump(oci_result($stmt, 1)); 20 | var_dump(oci_field_name($stmt, 1)); 21 | var_dump(oci_field_type($stmt, 1)); 22 | } 23 | 24 | echo "Done\n"; 25 | 26 | ?> 27 | --EXPECTF-- 28 | bool(false) 29 | bool(false) 30 | string(%r[53]%r) "%r('ABC'|EXP)%r" 31 | string(4) "CHAR" 32 | Done 33 | -------------------------------------------------------------------------------- /tests/privileged_connect1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | privileged connect tests 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 10 | --INI-- 11 | oci8.privileged_connect=1 12 | --FILE-- 13 | 23 | --EXPECTF-- 24 | Warning: oci_connect(): ORA-%d: %s in %s on line %d 25 | 26 | Warning: oci_connect(): ORA-%d: %s in %s on line %d 27 | 28 | Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d 29 | Done 30 | -------------------------------------------------------------------------------- /tests/array_bind_uin.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Unsupported type: oci_bind_array_by_name() and SQLT_UIN 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 22 | --EXPECTF-- 23 | Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: 68 in %sarray_bind_uin.php on line %d 24 | Done 25 | -------------------------------------------------------------------------------- /tests/coll_004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_collection_assign() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append(1)); 21 | 22 | var_dump($coll2->assign($coll1)); 23 | 24 | var_dump($coll2->getElem(0)); 25 | 26 | echo "Done\n"; 27 | 28 | require __DIR__."/drop_type.inc"; 29 | 30 | ?> 31 | --EXPECT-- 32 | bool(true) 33 | bool(true) 34 | float(1) 35 | Done 36 | -------------------------------------------------------------------------------- /tests/error2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Exercise error code for SUCCESS_WITH_INFO 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 11 | ?> 12 | --FILE-- 13 | 29 | --EXPECTF-- 30 | ORA-24344: %s 31 | Done 32 | -------------------------------------------------------------------------------- /tests/bug36010.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #36010 (Crash when executing SQL statement with lob parameter twice) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 31 | --EXPECT-- 32 | Done 33 | -------------------------------------------------------------------------------- /tests/bug38161.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #38161 (oci_bind_by_name() returns garbage when Oracle didn't set the variable) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 31 | --EXPECT-- 32 | NULL 33 | int(0) 34 | Done 35 | -------------------------------------------------------------------------------- /tests/coll_004_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_collection_assign() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 31 | --EXPECT-- 32 | bool(true) 33 | bool(true) 34 | float(1) 35 | Done 36 | -------------------------------------------------------------------------------- /tests/privileged_connect.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | privileged connect tests 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 20 | --EXPECTF-- 21 | Warning: oci_connect(): Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA in %s on line %d 22 | 23 | Warning: oci_connect(): Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA in %s on line %d 24 | 25 | Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d 26 | Done 27 | -------------------------------------------------------------------------------- /tests/coll_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_new_collection() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 25 | --EXPECTF-- 26 | object(OCICollection)#%d (1) { 27 | ["collection"]=> 28 | resource(%d) of type (oci8 collection) 29 | } 30 | 31 | Warning: oci_new_collection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d 32 | bool(false) 33 | Done 34 | -------------------------------------------------------------------------------- /tests/pecl_bug6109.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PECL Bug #6109 (Error messages not kept) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | '.$err['message'] ."\n"; 27 | } 28 | } 29 | 30 | // Cleanup 31 | 32 | oci_close($c); 33 | 34 | echo "Done\n"; 35 | 36 | ?> 37 | --EXPECTF-- 38 | Test 1 39 | 0 -> ORA-00942: %s 40 | 1 -> ORA-00942: %s 41 | 2 -> ORA-00942: %s 42 | 3 -> ORA-00942: %s 43 | 4 -> ORA-00942: %s 44 | Done 45 | -------------------------------------------------------------------------------- /tests/connect_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_pconnect() & oci_new_connect() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 34 | --EXPECTF-- 35 | resource(%d) of type (oci8 persistent connection) 36 | resource(%d) of type (oci8 connection) 37 | bool(true) 38 | bool(true) 39 | Done 40 | -------------------------------------------------------------------------------- /tests/drcp_connection_class.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci8.connection_class with ini_get() and ini_set() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | = 11)) { 9 | die("skip works only with Oracle 11g or greater version of Oracle client libraries"); 10 | } 11 | ?> 12 | --INI-- 13 | oci8.connection_class=test 14 | --FILE-- 15 | 28 | --EXPECT-- 29 | Setting a new connection class now 30 | The New oci8.connection_class is New cc 31 | Done 32 | -------------------------------------------------------------------------------- /tests/array_bind_bfloat.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Unsupported type: oci_bind_array_by_name() and SQLT_BFLOAT 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (!defined('SQLT_BFLOAT')) die('skip SQLT_BFLOAT type not available on older Oracle clients'); 11 | ?> 12 | --FILE-- 13 | 23 | --EXPECTF-- 24 | Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: 21 in %sarray_bind_bfloat.php on line %d 25 | Done 26 | -------------------------------------------------------------------------------- /tests/lob_temp1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | closing temporary lobs 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | writeTemporary("test")); 18 | var_dump($blob->load()); 19 | var_dump($blob->close()); 20 | 21 | $c = oci_pconnect($user, $password, $dbase); 22 | 23 | $blob = oci_new_descriptor($c,OCI_D_LOB); 24 | var_dump($blob->writeTemporary("test")); 25 | var_dump($blob->load()); 26 | var_dump($blob->close()); 27 | 28 | echo "Done\n"; 29 | 30 | ?> 31 | --EXPECT-- 32 | bool(true) 33 | string(4) "test" 34 | bool(true) 35 | bool(true) 36 | string(4) "test" 37 | bool(true) 38 | Done 39 | -------------------------------------------------------------------------------- /tests/array_bind_bdouble.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Unsupported type: oci_bind_array_by_name() and SQLT_BDOUBLE 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (!defined('SQLT_BDOUBLE')) die('skip SQLT_BDOUBLE type not available on older Oracle clients'); 11 | ?> 12 | --FILE-- 13 | 23 | --EXPECTF-- 24 | Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: 22 in %sarray_bind_bdouble.php on line %d 25 | Done 26 | -------------------------------------------------------------------------------- /tests/pecl_bug16035.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PECL Bug #16035 (Crash with Oracle 10.2 connecting with a character set but ORACLE_HOME is not set) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 15 | --ENV-- 16 | ORACLE_HOME="" 17 | --FILE-- 18 | 23 | --EXPECTF-- 24 | Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d 25 | 26 | Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804 27 | in %specl_bug16035.php on line %d 28 | -------------------------------------------------------------------------------- /tests/array_bind_010.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_bind_array_by_name() and invalid values 8 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 26 | --EXPECTF-- 27 | Warning: oci_bind_array_by_name(): ORA-01036: %r(illegal variable name\/number|unrecognized bind variable :c1 passed to the bind call)%r in %s on line %d 28 | array(5) { 29 | [0]=> 30 | string(1) "1" 31 | [1]=> 32 | string(1) "2" 33 | [2]=> 34 | string(1) "3" 35 | [3]=> 36 | string(1) "4" 37 | [4]=> 38 | string(1) "5" 39 | } 40 | Done 41 | -------------------------------------------------------------------------------- /tests/persistent.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | reusing persistent connections 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 23 | --EXPECTF-- 24 | resource(%d) of type (oci8 persistent connection) 25 | resource(%d) of type (oci8 persistent connection) 26 | resource(%d) of type (oci8 persistent connection) 27 | resource(%d) of type (oci8 connection) 28 | resource(%d) of type (oci8 connection) 29 | resource(%d) of type (oci8 connection) 30 | Done 31 | -------------------------------------------------------------------------------- /tests/bind_unsupported_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bind with various unsupported 10g+ bind types 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | SQLT_BDOUBLE, 16 | "SQLT_BFLOAT" => SQLT_BFLOAT, 17 | ); 18 | 19 | foreach ($types as $t => $v) { 20 | 21 | echo "Test - $t\n"; 22 | 23 | $s = oci_parse($c, "select * from dual where dummy = :c1"); 24 | $c1 = "Doug"; 25 | oci_bind_by_name($s, ":c1", $c1, -1, $v); 26 | } 27 | 28 | ?> 29 | --EXPECTF-- 30 | Test - SQLT_BDOUBLE 31 | 32 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 22 in %sbind_unsupported_2.php on line %d 33 | Test - SQLT_BFLOAT 34 | 35 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 21 in %sbind_unsupported_2.php on line %d 36 | -------------------------------------------------------------------------------- /tests/coll_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collection methods 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | size()); 20 | var_dump($coll1->max()); 21 | var_dump($coll1->trim(3)); 22 | var_dump($coll1->append(1)); 23 | var_dump($coll1->getElem(0)); 24 | var_dump($coll1->assignElem(0,2)); 25 | 26 | echo "Done\n"; 27 | 28 | require __DIR__."/drop_type.inc"; 29 | 30 | ?> 31 | --EXPECTF-- 32 | int(0) 33 | int(0) 34 | 35 | Warning: OCICollection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d 36 | bool(false) 37 | bool(true) 38 | float(1) 39 | bool(true) 40 | Done 41 | -------------------------------------------------------------------------------- /tests/statement_cache.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | statement cache 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => true); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 30 | --EXPECTF-- 31 | array(2) { 32 | [0]=> 33 | string(1) "4" 34 | ["%r(1\+3|EXP)%r"]=> 35 | string(1) "4" 36 | } 37 | array(2) { 38 | [0]=> 39 | string(1) "4" 40 | ["%r(1\+3|EXP)%r"]=> 41 | string(1) "4" 42 | } 43 | Done 44 | -------------------------------------------------------------------------------- /tests/coll_002_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_new_collection() + free() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | getMessage()); 25 | } 26 | 27 | echo "Done\n"; 28 | 29 | require __DIR__."/drop_type.inc"; 30 | 31 | ?> 32 | --EXPECTF-- 33 | object(OCICollection)#%d (1) { 34 | ["collection"]=> 35 | resource(%d) of type (oci8 collection) 36 | } 37 | bool(true) 38 | string(%d) "oci_collection_size(): supplied resource is not a valid oci8 collection resource" 39 | Done 40 | -------------------------------------------------------------------------------- /tests/lob_temp.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | temporary lobs 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | writeTemporary("test")); 18 | var_dump($blob->load()); 19 | var_dump($blob->seek(0, SEEK_SET)); 20 | var_dump($blob->read(2)); 21 | 22 | $c = oci_pconnect($user, $password, $dbase); 23 | 24 | $blob = oci_new_descriptor($c,OCI_D_LOB); 25 | var_dump($blob->writeTemporary("test")); 26 | var_dump($blob->load()); 27 | var_dump($blob->seek(0, SEEK_SET)); 28 | var_dump($blob->read(2)); 29 | 30 | echo "Done\n"; 31 | 32 | ?> 33 | --EXPECT-- 34 | bool(true) 35 | string(4) "test" 36 | bool(true) 37 | string(2) "te" 38 | bool(true) 39 | string(4) "test" 40 | bool(true) 41 | string(2) "te" 42 | Done 43 | -------------------------------------------------------------------------------- /tests/coll_015.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and numbers (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append(1)); 32 | var_dump($coll1->assignElem(0,2345)); 33 | var_dump($coll1->getElem(0)); 34 | 35 | echo "Done\n"; 36 | 37 | require __DIR__."/drop_type.inc"; 38 | 39 | ?> 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | float(2345) 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_017.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and nulls (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append("string")); 32 | var_dump($coll1->assignElem(0, null)); 33 | var_dump($coll1->getElem(0)); 34 | 35 | echo "Done\n"; 36 | 37 | require __DIR__."/drop_type.inc"; 38 | 39 | ?> 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | NULL 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_014.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and strings (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append("striing")); 32 | var_dump($coll1->assignElem(0,"blah")); 33 | var_dump($coll1->getElem(0)); 34 | 35 | echo "Done\n"; 36 | 37 | require __DIR__."/drop_type.inc"; 38 | 39 | ?> 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | string(4) "blah" 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_013.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and correct dates (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append("28-JUL-05")); 32 | var_dump($coll1->assignElem(0,"01-JAN-05")); 33 | var_dump($coll1->getElem(0)); 34 | 35 | echo "Done\n"; 36 | 37 | require __DIR__."/drop_type.inc"; 38 | 39 | ?> 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | string(9) "01-JAN-05" 44 | Done 45 | -------------------------------------------------------------------------------- /tests/define.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_define_by_name() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 50 | --EXPECTF-- 51 | string(%d) "some" 52 | Done 53 | -------------------------------------------------------------------------------- /tests/lob_temp2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Writing temporary lob before binding 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | writeTemporary("test")); 21 | 22 | $statement = oci_parse($c, $ora_sql); 23 | oci_bind_by_name($statement, ":v_clob", $clob, -1, OCI_B_CLOB); 24 | oci_execute($statement, OCI_DEFAULT); 25 | 26 | $s = oci_parse($c, "select clob from ". $schema.$table_name); 27 | oci_execute($s); 28 | oci_fetch_all($s, $res); 29 | var_dump($res); 30 | 31 | ?> 32 | --EXPECT-- 33 | bool(true) 34 | array(1) { 35 | ["CLOB"]=> 36 | array(1) { 37 | [0]=> 38 | string(4) "test" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/null_byte_3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Null bytes in SQL statements 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | display_errors = On 11 | error_reporting = E_WARNING 12 | --FILE-- 13 | 34 | --EXPECTF-- 35 | Test 1: Invalid use of a null byte 36 | 37 | Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d 38 | Test 2: Using a null byte in a bind variable value causing WHERE clause to fail 39 | array(1) { 40 | ["DUMMY"]=> 41 | array(0) { 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/bug26133.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #26133 (ocifreedesc() segfault) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | free(); 35 | 36 | // Cleanup 37 | 38 | $stmtarray = array( 39 | "drop table bug26133_tab" 40 | ); 41 | 42 | oci8_test_sql_execute($c, $stmtarray); 43 | 44 | echo "Done\n"; 45 | ?> 46 | --EXPECT-- 47 | Done 48 | -------------------------------------------------------------------------------- /tests/coll_003_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collection methods 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 31 | --EXPECTF-- 32 | int(0) 33 | int(0) 34 | 35 | Warning: oci_collection_trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d 36 | bool(false) 37 | bool(true) 38 | float(1) 39 | bool(true) 40 | Done 41 | -------------------------------------------------------------------------------- /tests/coll_010.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and nulls 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append(null)); 33 | 34 | var_dump($coll2->assign($coll1)); 35 | 36 | var_dump($coll2->getElem(0)); 37 | 38 | echo "Done\n"; 39 | 40 | require __DIR__."/drop_type.inc"; 41 | 42 | ?> 43 | --EXPECT-- 44 | bool(true) 45 | bool(true) 46 | NULL 47 | Done 48 | -------------------------------------------------------------------------------- /tests/coll_015_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and numbers (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | float(2345) 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_017_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and nulls (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | NULL 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_012.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and correct dates 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append("28-JUL-05")); 33 | 34 | var_dump($coll2->assign($coll1)); 35 | 36 | var_dump($coll2->getElem(0)); 37 | 38 | echo "Done\n"; 39 | 40 | require __DIR__."/drop_type.inc"; 41 | 42 | ?> 43 | --EXPECT-- 44 | bool(true) 45 | bool(true) 46 | string(9) "28-JUL-05" 47 | Done 48 | -------------------------------------------------------------------------------- /tests/coll_014_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and strings (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | string(4) "blah" 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_013_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and correct dates (2) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 40 | --EXPECT-- 41 | bool(true) 42 | bool(true) 43 | string(9) "01-JAN-05" 44 | Done 45 | -------------------------------------------------------------------------------- /tests/coll_010_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and nulls 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 43 | --EXPECT-- 44 | bool(true) 45 | bool(true) 46 | NULL 47 | Done 48 | -------------------------------------------------------------------------------- /tests/error.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_error() error message for parsing error 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 30 | --EXPECTF-- 31 | resource(%s) of type (oci8 connection) 32 | resource(%s) of type (oci8 statement) 33 | 34 | Warning: oci_execute(): ORA-00900: %s in %s on line %d 35 | bool(false) 36 | array(4) { 37 | ["code"]=> 38 | int(900) 39 | ["message"]=> 40 | string(%d) "ORA-00900: %s" 41 | ["offset"]=> 42 | int(0) 43 | ["sqltext"]=> 44 | string(12) "WRONG SYNTAX" 45 | } 46 | Done 47 | -------------------------------------------------------------------------------- /tests/coll_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_new_collection() + free() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | free()); 19 | 20 | try { 21 | var_dump($coll1->size()); 22 | } catch (TypeError $error) { 23 | var_dump($error->getMessage()); 24 | } 25 | 26 | var_dump(oci_new_collection($c, "NONEXISTENT")); 27 | 28 | echo "Done\n"; 29 | 30 | require __DIR__."/drop_type.inc"; 31 | 32 | ?> 33 | --EXPECTF-- 34 | object(OCICollection)#%d (1) { 35 | ["collection"]=> 36 | resource(%d) of type (oci8 collection) 37 | } 38 | bool(true) 39 | string(%d) "OCICollection::size(): supplied resource is not a valid oci8 collection resource" 40 | 41 | Warning: oci_new_collection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d 42 | bool(false) 43 | Done 44 | -------------------------------------------------------------------------------- /tests/coll_011.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and strings 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append("string")); 33 | var_dump($coll1->append("string")); 34 | 35 | var_dump($coll2->assign($coll1)); 36 | 37 | var_dump($coll2->getElem(0)); 38 | 39 | echo "Done\n"; 40 | 41 | require __DIR__."/drop_type.inc"; 42 | 43 | ?> 44 | --EXPECT-- 45 | bool(true) 46 | bool(true) 47 | bool(true) 48 | string(6) "string" 49 | Done 50 | -------------------------------------------------------------------------------- /tests/coll_012_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and correct dates 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 43 | --EXPECT-- 44 | bool(true) 45 | bool(true) 46 | string(9) "28-JUL-05" 47 | Done 48 | -------------------------------------------------------------------------------- /tests/lob_032.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_write() and friends 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write() to fail 30 | $clob->write("data"); 31 | 32 | require __DIR__.'/drop_table.inc'; 33 | 34 | echo "Done\n"; 35 | 36 | ?> 37 | --EXPECTF-- 38 | Warning: OCILob::write(): ORA-22990: %s in %s on line 19 39 | Done 40 | -------------------------------------------------------------------------------- /tests/drcp_newconnect.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_new_connect() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.connection_class=test 11 | oci8.old_oci_close_semantics=0 12 | --FILE-- 13 | 42 | --EXPECTF-- 43 | resource(%d) of type (oci8 connection) 44 | resource(%d) of type (oci8 connection) 45 | First and second connections are different OK 46 | Done 47 | -------------------------------------------------------------------------------- /tests/gh-4.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug GH-4 (Memory leak with long query/CLOB) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | load(); 23 | if ($res !== $expectedStr) { 24 | var_dump([$expectedStr, $res]); 25 | throw new \Exception('unexpected result'); 26 | } 27 | 28 | $memUsages[$k] = memory_get_usage(); 29 | } 30 | 31 | $memUsages = array_slice($memUsages, 1, null, true); 32 | $memUsages = array_unique($memUsages); 33 | 34 | if (count($memUsages) !== 1) { 35 | var_dump($memUsages); 36 | throw new \Exception('memory leak detected'); 37 | } 38 | 39 | echo "ok\n"; 40 | 41 | ?> 42 | --EXPECTF-- 43 | ok 44 | -------------------------------------------------------------------------------- /tests/lob_036.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Exercise cleanup code when LOB buffering is on 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("test")); 32 | var_dump($blob->setBuffering(true)); 33 | var_dump($blob->write("test")); 34 | 35 | $blob = null; 36 | 37 | require __DIR__.'/drop_table.inc'; 38 | 39 | echo "Done\n"; 40 | 41 | ?> 42 | --EXPECT-- 43 | int(4) 44 | bool(true) 45 | int(4) 46 | Done 47 | -------------------------------------------------------------------------------- /tests/coll_009.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and wrong dates 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append("2005-07-28")); 33 | 34 | var_dump($coll2->assign($coll1)); 35 | 36 | var_dump($coll2->getElem(0)); 37 | 38 | echo "Done\n"; 39 | 40 | require __DIR__."/drop_type.inc"; 41 | 42 | ?> 43 | --EXPECTF-- 44 | Warning: OCICollection::append(): OCI-01861: literal does not match format string in %s on line %d 45 | bool(false) 46 | bool(true) 47 | bool(false) 48 | Done 49 | -------------------------------------------------------------------------------- /tests/null_byte_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Protect against null bytes in LOB filenames 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 11 | --INI-- 12 | display_errors = On 13 | --FILE-- 14 | saveFile("/tmp/abc\0def"); 28 | } catch (ValueError $e) { 29 | echo $e->getMessage(), "\n"; 30 | } 31 | 32 | echo "Test 2: Export\n"; 33 | 34 | try { 35 | $lob->export("/tmp/abc\0def"); 36 | } catch (ValueError $e) { 37 | echo $e->getMessage(), "\n"; 38 | } 39 | 40 | ?> 41 | --EXPECT-- 42 | Test 1: Import 43 | OCILob::saveFile(): Argument #1 ($filename) must not contain any null bytes 44 | Test 2: Export 45 | OCILob::export(): Argument #1 ($filename) must not contain any null bytes 46 | -------------------------------------------------------------------------------- /tests/lob_033.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | various oci_lob_write() error messages 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | save(""); 28 | 29 | oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); 30 | oci_execute($statement, OCI_DEFAULT); 31 | 32 | var_dump($blob->save("")); 33 | var_dump($blob->save("data", 100)); 34 | 35 | require __DIR__.'/drop_table.inc'; 36 | 37 | echo "Done\n"; 38 | 39 | ?> 40 | --EXPECTF-- 41 | Warning: OCILob::save(): OCI_INVALID_HANDLE in %s on line %d 42 | bool(true) 43 | bool(true) 44 | Done 45 | -------------------------------------------------------------------------------- /tests/gh-4-return-lob.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug GH-4 (Memory leak with long query/CLOB) with OCI_RETURN_LOBS 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 42 | --EXPECTF-- 43 | ok 44 | -------------------------------------------------------------------------------- /tests/coll_011_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and strings 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 44 | --EXPECT-- 45 | bool(true) 46 | bool(true) 47 | bool(true) 48 | string(6) "string" 49 | Done 50 | -------------------------------------------------------------------------------- /tests/connect_without_oracle_home.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 19 | --ENV-- 20 | ORACLE_HOME="" 21 | --FILE-- 22 | 34 | --EXPECTF-- 35 | Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d 36 | bool(false) 37 | -------------------------------------------------------------------------------- /tests/bind_sqltchr_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PL/SQL bind with SQLT_CHR 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 48 | --EXPECT-- 49 | Test 1 - PL/SQL IN and OUT variables 50 | string(22) "Cat got your keyboard?" 51 | string(22) "CAT GOT YOUR KEYBOARD?" 52 | -------------------------------------------------------------------------------- /tests/bug35973.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | read(5)); 32 | var_dump($d->read(4)); 33 | 34 | $s1 = oci_parse($c, "drop table test_nclob"); 35 | @oci_execute($s1); 36 | 37 | echo "Done\n"; 38 | ?> 39 | --EXPECTF-- 40 | array(1) { 41 | ["NC"]=> 42 | object(OCILob)#%d (1) { 43 | ["descriptor"]=> 44 | resource(%d) of type (oci8 descriptor) 45 | } 46 | } 47 | string(%d) "%s5" 48 | string(%d) "%sa" 49 | Done 50 | -------------------------------------------------------------------------------- /tests/coll_009_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and wrong dates 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 43 | --EXPECTF-- 44 | Warning: oci_collection_append(): OCI-01861: literal does not match format string in %s on line %d 45 | bool(false) 46 | bool(true) 47 | bool(false) 48 | Done 49 | -------------------------------------------------------------------------------- /tests/bind_long_raw.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | bind LONG RAW field 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 41 | --EXPECT-- 42 | string(32) "614fcbba1effb7caa27ef0ef25c27fcf" 43 | int(2523) 44 | Done 45 | -------------------------------------------------------------------------------- /tests/bug32325.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #32325 (Cannot retrieve collection using OCI8) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | size()); 38 | var_dump($collection->getelem(1)); 39 | var_dump($collection->getelem(2)); 40 | 41 | // Cleanup 42 | 43 | $stmtarray = array( 44 | "drop type bug32325_t" 45 | ); 46 | 47 | oci8_test_sql_execute($c, $stmtarray); 48 | 49 | echo "Done\n"; 50 | ?> 51 | --EXPECT-- 52 | int(4) 53 | float(2) 54 | float(3) 55 | Done 56 | -------------------------------------------------------------------------------- /tests/null_byte_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Null bytes in SQL statements 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --INI-- 12 | display_errors = On 13 | error_reporting = E_WARNING 14 | --FILE-- 15 | 37 | --EXPECTF-- 38 | Test 1: Valid use of a null byte 39 | array(1) { 40 | ["DUMMY"]=> 41 | array(1) { 42 | [0]=> 43 | string(1) "X" 44 | } 45 | } 46 | Test 3: Using a null byte in a bind variable name 47 | 48 | Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d 49 | 50 | Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d 51 | -------------------------------------------------------------------------------- /tests/prefetch.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_set_prefetch() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 53 | --EXPECT-- 54 | bool(true) 55 | bool(true) 56 | int(1) 57 | Done 58 | -------------------------------------------------------------------------------- /tests/statement_type.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_statement_type() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 38 | --EXPECT-- 39 | string(6) "SELECT" 40 | string(6) "DELETE" 41 | string(6) "INSERT" 42 | string(6) "UPDATE" 43 | string(4) "DROP" 44 | string(6) "CREATE" 45 | string(6) "CREATE" 46 | string(5) "ALTER" 47 | string(5) "BEGIN" 48 | string(7) "DECLARE" 49 | string(4) "CALL" 50 | string(7) "UNKNOWN" 51 | string(7) "UNKNOWN" 52 | Done 53 | -------------------------------------------------------------------------------- /tests/bug44113.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #44113 (New collection creation can fail with OCI-22303) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 11 | ?> 12 | --FILE-- 13 | 49 | --EXPECT-- 50 | Completed 70000 51 | Done 52 | -------------------------------------------------------------------------------- /tests/connect_with_charset_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_connect() with invalid character set 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 28 | --EXPECTF-- 29 | resource(%d) of type (oci8 connection) 30 | resource(%d) of type (oci8 connection) 31 | 32 | Warning: oci_connect(): Invalid character set name: blah in %s on line %d 33 | resource(%d) of type (oci8 connection) 34 | 35 | Warning: oci_connect(): Invalid character set name: obviously wrong in %s on line %d 36 | resource(%d) of type (oci8 connection) 37 | bool(true) 38 | resource(%d) of type (oci8 connection) 39 | resource(%d) of type (oci8 connection) 40 | bool(false) 41 | Done 42 | -------------------------------------------------------------------------------- /tests/bind_raw.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | bind RAW field 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 42 | --EXPECT-- 43 | string(32) "88b274d7a257ac6f70435b83abd4e26e" 44 | int(300) 45 | Done 46 | -------------------------------------------------------------------------------- /tests/bug36403.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 0; $i--) { 30 | echo oci_field_name($s, $i) . "\n"; 31 | } 32 | 33 | echo "Test 2\n"; 34 | 35 | // Should generate an error: ORA-24338: statement handle not executed 36 | // since the statement handle was only described and not executed 37 | $row = oci_fetch_array($s); 38 | 39 | // Clean up 40 | 41 | $stmtarray = array( 42 | "drop table bug36403_tab" 43 | ); 44 | 45 | oci8_test_sql_execute($c, $stmtarray); 46 | 47 | ?> 48 | --EXPECTF-- 49 | Test 1 50 | COL4 51 | COLUMN3 52 | COL2 53 | C1 54 | Test 2 55 | 56 | Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d 57 | -------------------------------------------------------------------------------- /tests/bug44008.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #44008 (Incorrect usage of OCILob->close crashes PHP) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | load(); 33 | echo "$r\n"; 34 | 35 | // Incorrectly closing the lob doesn't cause a crash. 36 | // OCI-LOB->close() is documented for use only with OCILob->writeTemporary() 37 | $textLob->close(); 38 | 39 | // Cleanup 40 | 41 | $stmtarray = array( 42 | "drop procedure bug44008_proc" 43 | ); 44 | 45 | oci8_test_sql_execute($c, $stmtarray); 46 | 47 | echo "Done\n"; 48 | 49 | ?> 50 | --EXPECT-- 51 | A 52 | Done 53 | -------------------------------------------------------------------------------- /tests/bind_raw_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | bind RAW field with OCI_B_BIN 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 42 | --EXPECT-- 43 | string(32) "88b274d7a257ac6f70435b83abd4e26e" 44 | int(300) 45 | Done 46 | -------------------------------------------------------------------------------- /tests/bug68298.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #68298 (OCI int overflow) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 10 | --FILE-- 11 | 41 | --EXPECT-- 42 | array(1) { 43 | ["COL1"]=> 44 | array(2) { 45 | [0]=> 46 | string(19) "1152921504606846975" 47 | [1]=> 48 | string(20) "-1152921504606846975" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/bug44206.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 47 | --EXPECT-- 48 | Completed 400 49 | Done 50 | -------------------------------------------------------------------------------- /tests/default_prefetch0.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci8.default_prefetch ini option 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.default_prefetch=20 11 | --FILE-- 12 | 54 | --EXPECT-- 55 | bool(true) 56 | int(1) 57 | Done 58 | -------------------------------------------------------------------------------- /tests/default_prefetch1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci8.default_prefetch ini option 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.default_prefetch=100 11 | --FILE-- 12 | 54 | --EXPECT-- 55 | bool(true) 56 | int(1) 57 | Done 58 | -------------------------------------------------------------------------------- /tests/define0.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_define_by_name() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 58 | --EXPECTF-- 59 | Test 1 60 | string(%d) "some" 61 | Test 2 62 | string(%d) "some" 63 | -------------------------------------------------------------------------------- /tests/fetch.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | ocifetch() & ociresult() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 53 | --EXPECT-- 54 | string(1) "1" 55 | string(1) "1" 56 | string(1) "1" 57 | string(1) "1" 58 | string(1) "1" 59 | string(1) "1" 60 | Done 61 | -------------------------------------------------------------------------------- /tests/bug47189.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #47189 (Multiple oci_fetch_all calls) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs: different error handling for this undefined behavior 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 35 | --EXPECTF-- 36 | Test 1 37 | array(1) { 38 | [0]=> 39 | array(1) { 40 | ["DUMMY"]=> 41 | string(1) "X" 42 | } 43 | } 44 | array(0) { 45 | } 46 | Test 2 47 | array(1) { 48 | [0]=> 49 | array(1) { 50 | ["DUMMY"]=> 51 | string(1) "X" 52 | } 53 | } 54 | 55 | Warning: oci_fetch_all(): ORA-01002: %s in %s on line %d 56 | array(0) { 57 | } 58 | -------------------------------------------------------------------------------- /tests/drcp_conn_close2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_connect() with oci_close() and oci8.old_oci_close_semantics OFF 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=0 11 | oci8.connection_class=test 12 | --FILE-- 13 | 45 | --EXPECTF-- 46 | This is with a OCI_CONNECT 47 | resource(%d) of type (oci8 connection) 48 | resource(%d) of type (oci8 connection) 49 | Both connections are different : OK 50 | Done 51 | -------------------------------------------------------------------------------- /tests/extauth_04.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test External Authentication errors on Windows 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.privileged_connect=1 11 | --FILE-- 12 | 42 | --EXPECTF-- 43 | Test 1 44 | 45 | Warning: oci_connect(): External Authentication is not supported on Windows in %s on line %d 46 | bool(false) 47 | bool(false) 48 | Test 2 49 | 50 | Warning: oci_new_connect(): External Authentication is not supported on Windows in %s on line %d 51 | bool(false) 52 | bool(false) 53 | Test 3 54 | 55 | Warning: oci_pconnect(): External Authentication is not supported on Windows in %s on line %d 56 | bool(false) 57 | bool(false) 58 | -------------------------------------------------------------------------------- /tests/drcp_conn_close1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_connect() with oci_close() and oci8.old_oci_close_semantics ON 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=1 11 | oci8.connection_class=test 12 | --FILE-- 13 | 44 | --EXPECTF-- 45 | Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s 46 | This is with a OCI_CONNECT 47 | resource(%d) of type (oci8 connection) 48 | resource(%d) of type (oci8 connection) 49 | Both connections share a resource : OK 50 | Done 51 | -------------------------------------------------------------------------------- /tests/define1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_define_by_name() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | getMessage(), "\n"; 37 | } 38 | 39 | oci_execute($stmt); 40 | 41 | while (oci_fetch($stmt)) { 42 | var_dump($string); 43 | } 44 | 45 | // Cleanup 46 | 47 | $stmtarray = array( 48 | "drop table define1_tab" 49 | ); 50 | 51 | oci8_test_sql_execute($c, $stmtarray); 52 | 53 | echo "Done\n"; 54 | 55 | ?> 56 | --EXPECT-- 57 | bool(true) 58 | bool(false) 59 | oci_define_by_name(): Argument #2 ($column) cannot be empty 60 | string(4) "some" 61 | Done 62 | -------------------------------------------------------------------------------- /tests/bind_unsupported_3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bind with various bind types not supported by TimesTen 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | false, 'timesten' => true); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | SQLT_CLOB, 18 | "SQLT_BLOB" => SQLT_BLOB, 19 | "OCI_B_CLOB" => OCI_B_CLOB, 20 | "OCI_B_BLOB" => OCI_B_BLOB, 21 | ); 22 | 23 | foreach ($types as $t => $v) { 24 | 25 | echo "Test - $t\n"; 26 | 27 | $s = oci_parse($c, "select * from dual where dummy = :c1"); 28 | $c1 = "Doug"; 29 | oci_bind_by_name($s, ":c1", $c1, -1, $v); 30 | } 31 | 32 | ?> 33 | --EXPECTF-- 34 | Test - SQLT_CLOB 35 | 36 | Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d 37 | Test - SQLT_BLOB 38 | 39 | Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d 40 | Test - OCI_B_CLOB 41 | 42 | Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d 43 | Test - OCI_B_BLOB 44 | 45 | Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d 46 | -------------------------------------------------------------------------------- /tests/default_prefetch2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci8.default_prefetch ini option 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.default_prefetch=100 11 | --FILE-- 12 | 55 | --EXPECT-- 56 | bool(true) 57 | bool(true) 58 | int(1) 59 | Done 60 | -------------------------------------------------------------------------------- /tests/drcp_pconn_close1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_pconnect() with oci_close() and oci8.old_oci_close_semantics ON 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=1 11 | oci8.connection_class=test 12 | --FILE-- 13 | 43 | --EXPECTF-- 44 | Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s 45 | This is with a OCI_PCONNECT 46 | resource(%d) of type (oci8 persistent connection) 47 | resource(%d) of type (oci8 persistent connection) 48 | Both connections share a resource : OK 49 | Done 50 | -------------------------------------------------------------------------------- /tests/lob_010.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_save() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | save("string")); 30 | var_dump($blob->save("string", 3)); 31 | oci_commit($c); 32 | 33 | $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 34 | $s = oci_parse($c, $select_sql); 35 | oci_execute($s, OCI_DEFAULT); 36 | 37 | $row = oci_fetch_array($s); 38 | 39 | while (!$row[0]->eof()) { 40 | var_dump($row[0]->read(1024)); 41 | } 42 | 43 | require __DIR__.'/drop_table.inc'; 44 | 45 | echo "Done\n"; 46 | 47 | ?> 48 | --EXPECT-- 49 | bool(true) 50 | bool(true) 51 | string(9) "strstring" 52 | Done 53 | -------------------------------------------------------------------------------- /tests/drcp_pconn_close2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_pconnect() with oci_close() and oci8.old_oci_close_semantics OFF 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=0 11 | oci8.connection_class=test 12 | --FILE-- 13 | 45 | --EXPECTF-- 46 | This is with a OCI_PCONNECT 47 | resource(%d) of type (oci8 persistent connection) 48 | resource(%d) of type (oci8 persistent connection) 49 | Both connections are different : OK 50 | Done 51 | -------------------------------------------------------------------------------- /tests/fetch_row.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_fetch_row() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 50 | --EXPECT-- 51 | array(2) { 52 | [0]=> 53 | string(1) "1" 54 | [1]=> 55 | string(1) "1" 56 | } 57 | array(2) { 58 | [0]=> 59 | string(1) "1" 60 | [1]=> 61 | string(1) "1" 62 | } 63 | array(2) { 64 | [0]=> 65 | string(1) "1" 66 | [1]=> 67 | string(1) "1" 68 | } 69 | Done 70 | -------------------------------------------------------------------------------- /tests/array_bind_013.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | getMessage() . "\n"; 22 | } 23 | 24 | var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -10)); 25 | var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, -1)); 26 | var_dump(oci_bind_array_by_name($statement, ":c1", $array, 5, 0)); 27 | 28 | @oci_execute($statement); 29 | 30 | var_dump($array); 31 | 32 | echo "Done\n"; 33 | ?> 34 | --EXPECTF-- 35 | oci_bind_array_by_name() expects at most 6 arguments, 7 given 36 | 37 | Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d 38 | bool(false) 39 | 40 | Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d 41 | bool(false) 42 | 43 | Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d 44 | bool(false) 45 | array(0) { 46 | } 47 | Done 48 | -------------------------------------------------------------------------------- /tests/descriptors.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | commit connection after destroying the descriptor 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 47 | --EXPECTF-- 48 | array(1) { 49 | ["BLOB"]=> 50 | object(OCILob)#%d (1) { 51 | ["descriptor"]=> 52 | resource(%d) of type (oci8 descriptor) 53 | } 54 | } 55 | Done 56 | -------------------------------------------------------------------------------- /tests/imp_res_get_none.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: no implicit results 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 43 | --EXPECT-- 44 | Test 1 45 | bool(false) 46 | -------------------------------------------------------------------------------- /tests/fetch_all4.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test oci_fetch_* array overwriting when query returns no rows 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 52 | --EXPECT-- 53 | Test 1 54 | int(0) 55 | array(2) { 56 | ["MYCOL1"]=> 57 | array(0) { 58 | } 59 | ["MYCOL2"]=> 60 | array(0) { 61 | } 62 | } 63 | Test 2 64 | bool(false) 65 | -------------------------------------------------------------------------------- /tests/connect_without_oracle_home_11.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | = 2) || 18 | ($matches[1] >= 12) 19 | ))) { 20 | die("skip test expected to work only with Oracle 11gR2 or greater version of client"); 21 | } 22 | ?> 23 | --ENV-- 24 | ORACLE_HOME="" 25 | --FILE-- 26 | 38 | --EXPECTF-- 39 | Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d 40 | 41 | Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804 42 | in %s on line %d 43 | bool(false) 44 | -------------------------------------------------------------------------------- /tests/coll_016.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and negative/too big element indexes 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | append(1)); 32 | var_dump($coll1->assignElem(-1,2345)); 33 | var_dump($coll1->assignElem(5000,2345)); 34 | var_dump($coll1->getElem(-1)); 35 | var_dump($coll1->getElem(-100)); 36 | var_dump($coll1->getElem(500)); 37 | 38 | echo "Done\n"; 39 | 40 | require __DIR__."/drop_type.inc"; 41 | 42 | ?> 43 | --EXPECTF-- 44 | bool(true) 45 | 46 | Warning: OCICollection::assignElem(): OCI-22165: given index [%d] must be in the range of %s to [0] in %s on line %d 47 | bool(false) 48 | 49 | Warning: OCICollection::assignElem(): OCI-22165: given index [5000] must be in the range of %s to [0] in %s on line %d 50 | bool(false) 51 | bool(false) 52 | bool(false) 53 | bool(false) 54 | Done 55 | -------------------------------------------------------------------------------- /tests/fetch_all1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_fetch_all() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 47 | --EXPECT-- 48 | int(3) 49 | array(2) { 50 | ["ID"]=> 51 | array(3) { 52 | [0]=> 53 | string(1) "1" 54 | [1]=> 55 | string(1) "1" 56 | [2]=> 57 | string(1) "1" 58 | } 59 | ["VALUE"]=> 60 | array(3) { 61 | [0]=> 62 | string(1) "1" 63 | [1]=> 64 | string(1) "1" 65 | [2]=> 66 | string(1) "1" 67 | } 68 | } 69 | Done 70 | -------------------------------------------------------------------------------- /tests/lob_014.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_free()/close() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("test")); 32 | var_dump($blob->close()); 33 | var_dump($blob->write("test")); 34 | var_dump($blob->free()); 35 | 36 | oci_commit($c); 37 | 38 | $select_sql = "SELECT blob FROM ".$schema.$table_name.""; 39 | $s = oci_parse($c, $select_sql); 40 | oci_execute($s); 41 | 42 | var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS)); 43 | 44 | require __DIR__.'/drop_table.inc'; 45 | 46 | echo "Done\n"; 47 | 48 | ?> 49 | --EXPECT-- 50 | int(4) 51 | bool(true) 52 | int(4) 53 | bool(true) 54 | array(1) { 55 | [0]=> 56 | string(8) "testtest" 57 | } 58 | Done 59 | -------------------------------------------------------------------------------- /tests/lob_012.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_export() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("test string is here\nnew string")); 32 | 33 | oci_commit($c); 34 | 35 | $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 36 | $s = oci_parse($c, $select_sql); 37 | oci_execute($s, OCI_DEFAULT); 38 | 39 | $row = oci_fetch_array($s); 40 | 41 | var_dump($row[0]->export(__DIR__."/lob_012.tmp", 3, 10)); 42 | 43 | var_dump(file_get_contents(__DIR__."/lob_012.tmp")); 44 | 45 | @unlink(__DIR__."/lob_012.tmp"); 46 | 47 | require __DIR__.'/drop_table.inc'; 48 | 49 | echo "Done\n"; 50 | 51 | ?> 52 | --EXPECT-- 53 | int(30) 54 | bool(true) 55 | string(10) "t string i" 56 | Done 57 | -------------------------------------------------------------------------------- /tests/lob_034.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | lob buffering - 2 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | getBuffering()); 30 | var_dump($blob->setBuffering(false)); 31 | var_dump($blob->setBuffering(false)); 32 | var_dump($blob->setBuffering(true)); 33 | var_dump($blob->setBuffering(true)); 34 | var_dump($blob->flush()); 35 | var_dump($blob->flush(0)); 36 | var_dump($blob->flush(-1)); 37 | 38 | oci_commit($c); 39 | 40 | require __DIR__.'/drop_table.inc'; 41 | 42 | echo "Done\n"; 43 | 44 | ?> 45 | --EXPECTF-- 46 | bool(false) 47 | bool(true) 48 | bool(true) 49 | bool(true) 50 | bool(true) 51 | bool(true) 52 | bool(true) 53 | 54 | Warning: OCILob::flush(): Invalid flag value: -1 in %s on line %d 55 | bool(false) 56 | Done 57 | -------------------------------------------------------------------------------- /tests/cursor_bind_err.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | binding a cursor (with errors) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 52 | --EXPECTF-- 53 | Warning: oci_bind_by_name(): ORA-01036: %s in %s on line %d 54 | 55 | Warning: oci_fetch_assoc(): ORA-24338: %s in %s on line %d 56 | bool(false) 57 | Done 58 | -------------------------------------------------------------------------------- /tests/fetch_assoc.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_fetch_assoc() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 48 | --EXPECT-- 49 | array(3) { 50 | ["ID"]=> 51 | string(1) "1" 52 | ["VALUE"]=> 53 | string(1) "1" 54 | ["DUMMY"]=> 55 | NULL 56 | } 57 | array(3) { 58 | ["ID"]=> 59 | string(1) "1" 60 | ["VALUE"]=> 61 | string(1) "1" 62 | ["DUMMY"]=> 63 | NULL 64 | } 65 | array(3) { 66 | ["ID"]=> 67 | string(1) "1" 68 | ["VALUE"]=> 69 | string(1) "1" 70 | ["DUMMY"]=> 71 | NULL 72 | } 73 | Done 74 | -------------------------------------------------------------------------------- /tests/bug42496_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 10 | require __DIR__.'/skipif.inc'; 11 | ?> 12 | --FILE-- 13 | free(); 39 | $arr['C2']->free(); 40 | } 41 | } 42 | oci_free_statement($s); 43 | } 44 | 45 | echo "Done\n"; 46 | 47 | // Cleanup 48 | 49 | $stmtarray = array( 50 | "DROP table bug42496_2_tab" 51 | ); 52 | 53 | oci8_test_sql_execute($c, $stmtarray); 54 | 55 | ?> 56 | --EXPECT-- 57 | Test 2 58 | Done 59 | -------------------------------------------------------------------------------- /tests/bug74625.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #74625 (Integer overflow in oci_bind_array_by_name) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 52 | --EXPECT-- 53 | array(5) { 54 | [0]=> 55 | int(-2) 56 | [1]=> 57 | int(-4) 58 | [2]=> 59 | int(-6) 60 | [3]=> 61 | int(-8) 62 | [4]=> 63 | int(-10) 64 | } 65 | -------------------------------------------------------------------------------- /tests/lob_aliases.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | LOB method aliases 3 | --EXTENSIONS-- 4 | oci8 5 | --FILE-- 6 | 34 | --EXPECT-- 35 | Test 1 36 | bool(true) 37 | bool(true) 38 | bool(true) 39 | bool(true) 40 | bool(true) 41 | bool(true) 42 | bool(true) 43 | bool(true) 44 | bool(true) 45 | bool(true) 46 | bool(true) 47 | bool(true) 48 | bool(true) 49 | bool(true) 50 | bool(true) 51 | bool(true) 52 | bool(true) 53 | bool(true) 54 | bool(true) 55 | bool(true) 56 | Done 57 | -------------------------------------------------------------------------------- /tests/lob_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_is_equal() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 44 | --EXPECTF-- 45 | array(2) { 46 | [0]=> 47 | object(OCILob)#%d (1) { 48 | ["descriptor"]=> 49 | resource(%d) of type (oci8 descriptor) 50 | } 51 | ["BLOB"]=> 52 | object(OCILob)#%d (1) { 53 | ["descriptor"]=> 54 | resource(%d) of type (oci8 descriptor) 55 | } 56 | } 57 | bool(true) 58 | Done 59 | -------------------------------------------------------------------------------- /tests/lob_013.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | lob buffering 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("test")); 30 | var_dump($blob->getBuffering()); 31 | var_dump($blob->setBuffering(true)); 32 | var_dump($blob->write("test")); 33 | var_dump($blob->getBuffering()); 34 | var_dump($blob->flush()); 35 | 36 | oci_commit($c); 37 | 38 | $select_sql = "SELECT blob FROM ".$schema.$table_name.""; 39 | $s = oci_parse($c, $select_sql); 40 | oci_execute($s); 41 | 42 | $row = oci_fetch_array($s, OCI_RETURN_LOBS); 43 | 44 | var_dump($row[0]); 45 | 46 | 47 | require __DIR__.'/drop_table.inc'; 48 | 49 | echo "Done\n"; 50 | 51 | ?> 52 | --EXPECT-- 53 | int(4) 54 | bool(false) 55 | bool(true) 56 | int(4) 57 | bool(true) 58 | bool(true) 59 | string(8) "testtest" 60 | Done 61 | -------------------------------------------------------------------------------- /tests/calltimeout1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_set_call_timeout: test timing out 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 10 | require __DIR__.'/skipif.inc'; 11 | if (strcasecmp($user, "system") && strcasecmp($user, "sys")) { 12 | die("skip needs to be run as a user with access to DBMS_LOCK"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 18)) { 16 | die("skip works only with Oracle 18c or greater version of Oracle client libraries"); 17 | } 18 | 19 | ?> 20 | --FILE-- 21 | 48 | --EXPECTF-- 49 | Test 1 50 | Execute error was ORA-%r(03136|03156)%r: %s 51 | -------------------------------------------------------------------------------- /tests/coll_016_func.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | collections and negative/too big element indexes 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 43 | --EXPECTF-- 44 | bool(true) 45 | 46 | Warning: oci_collection_element_assign(): OCI-22165: given index [%d] must be in the range of%s0%sto [0] in %s on line %d 47 | bool(false) 48 | 49 | Warning: oci_collection_element_assign(): OCI-22165: given index [5000] must be in the range of%s0%sto [0] in %s on line %d 50 | bool(false) 51 | bool(false) 52 | bool(false) 53 | bool(false) 54 | Done 55 | -------------------------------------------------------------------------------- /tests/error_bind_3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test some more oci_bind_by_name error conditions 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => true); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 39 | --EXPECTF-- 40 | Warning: oci_execute(): ORA-06550: line %d, column %d: 41 | PLS-00382: %s 42 | ORA-06550: line %d, column %d: 43 | PL/SQL: %s 44 | ORA-06550: line %d, column %d: 45 | PLS-00382: %s 46 | ORA-06550: line %d, column %d: 47 | PL/SQL: %s in %s on line %d 48 | bool(false) 49 | bool(false) 50 | Done 51 | -------------------------------------------------------------------------------- /tests/error_set.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check oci_set_{action,client_identifier,module_name,client_info} error handling 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 58 | --EXPECT-- 59 | Test 1 60 | bool(false) 61 | 24960 62 | bool(false) 63 | 24960 64 | bool(false) 65 | 24960 66 | bool(false) 67 | 24960 68 | 69 | Test 2 70 | bool(true) 71 | bool(true) 72 | bool(true) 73 | bool(true) 74 | -------------------------------------------------------------------------------- /tests/bug40078.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 48 | --EXPECT-- 49 | array(5) { 50 | [0]=> 51 | string(3) "one" 52 | [1]=> 53 | string(3) "two" 54 | [2]=> 55 | string(0) "" 56 | [3]=> 57 | string(4) "four" 58 | [4]=> 59 | string(4) "five" 60 | } 61 | Done 62 | -------------------------------------------------------------------------------- /tests/oci_execute_segfault.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_execute() segfault after repeated bind of LOB descriptor 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | save("some binary data")); 29 | 30 | oci_bind_by_name($s, ":v_blob", $blob, -1, OCI_B_BLOB); 31 | oci_execute($s, OCI_DEFAULT); 32 | var_dump($blob->save("some more binary data")); 33 | 34 | $query = 'SELECT blob, DBMS_LOB.GETLENGTH(blob) FROM '.$schema.$table_name.' ORDER BY 2'; 35 | 36 | $s = oci_parse ($c, $query); 37 | oci_execute($s, OCI_DEFAULT); 38 | 39 | while ($arr = oci_fetch_assoc($s)) { 40 | $result = $arr['BLOB']->load(); 41 | var_dump($result); 42 | } 43 | 44 | require __DIR__.'/drop_table.inc'; 45 | 46 | echo "Done\n"; 47 | 48 | ?> 49 | --EXPECT-- 50 | bool(true) 51 | bool(true) 52 | string(16) "some binary data" 53 | string(21) "some more binary data" 54 | Done 55 | -------------------------------------------------------------------------------- /tests/bug42496_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 10 | require __DIR__.'/skipif.inc'; 11 | ?> 12 | --FILE-- 13 | free(); 41 | $arr['C2']->free(); 42 | } 43 | } 44 | oci_free_statement($s); 45 | } 46 | 47 | echo "Done\n"; 48 | 49 | // Cleanup 50 | 51 | $stmtarray = array( 52 | "DROP table bug42496_1_tab" 53 | ); 54 | 55 | oci8_test_sql_execute($c, $stmtarray); 56 | 57 | ?> 58 | --EXPECT-- 59 | Test 1 60 | Done 61 | -------------------------------------------------------------------------------- /tests/bug45458.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 44 | --EXPECT-- 45 | Test 1 46 | array(1) { 47 | [0]=> 48 | array(2) { 49 | ["A"]=> 50 | string(1) "X" 51 | [20]=> 52 | string(1) "X" 53 | } 54 | } 55 | array(2) { 56 | ["A"]=> 57 | string(1) "X" 58 | [20]=> 59 | string(1) "X" 60 | } 61 | string(1) "X" 62 | string(1) "X" 63 | Test 2 64 | array(2) { 65 | ["A"]=> 66 | array(1) { 67 | [0]=> 68 | string(1) "X" 69 | } 70 | [20]=> 71 | array(1) { 72 | [0]=> 73 | string(1) "X" 74 | } 75 | } 76 | array(1) { 77 | [0]=> 78 | string(1) "X" 79 | } 80 | array(1) { 81 | [0]=> 82 | string(1) "X" 83 | } 84 | string(1) "X" 85 | string(1) "X" 86 | -------------------------------------------------------------------------------- /tests/imp_res_get_exec.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: Execute twice 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 51 | --EXPECT-- 52 | Test 1 53 | 1 54 | 2 55 | -------------------------------------------------------------------------------- /tests/db_op_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_set_db_operation: basic test for end-to-end tracing 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (strcasecmp($user, "system") && strcasecmp($user, "sys")) { 11 | die("skip needs to be run as a DBA user"); 12 | } 13 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 14 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 15 | die("skip expected output only valid when using Oracle Database 12c or greater"); 16 | } 17 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 18 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 19 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 20 | } 21 | ?> 22 | --FILE-- 23 | 46 | --EXPECT-- 47 | Test 1 48 | array(1) { 49 | ["DUMMY"]=> 50 | string(1) "X" 51 | } 52 | array(1) { 53 | ["DBOP_NAME"]=> 54 | string(7) "db_op_1" 55 | } 56 | -------------------------------------------------------------------------------- /tests/pecl_bug16842.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PECL Bug #16842 (NO_DATA_FOUND exception is a warning) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --INI-- 12 | error_reporting = E_WARNING 13 | --FILE-- 14 | 39 | --EXPECTF-- 40 | Test 1 41 | Raises NO_DATA_FOUND 42 | 43 | Warning: oci_execute(): ORA-01403: %s 44 | ORA-06512: at line %d in %specl_bug16842.php on line %d 45 | bool(false) 46 | array(4) { 47 | ["code"]=> 48 | int(1403) 49 | ["message"]=> 50 | string(%d) "ORA-01403: %s 51 | ORA-06512: at line 1" 52 | ["offset"]=> 53 | int(0) 54 | ["sqltext"]=> 55 | string(31) "begin raise NO_DATA_FOUND; end;" 56 | } 57 | Test 2 58 | Raises ZERO_DIVIDE 59 | 60 | Warning: oci_execute(): ORA-01476: %s 61 | ORA-06512: at line 1 in %s on line 19 62 | bool(false) 63 | array(4) { 64 | ["code"]=> 65 | int(1476) 66 | ["message"]=> 67 | string(%d) "ORA-01476: %s 68 | ORA-06512: at line 1" 69 | ["offset"]=> 70 | int(0) 71 | ["sqltext"]=> 72 | string(29) "begin raise ZERO_DIVIDE; end;" 73 | } 74 | -------------------------------------------------------------------------------- /tests/lob_039.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test CLOB->write() for multiple inserts 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("clob test 1")); 34 | 35 | oci_execute($s, OCI_DEFAULT); 36 | var_dump($clob->write("clob test 2")); 37 | 38 | oci_execute($s, OCI_DEFAULT); 39 | var_dump($clob->write("clob test 3")); 40 | 41 | $s = oci_parse($c,"select clob from ".$schema.$table_name); 42 | var_dump(oci_execute($s)); 43 | 44 | oci_fetch_all($s, $res); 45 | 46 | var_dump($res); 47 | 48 | 49 | require __DIR__.'/drop_table.inc'; 50 | 51 | echo "Done\n"; 52 | 53 | ?> 54 | --EXPECT-- 55 | Test 1: CLOB 56 | int(11) 57 | int(11) 58 | int(11) 59 | bool(true) 60 | array(1) { 61 | ["CLOB"]=> 62 | array(3) { 63 | [0]=> 64 | string(11) "clob test 1" 65 | [1]=> 66 | string(22) " clob test 2" 67 | [2]=> 68 | string(33) " clob test 3" 69 | } 70 | } 71 | Done 72 | -------------------------------------------------------------------------------- /tests/bug51291_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #51291 (oci_error() doesn't report last error when called two times) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 37 | --EXPECTF-- 38 | Test 1 - Execute - after successful 2nd query with same statement 39 | bool(false) 40 | bool(false) 41 | array(4) { 42 | ["code"]=> 43 | int(6510) 44 | ["message"]=> 45 | string(72) "ORA-06510: PL/SQL: %s 46 | ORA-06512: %s" 47 | ["offset"]=> 48 | int(0) 49 | ["sqltext"]=> 50 | string(64) "declare e exception; begin if :bv = 1 then raise e; end if; end;" 51 | } 52 | Execute status is true 53 | 2nd call after successful execute 54 | bool(false) 55 | bool(false) 56 | bool(false) 57 | -------------------------------------------------------------------------------- /tests/imp_res_get_cancel.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_cancel 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 51 | --EXPECT-- 52 | Test 1 53 | 1 54 | 3 55 | -------------------------------------------------------------------------------- /tests/lob_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_write() and friends (with errors) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("test", -1)); 33 | var_dump($blob->write("test", 1000000)); 34 | var_dump($blob->write(str_repeat("test", 10000), 1000000)); 35 | var_dump($blob->tell()); 36 | var_dump($blob->flush()); 37 | 38 | oci_commit($c); 39 | 40 | $select_sql = "select b1 from lob_002_tab where id = 1"; 41 | $s = oci_parse($c, $select_sql); 42 | oci_execute($s); 43 | 44 | $row = oci_fetch_array($s, OCI_RETURN_LOBS); 45 | 46 | var_dump(strlen($row[0])); 47 | 48 | // Cleanup 49 | 50 | $stmtarray = array( 51 | "drop table lob_002_tab" 52 | ); 53 | 54 | oci8_test_sql_execute($c, $stmtarray); 55 | 56 | ?> 57 | --EXPECTF-- 58 | object(OCILob)#%d (1) { 59 | ["descriptor"]=> 60 | resource(%d) of type (oci8 descriptor) 61 | } 62 | int(0) 63 | int(4) 64 | int(40000) 65 | int(40004) 66 | bool(false) 67 | int(40004) 68 | -------------------------------------------------------------------------------- /tests/cursors.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | fetching cursor from a statement 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 53 | --EXPECTF-- 54 | array(5) { 55 | ["ID"]=> 56 | string(1) "1" 57 | ["VALUE"]=> 58 | string(1) "1" 59 | ["BLOB"]=> 60 | NULL 61 | ["CLOB"]=> 62 | NULL 63 | ["STRING"]=> 64 | NULL 65 | } 66 | bool(true) 67 | 68 | Warning: oci_fetch_assoc(): ORA-01002: fetch out of sequence in %s on line %d 69 | bool(false) 70 | bool(true) 71 | Done 72 | -------------------------------------------------------------------------------- /tests/pecl_bug10194.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 11 | if (getenv("USE_ZEND_ALLOC") === "0") { 12 | die("skip Zend MM disabled"); 13 | } 14 | ?> 15 | --INI-- 16 | memory_limit=10M 17 | --FILE-- 18 | write($string); 41 | } 42 | 43 | oci_commit($c); 44 | 45 | $ora_sql = "SELECT clob FROM ".$schema.$table_name.""; 46 | $statement = oci_parse($c,$ora_sql); 47 | oci_execute($statement); 48 | 49 | $row = oci_fetch_assoc($statement); 50 | var_dump(strlen($row['CLOB']->load())); /* here it should fail */ 51 | 52 | require __DIR__.'/drop_table.inc'; 53 | 54 | echo "Done\n"; 55 | ?> 56 | --EXPECTF-- 57 | Fatal error: Allowed memory size of 10485760 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The PHP OCI8 Extension 2 | 3 | Use the PHP OCI8 extension to access Oracle Database. 4 | 5 | Documentation is at https://www.php.net/oci8 6 | 7 | Use `pecl install oci8` to install for PHP 8.2 and PHP 8.3. 8 | 9 | Use `pecl install oci8-3.2.1` to install for PHP 8.1. 10 | 11 | Use `pecl install oci8-3.0.1` to install for PHP 8.0. 12 | 13 | Use `pecl install oci8-2.2.0` to install for PHP 7. 14 | 15 | If your PHP was built with DTrace enabled, then set the environment variable 16 | PHP_DTRACE=yes before running `pecl install oci8`. For example, on Linux: 17 | 18 | export PHP_DTRACE=yes 19 | 20 | You may additionally need the dtrace-devel or systemtap-sdt-devel package 21 | installed. 22 | 23 | The PHP OCI8 extension can be linked with Oracle client libraries from Oracle 24 | Database 11.2 or later. These libraries are found in your database 25 | installation, or in the free Oracle Instant Client from 26 | 27 | https://www.oracle.com/database/technologies/instant-client.html 28 | 29 | Install the 'Basic' or 'Basic Light' Instant Client package. If building from 30 | source, then also install the SDK package. 31 | 32 | Oracle Database's standard cross-version connectivity applies. For example, PHP 33 | OCI8 linked with Instant Client 19c can connect to Oracle Database 11.2 or 34 | later. See Oracle Support's note "Oracle Client / Server Interoperability 35 | Support" (ID 207303.1) for details. 36 | 37 | A sample configuration php.ini file is at 38 | https://github.com/php/pecl-database-oci8/blob/main/oci8.ini 39 | 40 | From PHP 8.4 the source code for PHP OCI8 is at: 41 | https://github.com/php/pecl-database-oci8/ 42 | 43 | For earlier versions, see the PHP source, e.g.: 44 | https://github.com/php/php-src/tree/PHP-8.3/ext/oci8 45 | -------------------------------------------------------------------------------- /tests/cursor_bind.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | bind and fetch cursor from a statement 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 60 | --EXPECT-- 61 | array(2) { 62 | [0]=> 63 | string(1) "1" 64 | [1]=> 65 | string(1) "1" 66 | } 67 | array(2) { 68 | [0]=> 69 | string(1) "1" 70 | [1]=> 71 | string(1) "1" 72 | } 73 | array(2) { 74 | [0]=> 75 | string(1) "1" 76 | [1]=> 77 | string(1) "1" 78 | } 79 | bool(false) 80 | -------------------------------------------------------------------------------- /tests/lob_008.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_write()/read()/eof() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write(str_repeat("string.", 1000))); 32 | oci_commit($c); 33 | 34 | $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 35 | $s = oci_parse($c, $select_sql); 36 | oci_execute($s, OCI_DEFAULT); 37 | 38 | var_dump($row = oci_fetch_array($s)); 39 | 40 | 41 | $len = 0; 42 | while (!$row[0]->eof()) { 43 | $len += strlen($row[0]->read(1024)); 44 | } 45 | var_dump($len); 46 | 47 | require __DIR__.'/drop_table.inc'; 48 | 49 | echo "Done\n"; 50 | 51 | ?> 52 | --EXPECTF-- 53 | object(OCILob)#%d (1) { 54 | ["descriptor"]=> 55 | resource(%d) of type (oci8 descriptor) 56 | } 57 | int(7000) 58 | array(2) { 59 | [0]=> 60 | object(OCILob)#%d (1) { 61 | ["descriptor"]=> 62 | resource(%d) of type (oci8 descriptor) 63 | } 64 | ["BLOB"]=> 65 | object(OCILob)#%d (1) { 66 | ["descriptor"]=> 67 | resource(%d) of type (oci8 descriptor) 68 | } 69 | } 70 | int(7000) 71 | Done 72 | -------------------------------------------------------------------------------- /tests/bind_query.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bind with various WHERE conditions 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | :v order by ename'); 40 | oci_bind_by_name( $s, ":v", $v); 41 | oci_define_by_name($s, "ENAME", $ename, 20); 42 | oci_execute($s); 43 | while (oci_fetch($s)) { 44 | var_dump($ename); 45 | } 46 | 47 | 48 | echo "Test 3\n"; 49 | 50 | $s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename'); 51 | oci_bind_by_name( $s, ":v", $v); 52 | $v = 2000; 53 | oci_define_by_name($s, "ENAME", $ename, 20); 54 | oci_execute($s); 55 | while (oci_fetch($s)) { 56 | var_dump($ename); 57 | } 58 | 59 | 60 | // Clean up 61 | 62 | $stmtarray = array( 63 | "drop table bind_query_tab" 64 | ); 65 | 66 | oci8_test_sql_execute($c, $stmtarray); 67 | 68 | ?> 69 | --EXPECT-- 70 | Test 1 71 | array(1) { 72 | [0]=> 73 | string(6) "MILLER" 74 | } 75 | Test 2 76 | string(4) "FORD" 77 | string(6) "MILLER" 78 | Test 3 79 | string(4) "FORD" 80 | -------------------------------------------------------------------------------- /tests/bug37581.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 50 | --EXPECT-- 51 | array(5) { 52 | [0]=> 53 | string(1) "A" 54 | [1]=> 55 | string(1) "B" 56 | [2]=> 57 | string(1) "C" 58 | [3]=> 59 | string(1) "D" 60 | [4]=> 61 | string(1) "E" 62 | } 63 | array(5) { 64 | [0]=> 65 | string(1) "A" 66 | [1]=> 67 | string(1) "B" 68 | [2]=> 69 | string(1) "C" 70 | [3]=> 71 | string(1) "D" 72 | [4]=> 73 | string(1) "E" 74 | } 75 | Done 76 | -------------------------------------------------------------------------------- /tests/lob_016.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | returning multiple lobs 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("first"); 35 | $row['LOB_2']->write("second"); 36 | 37 | unset($row); 38 | 39 | oci_commit($c); 40 | 41 | $select = "SELECT * FROM lob_test FOR UPDATE"; 42 | $statement = oci_parse($c, $select); 43 | oci_execute($statement, OCI_DEFAULT); 44 | 45 | $row = oci_fetch_assoc($statement); 46 | 47 | var_dump($row); 48 | var_dump($row['LOB_1']->load()); 49 | var_dump($row['LOB_2']->load()); 50 | 51 | $drop = "DROP table lob_test"; 52 | $statement = oci_parse($c, $drop); 53 | @oci_execute($statement); 54 | 55 | echo "Done\n"; 56 | 57 | ?> 58 | --EXPECTF-- 59 | array(2) { 60 | ["LOB_1"]=> 61 | object(OCILob)#%d (1) { 62 | ["descriptor"]=> 63 | resource(%d) of type (oci8 descriptor) 64 | } 65 | ["LOB_2"]=> 66 | object(OCILob)#%d (1) { 67 | ["descriptor"]=> 68 | resource(%d) of type (oci8 descriptor) 69 | } 70 | } 71 | string(5) "first" 72 | string(6) "second" 73 | Done 74 | -------------------------------------------------------------------------------- /tests/bind_unsupported_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bind with various unsupported bind types 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | SQLT_AVC, 18 | "SQLT_STR" => SQLT_STR, 19 | "SQLT_VCS" => SQLT_VCS, 20 | "SQLT_AVC" => SQLT_AVC, 21 | "SQLT_STR" => SQLT_STR, 22 | "SQLT_LVC" => SQLT_LVC, 23 | "SQLT_FLT" => SQLT_FLT, 24 | "SQLT_UIN" => SQLT_UIN, 25 | "SQLT_ODT" => SQLT_ODT, 26 | ); 27 | 28 | foreach ($types as $t => $v) { 29 | 30 | echo "Test - $t\n"; 31 | 32 | $s = oci_parse($c, "select * from dual where dummy = :c1"); 33 | $c1 = "Doug"; 34 | oci_bind_by_name($s, ":c1", $c1, -1, $v); 35 | } 36 | 37 | ?> 38 | --EXPECTF-- 39 | Test - SQLT_AVC 40 | 41 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 97 in %sbind_unsupported_1.php on line %d 42 | Test - SQLT_STR 43 | 44 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 5 in %sbind_unsupported_1.php on line %d 45 | Test - SQLT_VCS 46 | 47 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 9 in %sbind_unsupported_1.php on line %d 48 | Test - SQLT_LVC 49 | 50 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 94 in %sbind_unsupported_1.php on line %d 51 | Test - SQLT_FLT 52 | 53 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 4 in %sbind_unsupported_1.php on line %d 54 | Test - SQLT_UIN 55 | 56 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 68 in %sbind_unsupported_1.php on line %d 57 | Test - SQLT_ODT 58 | 59 | Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 156 in %sbind_unsupported_1.php on line %d 60 | -------------------------------------------------------------------------------- /tests/imp_res_call_error.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: using SQL 'CALL' 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 54 | --EXPECTF-- 55 | Test 1 56 | 57 | Warning: oci_execute(): ORA-29478: %s 58 | ORA-06512: at "SYS.DBMS_SQL", line %d 59 | ORA-06512: at "SYS.DBMS_SQL", line %d 60 | ORA-06512: at "%s.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d 61 | -------------------------------------------------------------------------------- /tests/define4.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_define_by_name() on partial number of columns 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | getMessage()); 53 | } 54 | // Cleanup 55 | 56 | $stmtarray = array( 57 | "drop table define4_tab" 58 | ); 59 | 60 | oci8_test_sql_execute($c, $stmtarray); 61 | 62 | echo "Done\n"; 63 | 64 | ?> 65 | --EXPECTF-- 66 | Test 1 67 | bool(true) 68 | Test 2 69 | string(4) "1234" 70 | string(4) "some" 71 | string(4) "some" 72 | string(4) "some" 73 | string(4) "1234" 74 | string(4) "some" 75 | Test 3 76 | bool(true) 77 | string(4) "some" 78 | string(%d) "oci_result(): supplied resource is not a valid oci8 statement resource" 79 | Done 80 | -------------------------------------------------------------------------------- /tests/lob_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_write()/size()/load() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | size()); 32 | var_dump($blob->write(str_repeat("string.", 1000))); 33 | var_dump($blob->size()); 34 | oci_commit($c); 35 | 36 | $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 37 | $s = oci_parse($c, $select_sql); 38 | oci_execute($s, OCI_DEFAULT); 39 | 40 | var_dump($row = oci_fetch_array($s)); 41 | 42 | var_dump($row[0]->size()); 43 | var_dump(strlen($row[0]->load())); 44 | 45 | require __DIR__.'/drop_table.inc'; 46 | 47 | echo "Done\n"; 48 | 49 | ?> 50 | --EXPECTF-- 51 | object(OCILob)#%d (1) { 52 | ["descriptor"]=> 53 | resource(%d) of type (oci8 descriptor) 54 | } 55 | int(0) 56 | int(7000) 57 | int(7000) 58 | array(2) { 59 | [0]=> 60 | object(OCILob)#%d (1) { 61 | ["descriptor"]=> 62 | resource(%d) of type (oci8 descriptor) 63 | } 64 | ["BLOB"]=> 65 | object(OCILob)#%d (1) { 66 | ["descriptor"]=> 67 | resource(%d) of type (oci8 descriptor) 68 | } 69 | } 70 | int(7000) 71 | int(7000) 72 | Done 73 | -------------------------------------------------------------------------------- /tests/pecl_bug10194_blob.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); 11 | if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 12 | if (getenv("USE_ZEND_ALLOC") === "0") { 13 | die("skip Zend MM disabled"); 14 | } 15 | ?> 16 | --INI-- 17 | memory_limit=3M 18 | --FILE-- 19 | write($string); 41 | } 42 | 43 | oci_commit($c); 44 | 45 | $ora_sql = "SELECT blob FROM ".$schema.$table_name; 46 | $statement = oci_parse($c,$ora_sql); 47 | oci_execute($statement); 48 | 49 | echo "Before load()\n"; 50 | 51 | $row = oci_fetch_assoc($statement); 52 | var_dump(strlen($row['BLOB']->load())); /* here it should fail */ 53 | 54 | require __DIR__.'/drop_table.inc'; 55 | 56 | echo "Done\n"; 57 | ?> 58 | --EXPECTF-- 59 | Before load() 60 | 61 | Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d 62 | -------------------------------------------------------------------------------- /tests/lob_044.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_truncate() with default parameter value 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("this is a biiiig faaat test string. why are you reading it, I wonder? =)")); 36 | var_dump($blob->seek(0)); 37 | var_dump($blob->read(10000)); 38 | var_dump($blob->truncate()); 39 | var_dump($blob->seek(0)); 40 | var_dump($blob->read(10000)); 41 | 42 | oci_commit($c); 43 | 44 | 45 | // Read it back 46 | 47 | echo "\nTest 2 - read it back\n"; 48 | 49 | $s = oci_parse($c, "SELECT blob FROM lob_044_tab FOR UPDATE"); 50 | oci_execute($s, OCI_DEFAULT); 51 | $row = oci_fetch_array($s); 52 | var_dump($row[0]->read(10000)); 53 | 54 | // Clean up 55 | 56 | $stmtarray = array( 57 | "drop table lob_044_tab" 58 | ); 59 | 60 | oci8_test_sql_execute($c, $stmtarray); 61 | 62 | ?> 63 | --EXPECT-- 64 | Test 1 - truncate on insert 65 | int(72) 66 | bool(true) 67 | string(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)" 68 | bool(true) 69 | bool(true) 70 | string(0) "" 71 | 72 | Test 2 - read it back 73 | string(0) "" 74 | -------------------------------------------------------------------------------- /tests/bug71422.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #71422 (Fix ORA-01438: value larger than specified precision allowed for this column) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 52 | --EXPECT-- 53 | array(1) { 54 | ["RAW_QUERY"]=> 55 | string(3) "Foo" 56 | } 57 | array(1) { 58 | ["NUMERIC_BIND_PARAMETER"]=> 59 | string(3) "Foo" 60 | } 61 | array(1) { 62 | ["STRING_BIND_PARAMETER"]=> 63 | string(3) "Foo" 64 | } 65 | -------------------------------------------------------------------------------- /tests/pecl_bug10194_blob_64.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on thes 9 | require __DIR__.'/skipif.inc'; 10 | if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 11 | if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); 12 | if (getenv("USE_ZEND_ALLOC") === "0") { 13 | die("skip Zend MM disabled"); 14 | } 15 | ?> 16 | --INI-- 17 | memory_limit=6M 18 | --FILE-- 19 | write($string); 42 | } 43 | 44 | oci_commit($c); 45 | 46 | $ora_sql = "SELECT blob FROM ".$schema.$table_name; 47 | $statement = oci_parse($c,$ora_sql); 48 | oci_execute($statement); 49 | 50 | echo "Before load()\n"; 51 | 52 | $row = oci_fetch_assoc($statement); 53 | var_dump(strlen($row['BLOB']->load())); /* here it should fail */ 54 | 55 | require __DIR__.'/drop_table.inc'; 56 | 57 | echo "Done\n"; 58 | ?> 59 | --EXPECTF-- 60 | Before load() 61 | 62 | Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d 63 | -------------------------------------------------------------------------------- /tests/drcp_characterset.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_pconnect() and oci_connect() with different character sets 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 58 | --EXPECTF-- 59 | resource(%d) of type (oci8 connection) 60 | resource(%d) of type (oci8 persistent connection) 61 | resource(%d) of type (oci8 connection) 62 | resource(%d) of type (oci8 persistent connection) 63 | First and third connections are different: OK 64 | Second and fourth connections are different: OK 65 | Done 66 | -------------------------------------------------------------------------------- /tests/drcp_scope4.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=0 11 | --FILE-- 12 | 60 | --EXPECTF-- 61 | This is with a OCI_PCONNECT 62 | resource(%d) of type (oci8 persistent connection) 63 | Update done-- DEPT value has been set to NEWDEPT 64 | resource(%d) of type (oci8 persistent connection) 65 | The value of DEPT for id 105 is HR 66 | Done 67 | -------------------------------------------------------------------------------- /tests/lob_009.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_import()/read() 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | seek(10, OCI_SEEK_CUR)); 31 | var_dump($blob->import(__DIR__."/lob_009.txt")); 32 | oci_commit($c); 33 | 34 | $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 35 | $s = oci_parse($c, $select_sql); 36 | oci_execute($s, OCI_DEFAULT); 37 | 38 | var_dump($row = oci_fetch_array($s)); 39 | 40 | while (!$row[0]->eof()) { 41 | var_dump(str_replace("\r", "", $row[0]->read(1024))); 42 | } 43 | 44 | require __DIR__.'/drop_table.inc'; 45 | 46 | echo "Done\n"; 47 | 48 | ?> 49 | --EXPECTF-- 50 | object(OCILob)#%d (1) { 51 | ["descriptor"]=> 52 | resource(%d) of type (oci8 descriptor) 53 | } 54 | bool(true) 55 | bool(true) 56 | array(2) { 57 | [0]=> 58 | object(OCILob)#%d (1) { 59 | ["descriptor"]=> 60 | resource(%d) of type (oci8 descriptor) 61 | } 62 | ["BLOB"]=> 63 | object(OCILob)#%d (1) { 64 | ["descriptor"]=> 65 | resource(%d) of type (oci8 descriptor) 66 | } 67 | } 68 | string(43) "this 69 | is 70 | a 71 | test 72 | file for 73 | test lob_009.phpt 74 | " 75 | Done 76 | -------------------------------------------------------------------------------- /tests/imp_res_get_close_3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #3 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 57 | --EXPECT-- 58 | Test 1 59 | 1 60 | 2 61 | 3 62 | 4 63 | 5 64 | 6 65 | -------------------------------------------------------------------------------- /tests/imp_res_cancel.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: oci_cancel 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 60 | --EXPECT-- 61 | Test 1 62 | 1 63 | bool(true) 64 | 2 65 | bool(true) 66 | 3 67 | bool(true) 68 | -------------------------------------------------------------------------------- /tests/lob_017.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | returning multiple lobs (using persistent connection) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write("first"); 37 | $row['LOB_2']->write("second"); 38 | 39 | unset($row); 40 | 41 | oci_commit($c); 42 | 43 | $select = "SELECT * FROM lob_test FOR UPDATE"; 44 | $statement = oci_parse($c, $select); 45 | oci_execute($statement, OCI_DEFAULT); 46 | 47 | $row = oci_fetch_assoc($statement); 48 | 49 | var_dump($row); 50 | var_dump($row['LOB_1']->load()); 51 | var_dump($row['LOB_2']->load()); 52 | 53 | $drop = "DROP table lob_test"; 54 | $statement = oci_parse($c, $drop); 55 | @oci_execute($statement); 56 | 57 | echo "Done\n"; 58 | 59 | ?> 60 | --EXPECTF-- 61 | array(2) { 62 | ["LOB_1"]=> 63 | object(OCILob)#%d (1) { 64 | ["descriptor"]=> 65 | resource(%d) of type (oci8 descriptor) 66 | } 67 | ["LOB_2"]=> 68 | object(OCILob)#%d (1) { 69 | ["descriptor"]=> 70 | resource(%d) of type (oci8 descriptor) 71 | } 72 | } 73 | string(5) "first" 74 | string(6) "second" 75 | Done 76 | -------------------------------------------------------------------------------- /tests/bug38173.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #38173 (Freeing nested cursors causes OCI8 to segfault) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | 69 | --EXPECT-- 70 | Got row! 71 | bool(true) 72 | bool(true) 73 | Got row! 74 | bool(true) 75 | bool(true) 76 | Got row! 77 | bool(true) 78 | bool(true) 79 | Got row! 80 | bool(true) 81 | bool(true) 82 | Got row! 83 | bool(true) 84 | bool(true) 85 | Done 86 | -------------------------------------------------------------------------------- /tests/drcp_scope3.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --INI-- 10 | oci8.old_oci_close_semantics=1 11 | --FILE-- 12 | 57 | --EXPECTF-- 58 | Deprecated: Directive oci8.old_oci_close_semantics is deprecated%s 59 | This is with a OCI_PCONNECT 60 | resource(%d) of type (oci8 persistent connection) 61 | Update done-- DEPT value has been set to NEWDEPT 62 | resource(%d) of type (oci8 persistent connection) 63 | The value of DEPT for id 105 is NEWDEPT 64 | 65 | Warning: oci_execute(): ORA-00054: %s 66 | Done 67 | -------------------------------------------------------------------------------- /tests/define5.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_define_by_name() for statement re-execution 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 64 | --EXPECT-- 65 | Test 1 - must do define before execute 66 | bool(true) 67 | NULL 68 | string(4) "some" 69 | Test 2 - normal define order 70 | bool(true) 71 | string(4) "some" 72 | Test 3 - no new define done 73 | string(4) "some" 74 | string(5) "thing" 75 | Done 76 | -------------------------------------------------------------------------------- /tests/imp_res_func_error.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Oracle Database 12c Implicit Result Sets: test with a PL/SQL function 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11 | if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 | die("skip expected output only valid when using Oracle Database 12c or greater"); 13 | } 14 | preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15 | if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 | die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17 | } 18 | ?> 19 | --FILE-- 20 | 60 | --EXPECTF-- 61 | Test 1 62 | 63 | Warning: oci_execute(): ORA-29478: %s 64 | ORA-06512: %s 65 | ORA-06512: %s 66 | ORA-06512: %s 67 | -------------------------------------------------------------------------------- /tests/lob_019.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_lob_write()/erase()/read() with BLOBs 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | write($str)); 33 | var_dump($blob->erase(0, 10)); 34 | 35 | oci_commit($c); 36 | 37 | $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 38 | $s = oci_parse($c, $select_sql); 39 | oci_execute($s, OCI_DEFAULT); 40 | 41 | var_dump($row = oci_fetch_array($s)); 42 | 43 | var_dump($row[0]->read(5)); 44 | var_dump($row[0]->read(5)); 45 | var_dump($row[0]->read(5)); 46 | 47 | require __DIR__.'/drop_table.inc'; 48 | 49 | echo "Done\n"; 50 | 51 | ?> 52 | --EXPECTF-- 53 | object(OCILob)#%d (1) { 54 | ["descriptor"]=> 55 | resource(%d) of type (oci8 descriptor) 56 | } 57 | int(72) 58 | int(10) 59 | array(2) { 60 | [0]=> 61 | object(OCILob)#%d (1) { 62 | ["descriptor"]=> 63 | resource(%d) of type (oci8 descriptor) 64 | } 65 | ["BLOB"]=> 66 | object(OCILob)#%d (1) { 67 | ["descriptor"]=> 68 | resource(%d) of type (oci8 descriptor) 69 | } 70 | } 71 | string(5) "%0%0%0%0%0" 72 | string(5) "%0%0%0%0%0" 73 | string(5) "biiii" 74 | Done 75 | -------------------------------------------------------------------------------- /tests/bug37220.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #37220 (LOB Type mismatch when using windows & oci8.dll) 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | true, 'timesten' => false); // test runs on these DBs 9 | require __DIR__.'/skipif.inc'; 10 | ?> 11 | --FILE-- 12 | '))" 21 | ); 22 | 23 | oci8_test_sql_execute($c, $stmtarray); 24 | 25 | // Now let's update the row where myId = 1234 and change the tag 26 | // 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and 27 | // bug37220_tab a normal Oracle table) 28 | 29 | $query = "UPDATE bug37220_tab 30 | SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) 31 | WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1"; 32 | $stmt = oci_parse ($c, $query); 33 | $clob = oci_new_descriptor($c, OCI_D_LOB); 34 | oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); 35 | $clob->writeTemporary("", OCI_TEMP_CLOB); 36 | $success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS); 37 | oci_free_statement($stmt); 38 | $clob->close(); 39 | 40 | // Query back the change 41 | 42 | $query = "select * from bug37220_tab"; 43 | $stmt = oci_parse ($c, $query); 44 | 45 | oci_execute($stmt); 46 | 47 | while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { 48 | foreach ($row as $item) { 49 | echo trim($item)."\n"; 50 | } 51 | echo "\n"; 52 | } 53 | 54 | // Cleanup 55 | 56 | $stmtarray = array( 57 | "drop table bug37220_tab" 58 | ); 59 | 60 | oci8_test_sql_execute($c, $stmtarray); 61 | 62 | echo "Done\n"; 63 | 64 | ?> 65 | --EXPECT-- 66 | 67 | 68 | Done 69 | -------------------------------------------------------------------------------- /tests/array_bind_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | oci_bind_array_by_name() and invalid values 1 3 | --EXTENSIONS-- 4 | oci8 5 | --SKIPIF-- 6 | 9 | --FILE-- 10 | 65 | --EXPECTF-- 66 | Warning: oci_bind_array_by_name(): OCI-21560: argument%S 3 is null, invalid, or out of range in %s on line %d 67 | 68 | Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d 69 | array(1) { 70 | [0]=> 71 | string(0) "" 72 | } 73 | Done 74 | --------------------------------------------------------------------------------