Annotation of embedaddon/php/ext/oci8/tests/lob_044.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: oci_lob_truncate() with default parameter value
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: // Initialization
14:
15: $stmtarray = array(
16: "drop table lob_044_tab",
17: "create table lob_044_tab (blob BLOB)",
18: );
19:
20: oci8_test_sql_execute($c, $stmtarray);
21:
22:
23: // Run Test
24:
25: echo "Test 1 - truncate on insert\n";
26:
27: $s = oci_parse($c, "INSERT INTO lob_044_tab (blob) VALUES (empty_blob()) RETURNING blob INTO :v_blob ");
28: $blob = oci_new_descriptor($c, OCI_D_LOB);
29: oci_bind_by_name($s,":v_blob", $blob, -1, OCI_B_BLOB);
30: oci_execute($s, OCI_DEFAULT);
31:
32: var_dump($blob->write("this is a biiiig faaat test string. why are you reading it, I wonder? =)"));
33: var_dump($blob->seek(0));
34: var_dump($blob->read(10000));
35: var_dump($blob->truncate());
36: var_dump($blob->seek(0));
37: var_dump($blob->read(10000));
38:
39: oci_commit($c);
40:
41:
42: // Read it back
43:
44: echo "\nTest 2 - read it back\n";
45:
46: $s = oci_parse($c, "SELECT blob FROM lob_044_tab FOR UPDATE");
47: oci_execute($s, OCI_DEFAULT);
48: $row = oci_fetch_array($s);
49: var_dump($row[0]->read(10000));
50:
51: // Clean up
52:
53: $stmtarray = array(
54: "drop table lob_044_tab"
55: );
56:
57: oci8_test_sql_execute($c, $stmtarray);
58:
59: ?>
60: ===DONE===
61: <?php exit(0); ?>
62: --EXPECTF--
63: Test 1 - truncate on insert
64: int(72)
65: bool(true)
66: string(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)"
67: bool(true)
68: bool(true)
69: string(0) ""
70:
71: Test 2 - read it back
72: string(0) ""
73: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>