????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 52.14.133.33 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/oci8/tests/ |
Upload File : |
--TEST-- Bind tests with SQLT_AFC --SKIPIF-- <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> --FILE-- <?php require(dirname(__FILE__).'/connect.inc'); // Initialization $stmtarray = array( "drop table bind_sqltafc_tab", "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)", "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)" ); oci8_test_sql_execute($c, $stmtarray); // Run Test function q($c, $id) { $s = oci_parse($c, "select * from bind_sqltafc_tab where id = $id"); oci_execute($s); oci_fetch_all($s, $r); var_dump($r); } echo "Test 0 - base table creation without binds\n"; q($c, 0); echo "\nTest 1 - successful insert\n"; $s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (1, :c2, :c3, :c4, :c5)"); $c2 = "H"; $c3 = "AAAAAAAAAA"; // max length allowed in column $c4 = "BBBBBBBBBB"; // max length allowed in column $c5 = "123.45"; oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC); oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC); oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC); oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC); oci_execute($s); q($c, 1); echo "\nTest 2 - Empty Strings\n"; $s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (5, :c2, :c3, :c4, :c5)"); $c2 = ""; $c3 = ""; $c4 = ""; $c5 = ""; oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC); oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC); oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC); oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC); oci_execute($s); q($c, 5); echo "\nTest 3 - NULLs\n"; $s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (6, :c2, :c3, :c4, :c5)"); $c2 = null; $c3 = null; $c4 = null; $c5 = null; oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC); oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC); oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC); oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC); oci_execute($s); q($c, 6); // Clean up $stmtarray = array( "drop table bind_sqltafc_tab" ); oci8_test_sql_execute($c, $stmtarray); oci_close($c); ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- Test 0 - base table creation without binds array(5) { ["ID"]=> array(1) { [0]=> string(1) "0" } ["CHAR_T"]=> array(1) { [0]=> string(1) "a" } ["CHAR_T10"]=> array(1) { [0]=> string(10) "abcd " } ["VARCHAR2_T10"]=> array(1) { [0]=> string(6) "efghij" } ["NUMBER_T"]=> array(1) { [0]=> string(3) "1.1" } } Test 1 - successful insert array(5) { ["ID"]=> array(1) { [0]=> string(1) "1" } ["CHAR_T"]=> array(1) { [0]=> string(1) "H" } ["CHAR_T10"]=> array(1) { [0]=> string(10) "AAAAAAAAAA" } ["VARCHAR2_T10"]=> array(1) { [0]=> string(10) "BBBBBBBBBB" } ["NUMBER_T"]=> array(1) { [0]=> string(6) "123.45" } } Test 2 - Empty Strings array(5) { ["ID"]=> array(1) { [0]=> string(1) "5" } ["CHAR_T"]=> array(1) { [0]=> NULL } ["CHAR_T10"]=> array(1) { [0]=> NULL } ["VARCHAR2_T10"]=> array(1) { [0]=> NULL } ["NUMBER_T"]=> array(1) { [0]=> NULL } } Test 3 - NULLs array(5) { ["ID"]=> array(1) { [0]=> string(1) "6" } ["CHAR_T"]=> array(1) { [0]=> NULL } ["CHAR_T10"]=> array(1) { [0]=> NULL } ["VARCHAR2_T10"]=> array(1) { [0]=> NULL } ["NUMBER_T"]=> array(1) { [0]=> NULL } } ===DONE===