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