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