Annotation of embedaddon/php/ext/oci8/tests/bind_long.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: bind LONG field
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
6: require(dirname(__FILE__).'/skipif.inc');
7: ?>
8: --FILE--
9: <?php
10:
11: require(dirname(__FILE__)."/connect.inc");
12:
13: $stmt = oci_parse($c, "drop table phptestlng");
14: @oci_execute($stmt);
15:
16: $stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
17: oci_execute($stmt);
18:
19: echo "Test 1\n";
20:
21: $stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
22: $i=1;
23: $filetxt = file_get_contents( dirname(__FILE__)."/test.txt");
24:
25:
26: oci_bind_by_name( $stmt, ":id", $i, -1);
27: oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
28: oci_execute($stmt, OCI_DEFAULT);
29: oci_commit($c);
30:
31: $stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 1");
32: oci_execute($stmt);
33:
34: $row = oci_fetch_row($stmt);
35: var_dump(md5($row[0]));
36: var_dump(strlen($row[0]));
37:
38: echo "Test 2 - test multi chunk fetch\n";
39:
40: $stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
41: $i=2;
42: $filetxt = str_repeat($filetxt, 600);
43:
44: oci_bind_by_name( $stmt, ":id", $i, -1);
45: oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
46: oci_execute($stmt, OCI_DEFAULT);
47: oci_commit($c);
48:
49: $stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 2");
50: oci_execute($stmt);
51:
52: $row = oci_fetch_row($stmt);
53: var_dump(md5($row[0]));
54: var_dump(strlen($row[0]));
55:
56: $stmt = oci_parse($c, "drop table phptestlng");
57: oci_execute($stmt);
58:
59: echo "Done\n";
60:
61: ?>
62: --EXPECT--
63: Test 1
64: string(32) "5c7c34abf7ea51936785062dbfcaeddc"
65: int(394)
66: Test 2 - test multi chunk fetch
67: string(32) "ee2e98b977341cfb8e037066e5fcb909"
68: int(236400)
69: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>