@@ -18,18 +18,19 @@ $dbh->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL);
18
18
$ dbh ->setAttribute (PDO ::ATTR_STRINGIFY_FETCHES , false );
19
19
20
20
@$ dbh ->exec ('DROP TABLE pdo_oci_bug60994 ' );
21
- $ dbh ->exec ('CREATE TABLE pdo_oci_bug60994 (id NUMBER, data CLOB) ' );
21
+ $ dbh ->exec ('CREATE TABLE pdo_oci_bug60994 (id NUMBER, data CLOB, data2 NCLOB ) ' );
22
22
23
23
$ id = null ;
24
- $ insert = $ dbh ->prepare ('INSERT INTO pdo_oci_bug60994 (id, data) VALUES (:id, :data) ' );
24
+ $ insert = $ dbh ->prepare ('INSERT INTO pdo_oci_bug60994 (id, data, data2 ) VALUES (:id, :data, :data2 ) ' );
25
25
$ insert ->bindParam (':id ' , $ id , \PDO ::PARAM_STR );
26
- $ select = $ dbh ->prepare ("SELECT data FROM pdo_oci_bug60994 WHERE id = :id " );
26
+ $ select = $ dbh ->prepare ("SELECT data, data2 FROM pdo_oci_bug60994 WHERE id = :id " );
27
27
28
28
29
29
echo PHP_EOL , 'Test 1: j ' , PHP_EOL ;
30
30
$ string1 = 'abc ' . str_repeat ('j ' , 8187 ) . 'xyz ' ; // 8193 chars total works fine here (even 1 million works fine, subject to memory_limit)
31
31
$ id = 1 ;
32
32
$ insert ->bindParam (':data ' , $ string1 , \PDO ::PARAM_STR , strlen ($ string1 )); // length in bytes
33
+ $ insert ->bindParam (':data2 ' , $ string1 , \PDO ::PARAM_STR , strlen ($ string1 ));
33
34
$ insert ->execute ();
34
35
$ select ->bindParam (':id ' , $ id , \PDO ::PARAM_STR );
35
36
$ select ->execute ();
@@ -41,12 +42,15 @@ echo 'size of string1 is ', strlen($string1), ' bytes, ', mb_strlen($string1), '
41
42
echo 'size of stream1 is ' , strlen ($ stream1 ), ' bytes, ' , mb_strlen ($ stream1 ), ' chars. ' , PHP_EOL ;
42
43
echo 'beg of stream1 is ' , $ start1 , PHP_EOL ;
43
44
echo 'end of stream1 is ' , $ ending1 , PHP_EOL ;
44
-
45
+ if ($ string1 != $ stream1 || $ stream1 != stream_get_contents ($ row ['DATA2 ' ])) {
46
+ echo 'Expected nclob value to match clob value for stream1 ' , PHP_EOL ;
47
+ }
45
48
46
49
echo PHP_EOL , 'Test 2: £ ' , PHP_EOL ;
47
50
$ string2 = 'abc ' . str_repeat ('£ ' , 8187 ) . 'xyz ' ; // 8193 chars total is when it breaks
48
51
$ id = 2 ;
49
52
$ insert ->bindParam (':data ' , $ string2 , \PDO ::PARAM_STR , strlen ($ string2 )); // length in bytes
53
+ $ insert ->bindParam (':data2 ' , $ string2 , \PDO ::PARAM_STR , strlen ($ string2 ));
50
54
$ insert ->execute ();
51
55
$ select ->bindParam (':id ' , $ id , \PDO ::PARAM_STR );
52
56
$ select ->execute ();
@@ -58,12 +62,15 @@ echo 'size of string2 is ', strlen($string2), ' bytes, ', mb_strlen($string2), '
58
62
echo 'size of stream2 is ' , strlen ($ stream2 ), ' bytes, ' , mb_strlen ($ stream2 ), ' chars. ' , PHP_EOL ;
59
63
echo 'beg of stream2 is ' , $ start2 , PHP_EOL ;
60
64
echo 'end of stream2 is ' , $ ending2 , PHP_EOL ;
61
-
65
+ if ($ string2 != $ stream2 || $ stream2 != stream_get_contents ($ row ['DATA2 ' ])) {
66
+ echo 'Expected nclob value to match clob value for stream2 ' , PHP_EOL ;
67
+ }
62
68
63
69
echo PHP_EOL , 'Test 3: Җ ' , PHP_EOL ;
64
70
$ string3 = 'abc ' . str_repeat ('Җ ' , 8187 ) . 'xyz ' ; // 8193 chars total is when it breaks
65
71
$ id = 3 ;
66
72
$ insert ->bindParam (':data ' , $ string3 , \PDO ::PARAM_STR , strlen ($ string3 )); // length in bytes
73
+ $ insert ->bindParam (':data2 ' , $ string3 , \PDO ::PARAM_STR , strlen ($ string3 ));
67
74
$ insert ->execute ();
68
75
$ select ->bindParam (':id ' , $ id , \PDO ::PARAM_STR );
69
76
$ select ->execute ();
@@ -75,12 +82,15 @@ echo 'size of string3 is ', strlen($string3), ' bytes, ', mb_strlen($string3), '
75
82
echo 'size of stream3 is ' , strlen ($ stream3 ), ' bytes, ' , mb_strlen ($ stream3 ), ' chars. ' , PHP_EOL ;
76
83
echo 'beg of stream3 is ' , $ start3 , PHP_EOL ;
77
84
echo 'end of stream3 is ' , $ ending3 , PHP_EOL ;
78
-
85
+ if ($ string3 != $ stream3 || $ stream3 != stream_get_contents ($ row ['DATA2 ' ])) {
86
+ echo 'Expected nclob value to match clob value for stream3 ' , PHP_EOL ;
87
+ }
79
88
80
89
echo PHP_EOL , 'Test 4: の ' , PHP_EOL ;
81
90
$ string4 = 'abc ' . str_repeat ('の ' , 8187 ) . 'xyz ' ; // 8193 chars total is when it breaks
82
91
$ id = 4 ;
83
92
$ insert ->bindParam (':data ' , $ string4 , \PDO ::PARAM_STR , strlen ($ string4 )); // length in bytes
93
+ $ insert ->bindParam (':data2 ' , $ string4 , \PDO ::PARAM_STR , strlen ($ string4 ));
84
94
$ insert ->execute ();
85
95
$ select ->bindParam (':id ' , $ id , \PDO ::PARAM_STR );
86
96
$ select ->execute ();
@@ -92,13 +102,14 @@ echo 'size of string4 is ', strlen($string4), ' bytes, ', mb_strlen($string4), '
92
102
echo 'size of stream4 is ' , strlen ($ stream4 ), ' bytes, ' , mb_strlen ($ stream4 ), ' chars. ' , PHP_EOL ;
93
103
echo 'beg of stream4 is ' , $ start4 , PHP_EOL ;
94
104
echo 'end of stream4 is ' , $ ending4 , PHP_EOL ;
105
+ if ($ string4 != $ stream4 || $ stream4 != stream_get_contents ($ row ['DATA2 ' ])) {
106
+ echo 'Expected nclob value to match clob value for stream4 ' , PHP_EOL ;
107
+ }
95
108
?>
96
- --XFAIL--
97
- Fails due to Bug 60994
98
109
--EXPECT--
99
110
Test 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.
102
113
beg of stream1 is abcjjjjjjj
103
114
end of stream1 is jjjjjjjxyz
104
115
0 commit comments