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