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