Annotation of embedaddon/php/ext/oci8/tests/lob_037.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Fetching two different lobs and using them after fetch
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: require dirname(__FILE__).'/create_table.inc';
13:
14: /* insert the first LOB */
15: $ora_sql = "INSERT INTO
16: ".$schema.$table_name." (blob)
17: VALUES (empty_blob())
18: RETURNING
19: blob
20: INTO :v_blob ";
21:
22: $s = oci_parse($c,$ora_sql);
23: $blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
24:
25: oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
26: oci_execute($s, OCI_DEFAULT);
27:
28: var_dump($blob->write("first lob data"));
29: oci_commit($c);
30:
31: /* insert the second LOB */
32: $ora_sql = "INSERT INTO
33: ".$schema.$table_name." (blob)
34: VALUES (empty_blob())
35: RETURNING
36: blob
37: INTO :v_blob ";
38:
39: $s = oci_parse($c,$ora_sql);
40: $blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
41:
42: oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
43: oci_execute($s, OCI_DEFAULT);
44:
45: var_dump($blob->write("second lob data"));
46: oci_commit($c);
47:
48: /* select both */
49:
50: $ora_sql = "SELECT blob FROM ".$schema.$table_name;
51: $s = oci_parse($c,$ora_sql);
52: oci_execute($s, OCI_DEFAULT);
53:
54: $rows = array();
55: $rows[0] = oci_fetch_assoc($s);
56: $rows[1] = oci_fetch_assoc($s);
57:
58: var_dump($rows[0]['BLOB']->read(1000));
59: var_dump($rows[1]['BLOB']->read(1000));
60:
61: require dirname(__FILE__).'/drop_table.inc';
62:
63: echo "Done\n";
64:
65: ?>
66: --EXPECT--
67: int(14)
68: int(15)
69: string(14) "first lob data"
70: string(15) "second lob data"
71: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>