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