@@ -18,18 +18,19 @@ $dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
1818$ dbhsetAttribute (PDO ::ATTR_STRINGIFY_FETCHES , false );
1919
2020@$ dbhexec ('DROP TABLE pdo_oci_bug60994 ' );
21- $ dbhexec ('CREATE TABLE pdo_oci_bug60994 (id NUMBER, data CLOB) ' );
21+ $ dbhexec ('CREATE TABLE pdo_oci_bug60994 (id NUMBER, data CLOB, data2 NCLOB ) ' );
2222
2323$ idnull ;
24- $ insert$ dbhprepare ('INSERT INTO pdo_oci_bug60994 (id, data) VALUES (:id, :data) ' );
24+ $ insert$ dbhprepare ('INSERT INTO pdo_oci_bug60994 (id, data, data2 ) VALUES (:id, :data, :data2 ) ' );
2525$ insertbindParam (':id ' , $ idPDO ::PARAM_STR );
26- $ select$ dbhprepare ("SELECT data FROM pdo_oci_bug60994 WHERE id = :id " );
26+ $ select$ dbhprepare ("SELECT data, data2  FROM pdo_oci_bug60994 WHERE id = :id " );
2727
2828
2929echo  PHP_EOL , 'Test 1:  j ' , PHP_EOL ;
3030$ string1'abc '  . str_repeat ('j ' , 8187 ) . 'xyz ' ; // 8193 chars total works fine here (even 1 million works fine, subject to memory_limit) 
3131$ id1 ;
3232$ insertbindParam (':data ' , $ string1PDO ::PARAM_STR , strlen ($ string1// length in bytes 
33+ $ insertbindParam (':data2 ' , $ string1PDO ::PARAM_STR , strlen ($ string1
3334$ insertexecute ();
3435$ selectbindParam (':id ' , $ idPDO ::PARAM_STR );
3536$ selectexecute ();
@@ -41,12 +42,15 @@ echo 'size of string1 is ', strlen($string1), ' bytes, ', mb_strlen($string1), '
4142echo  'size of stream1 is  ' , strlen ($ stream1' bytes,  ' , mb_strlen ($ stream1' chars. ' , PHP_EOL ;
4243echo  'beg  of stream1 is  ' , $ start1PHP_EOL ;
4344echo  'end  of stream1 is  ' , $ ending1PHP_EOL ;
44- 
45+ if  ($ stream1stream_get_contents ($ row'DATA2 ' ])) {
46+     echo  'Expected nclob value to match clob value for stream1 ' , PHP_EOL ;
47+ }
4548
4649echo  PHP_EOL , 'Test 2:  £ ' , PHP_EOL ;
4750$ string2'abc '  . str_repeat ('£ ' , 8187 ) . 'xyz ' ; // 8193 chars total is when it breaks 
4851$ id2 ;
4952$ insertbindParam (':data ' , $ string2PDO ::PARAM_STR , strlen ($ string2// length in bytes 
53+ $ insertbindParam (':data2 ' , $ string2PDO ::PARAM_STR , strlen ($ string2
5054$ insertexecute ();
5155$ selectbindParam (':id ' , $ idPDO ::PARAM_STR );
5256$ selectexecute ();
@@ -58,12 +62,15 @@ echo 'size of string2 is ', strlen($string2), ' bytes, ', mb_strlen($string2), '
5862echo  'size of stream2 is  ' , strlen ($ stream2' bytes,  ' , mb_strlen ($ stream2' chars. ' , PHP_EOL ;
5963echo  'beg  of stream2 is  ' , $ start2PHP_EOL ;
6064echo  'end  of stream2 is  ' , $ ending2PHP_EOL ;
61- 
65+ if  ($ stream2stream_get_contents ($ row'DATA2 ' ])) {
66+     echo  'Expected nclob value to match clob value for stream2 ' , PHP_EOL ;
67+ }
6268
6369echo  PHP_EOL , 'Test 3:  Җ ' , PHP_EOL ;
6470$ string3'abc '  . str_repeat ('Җ ' , 8187 ) . 'xyz ' ; // 8193 chars total is when it breaks 
6571$ id3 ;
6672$ insertbindParam (':data ' , $ string3PDO ::PARAM_STR , strlen ($ string3// length in bytes 
73+ $ insertbindParam (':data2 ' , $ string3PDO ::PARAM_STR , strlen ($ string3
6774$ insertexecute ();
6875$ selectbindParam (':id ' , $ idPDO ::PARAM_STR );
6976$ selectexecute ();
@@ -75,12 +82,15 @@ echo 'size of string3 is ', strlen($string3), ' bytes, ', mb_strlen($string3), '
7582echo  'size of stream3 is  ' , strlen ($ stream3' bytes,  ' , mb_strlen ($ stream3' chars. ' , PHP_EOL ;
7683echo  'beg  of stream3 is  ' , $ start3PHP_EOL ;
7784echo  'end  of stream3 is  ' , $ ending3PHP_EOL ;
78- 
85+ if  ($ stream3stream_get_contents ($ row'DATA2 ' ])) {
86+     echo  'Expected nclob value to match clob value for stream3 ' , PHP_EOL ;
87+ }
7988
8089echo  PHP_EOL , 'Test 4:  の ' , PHP_EOL ;
8190$ string4'abc '  . str_repeat ('の ' , 8187 ) . 'xyz ' ; // 8193 chars total is when it breaks 
8291$ id4 ;
8392$ insertbindParam (':data ' , $ string4PDO ::PARAM_STR , strlen ($ string4// length in bytes 
93+ $ insertbindParam (':data2 ' , $ string4PDO ::PARAM_STR , strlen ($ string4
8494$ insertexecute ();
8595$ selectbindParam (':id ' , $ idPDO ::PARAM_STR );
8696$ selectexecute ();
@@ -92,13 +102,14 @@ echo 'size of string4 is ', strlen($string4), ' bytes, ', mb_strlen($string4), '
92102echo  'size of stream4 is  ' , strlen ($ stream4' bytes,  ' , mb_strlen ($ stream4' chars. ' , PHP_EOL ;
93103echo  'beg  of stream4 is  ' , $ start4PHP_EOL ;
94104echo  'end  of stream4 is  ' , $ ending4PHP_EOL ;
105+ if  ($ stream4stream_get_contents ($ row'DATA2 ' ])) {
106+     echo  'Expected nclob value to match clob value for stream4 ' , PHP_EOL ;
107+ }
95108?> 
96- --XFAIL--
97- Fails due to Bug 60994
98109--EXPECT--
99110Test 1:  j
100- size of string1 is 1000006  bytes, 1000006  chars.
101- size of stream1 is 1000006  bytes, 1000006  chars.
111+ size of string1 is 8193  bytes, 8193  chars.
112+ size of stream1 is 8193  bytes, 8193  chars.
102113beg  of stream1 is abcjjjjjjj
103114end  of stream1 is jjjjjjjxyz
104115
0 commit comments