From 42645d14a9dae7971a2f74a285960cdc589e8de8 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 1 Mar 2007 23:28:51 +0000 Subject: [PATCH] new tests by Chris and me --- ext/oci8/tests/bug40415.phpt | 307 +++++++++++++++++++++++++++++++++++ ext/oci8/tests/lob_029.phpt | 89 +++++----- ext/oci8/tests/lob_037.phpt | Bin 0 -> 1771 bytes ext/oci8/tests/lob_038.phpt | Bin 0 -> 5146 bytes ext/oci8/tests/lob_039.phpt | 65 ++++++++ 5 files changed, 414 insertions(+), 47 deletions(-) create mode 100644 ext/oci8/tests/bug40415.phpt create mode 100644 ext/oci8/tests/lob_037.phpt create mode 100644 ext/oci8/tests/lob_038.phpt create mode 100644 ext/oci8/tests/lob_039.phpt diff --git a/ext/oci8/tests/bug40415.phpt b/ext/oci8/tests/bug40415.phpt new file mode 100644 index 0000000000..05cee22af9 --- /dev/null +++ b/ext/oci8/tests/bug40415.phpt @@ -0,0 +1,307 @@ +--TEST-- +Bug #40415 (Using oci_fetchall with nested cursors) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Test 1: Associate fetch of nested cursor +Got row "11". Now getting nested cursor: +bool(true) +array(1) { + ["ID2"]=> + string(2) "21" +} +array(1) { + ["ID2"]=> + string(2) "22" +} +array(1) { + ["ID2"]=> + string(2) "23" +} +Got row "12". Now getting nested cursor: +bool(true) +array(1) { + ["ID2"]=> + string(2) "21" +} +array(1) { + ["ID2"]=> + string(2) "22" +} +array(1) { + ["ID2"]=> + string(2) "23" +} +Got row "13". Now getting nested cursor: +bool(true) +array(1) { + ["ID2"]=> + string(2) "21" +} +array(1) { + ["ID2"]=> + string(2) "22" +} +array(1) { + ["ID2"]=> + string(2) "23" +} + +Test 2: fetchall of nested cursor +Rows returned 3 +array(2) { + ["ID1"]=> + array(3) { + [0]=> + string(2) "11" + [1]=> + string(2) "12" + [2]=> + string(2) "13" + } + ["CURSOR"]=> + array(3) { + [0]=> + resource(%d) of type (oci8 statement) + [1]=> + resource(%d) of type (oci8 statement) + [2]=> + resource(%d) of type (oci8 statement) + } +} +Getting nested cursor +bool(true) +array(1) { + ["ID2"]=> + array(3) { + [0]=> + string(2) "21" + [1]=> + string(2) "22" + [2]=> + string(2) "23" + } +} +Getting nested cursor +bool(true) +array(1) { + ["ID2"]=> + array(3) { + [0]=> + string(2) "21" + [1]=> + string(2) "22" + [2]=> + string(2) "23" + } +} +Getting nested cursor +bool(true) +array(1) { + ["ID2"]=> + array(3) { + [0]=> + string(2) "21" + [1]=> + string(2) "22" + [2]=> + string(2) "23" + } +} +Done +--UEXPECTF-- +Test 1: Associate fetch of nested cursor +Got row "11". Now getting nested cursor: +bool(true) +array(1) { + [u"ID2"]=> + unicode(2) "21" +} +array(1) { + [u"ID2"]=> + unicode(2) "22" +} +array(1) { + [u"ID2"]=> + unicode(2) "23" +} +Got row "12". Now getting nested cursor: +bool(true) +array(1) { + [u"ID2"]=> + unicode(2) "21" +} +array(1) { + [u"ID2"]=> + unicode(2) "22" +} +array(1) { + [u"ID2"]=> + unicode(2) "23" +} +Got row "13". Now getting nested cursor: +bool(true) +array(1) { + [u"ID2"]=> + unicode(2) "21" +} +array(1) { + [u"ID2"]=> + unicode(2) "22" +} +array(1) { + [u"ID2"]=> + unicode(2) "23" +} + +Test 2: fetchall of nested cursor +Rows returned 3 +array(2) { + [u"ID1"]=> + array(3) { + [0]=> + unicode(2) "11" + [1]=> + unicode(2) "12" + [2]=> + unicode(2) "13" + } + [u"CURSOR"]=> + array(3) { + [0]=> + resource(22) of type (oci8 statement) + [1]=> + resource(23) of type (oci8 statement) + [2]=> + resource(24) of type (oci8 statement) + } +} +Getting nested cursor +bool(true) +array(1) { + [u"ID2"]=> + array(3) { + [0]=> + unicode(2) "21" + [1]=> + unicode(2) "22" + [2]=> + unicode(2) "23" + } +} +Getting nested cursor +bool(true) +array(1) { + [u"ID2"]=> + array(3) { + [0]=> + unicode(2) "21" + [1]=> + unicode(2) "22" + [2]=> + unicode(2) "23" + } +} +Getting nested cursor +bool(true) +array(1) { + [u"ID2"]=> + array(3) { + [0]=> + unicode(2) "21" + [1]=> + unicode(2) "22" + [2]=> + unicode(2) "23" + } +} +Done diff --git a/ext/oci8/tests/lob_029.phpt b/ext/oci8/tests/lob_029.phpt index fb49dce205..6c310981b8 100644 --- a/ext/oci8/tests/lob_029.phpt +++ b/ext/oci8/tests/lob_029.phpt @@ -1,8 +1,7 @@ --TEST-- reading/writing BFILE LOBs --SKIPIF-- - @@ -12,19 +11,31 @@ if (empty($oracle_on_localhost)) die("skip this test won't work with remote Orac require dirname(__FILE__).'/connect.inc'; $realdirname = dirname(__FILE__); -$realfilename = "oci8bfiletest.txt"; -$fullname = $realdirname."/".$realfilename; +$realfilename1 = "oci8bfiletest1.txt"; +$fullname1 = $realdirname."/".$realfilename1; +$realfilename2 = "oci8bfiletest2.txt"; +$fullname2 = $realdirname."/".$realfilename2; +$realfilename3 = "oci8bfiletest3.txt"; +$fullname3 = $realdirname."/".$realfilename3; // Setup $s = oci_parse($c, "create directory TestDir as '$realdirname'"); oci_execute($s); -file_put_contents($fullname, 'Some text in the bfile'); +file_put_contents($fullname1, 'Some text in the bfile 1'); +file_put_contents($fullname2, 'Some text in the bfile 2'); +file_put_contents($fullname3, 'Some text in the bfile 3'); $s = oci_parse($c, "create table FileTest (FileNum number, FileDesc varchar2(30), Image bfile)"); oci_execute($s); -$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (1, 'Description 1', bfilename('TESTDIR', '$realfilename'))"); +$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (1, 'Description 1', bfilename('TESTDIR', '$realfilename1'))"); +oci_execute($s); + +$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename2'))"); +oci_execute($s); + +$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (3, 'Description 3', bfilename('TESTDIR', '$realfilename3'))"); oci_execute($s); // Run tests @@ -37,7 +48,7 @@ oci_fetch_all($s, $res); var_dump($res); echo "Test 2\n"; -$s = oci_parse($c, "select * from FileTest"); +$s = oci_parse($c, "select * from FileTest order by FileNum"); oci_execute($s); oci_fetch_all($s, $res); var_dump($res); @@ -45,14 +56,16 @@ var_dump($res); echo "Test 3\n"; $d = oci_new_descriptor($c, OCI_D_FILE); -$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename')) returning Image into :im"); +$s = oci_parse($c, "insert into FileTest (FileNum, FileDesc, Image) values (2, 'Description 2', bfilename('TESTDIR', '$realfilename1')) returning Image into :im"); oci_bind_by_name($s, ":im", $d, -1, OCI_B_BFILE); oci_execute($s); $r = $d->read(40); var_dump($r); -unlink($fullname); +unlink($fullname1); +unlink($fullname2); +unlink($fullname3); $s = oci_parse($c, "drop table FileTest"); oci_execute($s); @@ -62,63 +75,45 @@ oci_execute($s); echo "Done\n"; ?> ---EXPECTF-- +--EXPECTF-- Test 1. Check how many rows in the table array(1) { ["NUMROWS"]=> array(1) { [0]=> - string(1) "1" + string(1) "3" } } Test 2 array(3) { ["FILENUM"]=> - array(1) { + array(3) { [0]=> string(1) "1" + [1]=> + string(1) "2" + [2]=> + string(1) "3" } ["FILEDESC"]=> - array(1) { + array(3) { [0]=> string(13) "Description 1" + [1]=> + string(13) "Description 2" + [2]=> + string(13) "Description 3" } ["IMAGE"]=> - array(1) { - [0]=> - string(22) "Some text in the bfile" - } -} -Test 3 -string(22) "Some text in the bfile" -Done ---UEXPECTF-- -Test 1. Check how many rows in the table -array(1) { - [u"NUMROWS"]=> - array(1) { - [0]=> - unicode(1) "1" - } -} -Test 2 -array(3) { - [u"FILENUM"]=> - array(1) { - [0]=> - unicode(1) "1" - } - [u"FILEDESC"]=> - array(1) { - [0]=> - unicode(13) "Description 1" - } - [u"IMAGE"]=> - array(1) { + array(3) { [0]=> - string(22) "Some text in the bfile" + string(24) "Some text in the bfile 1" + [1]=> + string(24) "Some text in the bfile 2" + [2]=> + string(24) "Some text in the bfile 3" } } Test 3 -string(22) "Some text in the bfile" -Done +string(24) "Some text in the bfile 1" +Done \ No newline at end of file diff --git a/ext/oci8/tests/lob_037.phpt b/ext/oci8/tests/lob_037.phpt new file mode 100644 index 0000000000000000000000000000000000000000..8137037ea2eaa3b5adc7d64d8d9e59887cc70b95 GIT binary patch literal 1771 zcmeHI-*4J55YBV{idz(kq#_iyRjS6;s_nvr#-M^QZR#q^B*(A@c50i_{`Wfv%0^Y% z*F7vRQSQF)JNtemNwRd5C5hibo6m&&33jER5Ys7YlosY{Vt~s6mZoyfZ~=U3QNz>` z{3IED?p}5~r11WRh@aa@aIQpPASzeEXAfiuDu8^mom zJt4(Tx0gQX`M$=RrO-%BE%^c?#+;wAxKTUIm6Vv+4x>oQ@#EMQQJuLq_pF>@dy7!+y8_X^+=z3HG zR&s4H3iJBIwd1xQI;D+Y;))e$axF@$v;z(LD0jMo zTOPy&bwasXEQF=QIqGg{4N{{N|7%;dG^OX?t?i~#FBaF}oaP=T%Ff)l?#$~b?WGqP zRQ=l-4!*#X(@9x)uKizV%}}eAqjRnKedJQ=3|GzT&BRp8k#S>GPMy8=xAyw~YW9uN zRn1LF?K(N3)m22TX0z#9{m)QTxYqR^+_T%T(5l?sg_zG21Rs^eAJXlHY7wX3E-90= ziiNaM>utP#AH}}0n*IjP1dqpY>pLRf<8t~g0B!j3j`Hi{wep+hR+&ts>MQVCm?6qazTwjbXeru_dbiC*S+*$lp5sQ5SSdAS88yFJ zqv}D!(_UrgHCeE;uI8{%%Ka>i7-(wB?7Gm`muEiIp^ARkj_ zMU-O=DmCqqS9%|eW8#Qb#nkddFh2f_ChP)5kn*H;^P7i)W#wvhRq;1KWU*^d@lLSt z(By3ZXu^UbUjP&b~&^r`8zsvC3U#whaatI-Jw5P5ss7KivRfCyf{^hCtw>EQiQE1go UYtuZ|_DUWNVvps~)CH@*0AOLeS^xk5 literal 0 HcmV?d00001 diff --git a/ext/oci8/tests/lob_039.phpt b/ext/oci8/tests/lob_039.phpt new file mode 100644 index 0000000000..93251c8d80 --- /dev/null +++ b/ext/oci8/tests/lob_039.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test CLOB->write() for multiple inserts +--SKIPIF-- + +--FILE-- +write("clob test 1")); + +oci_execute($s, OCI_DEFAULT); +var_dump($clob->write("clob test 2")); + +oci_execute($s, OCI_DEFAULT); +var_dump($clob->write("clob test 3")); + +$s = oci_parse($c,"select clob from ".$schema.$table_name); +var_dump(oci_execute($s)); + +oci_fetch_all($s, $res); + +var_dump($res); + + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; + +?> +--EXPECT-- +Test 1: CLOB +int(11) +int(11) +int(11) +bool(true) +array(1) { + ["CLOB"]=> + array(3) { + [0]=> + string(11) "clob test 1" + [1]=> + string(11) "clob test 2" + [2]=> + string(11) "clob test 3" + } +} +Done -- 2.50.1