xref: /PHP-8.1/ext/oci8/tests/bug27303_4.phpt (revision 74859783)
1--TEST--
2Bug #27303 (OCIBindByName binds numeric PHP values as characters)
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require(__DIR__."/connect.inc");
8// The bind buffer size edge cases seem to change each DB version.
9preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
10if (!(isset($matches[0]) && $matches[1] >= 12)) {
11    die("skip expected output only valid when using Oracle 12c database");
12}
13?>
14--ENV--
15NLS_LANG=
16--FILE--
17<?php
18
19require __DIR__.'/connect.inc';
20
21$create_st = array();
22$create_st[] = "drop sequence myseq";
23$create_st[] = "drop table mytab";
24$create_st[] = "create sequence myseq";
25$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
26
27oci8_test_sql_execute($c, $create_st);
28
29define('MYLIMIT', 200);
30
31$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
32
33$stid = oci_parse($c, $stmt);
34if (!$stid) { echo "Parse error"; die; }
35
36$r = oci_bind_by_name($stid, ':MYBV', $mybv, 0 );
37if (!$r) { echo "Bind error"; die; }
38
39for ($i = 1; $i < MYLIMIT; $i++) {
40    $r = oci_execute($stid, OCI_DEFAULT);
41    if (!$r) { echo "Execute error"; die; }
42    var_dump($mybv);
43}
44
45oci_commit($c);
46
47$drop_st = array();
48$drop_st[] = "drop sequence myseq";
49$drop_st[] = "drop table mytab";
50
51oci8_test_sql_execute($c, $drop_st);
52
53echo "Done\n";
54?>
55--EXPECT--
56string(1) "1"
57string(1) "2"
58string(1) "3"
59string(1) "4"
60string(1) "5"
61string(1) "6"
62string(1) "7"
63string(1) "8"
64string(1) "9"
65string(2) "10"
66string(2) "11"
67string(2) "12"
68string(2) "13"
69string(2) "14"
70string(2) "15"
71string(2) "16"
72string(2) "17"
73string(2) "18"
74string(2) "19"
75string(2) "20"
76string(2) "21"
77string(2) "22"
78string(2) "23"
79string(2) "24"
80string(2) "25"
81string(2) "26"
82string(2) "27"
83string(2) "28"
84string(2) "29"
85string(2) "30"
86string(2) "31"
87string(2) "32"
88string(2) "33"
89string(2) "34"
90string(2) "35"
91string(2) "36"
92string(2) "37"
93string(2) "38"
94string(2) "39"
95string(2) "40"
96string(2) "41"
97string(2) "42"
98string(2) "43"
99string(2) "44"
100string(2) "45"
101string(2) "46"
102string(2) "47"
103string(2) "48"
104string(2) "49"
105string(2) "50"
106string(2) "51"
107string(2) "52"
108string(2) "53"
109string(2) "54"
110string(2) "55"
111string(2) "56"
112string(2) "57"
113string(2) "58"
114string(2) "59"
115string(2) "60"
116string(2) "61"
117string(2) "62"
118string(2) "63"
119string(2) "64"
120string(2) "65"
121string(2) "66"
122string(2) "67"
123string(2) "68"
124string(2) "69"
125string(2) "70"
126string(2) "71"
127string(2) "72"
128string(2) "73"
129string(2) "74"
130string(2) "75"
131string(2) "76"
132string(2) "77"
133string(2) "78"
134string(2) "79"
135string(2) "80"
136string(2) "81"
137string(2) "82"
138string(2) "83"
139string(2) "84"
140string(2) "85"
141string(2) "86"
142string(2) "87"
143string(2) "88"
144string(2) "89"
145string(2) "90"
146string(2) "91"
147string(2) "92"
148string(2) "93"
149string(2) "94"
150string(2) "95"
151string(2) "96"
152string(2) "97"
153string(2) "98"
154string(2) "99"
155string(3) "100"
156string(3) "101"
157string(3) "102"
158string(3) "103"
159string(3) "104"
160string(3) "105"
161string(3) "106"
162string(3) "107"
163string(3) "108"
164string(3) "109"
165string(3) "110"
166string(3) "111"
167string(3) "112"
168string(3) "113"
169string(3) "114"
170string(3) "115"
171string(3) "116"
172string(3) "117"
173string(3) "118"
174string(3) "119"
175string(3) "120"
176string(3) "121"
177string(3) "122"
178string(3) "123"
179string(3) "124"
180string(3) "125"
181string(3) "126"
182string(3) "127"
183string(3) "128"
184string(3) "129"
185string(3) "130"
186string(3) "131"
187string(3) "132"
188string(3) "133"
189string(3) "134"
190string(3) "135"
191string(3) "136"
192string(3) "137"
193string(3) "138"
194string(3) "139"
195string(3) "140"
196string(3) "141"
197string(3) "142"
198string(3) "143"
199string(3) "144"
200string(3) "145"
201string(3) "146"
202string(3) "147"
203string(3) "148"
204string(3) "149"
205string(3) "150"
206string(3) "151"
207string(3) "152"
208string(3) "153"
209string(3) "154"
210string(3) "155"
211string(3) "156"
212string(3) "157"
213string(3) "158"
214string(3) "159"
215string(3) "160"
216string(3) "161"
217string(3) "162"
218string(3) "163"
219string(3) "164"
220string(3) "165"
221string(3) "166"
222string(3) "167"
223string(3) "168"
224string(3) "169"
225string(3) "170"
226string(3) "171"
227string(3) "172"
228string(3) "173"
229string(3) "174"
230string(3) "175"
231string(3) "176"
232string(3) "177"
233string(3) "178"
234string(3) "179"
235string(3) "180"
236string(3) "181"
237string(3) "182"
238string(3) "183"
239string(3) "184"
240string(3) "185"
241string(3) "186"
242string(3) "187"
243string(3) "188"
244string(3) "189"
245string(3) "190"
246string(3) "191"
247string(3) "192"
248string(3) "193"
249string(3) "194"
250string(3) "195"
251string(3) "196"
252string(3) "197"
253string(3) "198"
254string(3) "199"
255Done
256