Annotation of embedaddon/php/ext/oci8/tests/lob_022.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: fetching the same lob several times
! 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: $drop = "DROP table lob_test";
! 14: $statement = oci_parse($c, $drop);
! 15: @oci_execute($statement);
! 16:
! 17: $create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
! 18: $statement = oci_parse($c, $create);
! 19: oci_execute($statement);
! 20:
! 21: $init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
! 22: $statement = oci_parse($c, $init);
! 23: $clob = oci_new_descriptor($c, OCI_D_LOB);
! 24: oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
! 25: oci_execute($statement, OCI_DEFAULT);
! 26: $clob->save();
! 27: oci_lob_save();
! 28: oci_lob_save($clob, "data");
! 29: unset($clob->descriptor);
! 30: oci_lob_save($clob, "data");
! 31:
! 32: oci_commit($c);
! 33:
! 34: $init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
! 35: $statement = oci_parse($c, $init);
! 36: $clob = oci_new_descriptor($c, OCI_D_LOB);
! 37: oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
! 38: oci_execute($statement, OCI_DEFAULT);
! 39: $clob->save("long data");
! 40: $clob->save("long data", -1);
! 41: $clob->save("long data", 0);
! 42:
! 43: oci_commit($c);
! 44:
! 45:
! 46: $query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
! 47: $statement = oci_parse ($c, $query);
! 48: oci_execute($statement, OCI_DEFAULT);
! 49:
! 50: while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
! 51: $result = $row['LOB_1']->load();
! 52: var_dump($result);
! 53: }
! 54:
! 55: $query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
! 56: $statement = oci_parse ($c, $query);
! 57: oci_execute($statement, OCI_DEFAULT);
! 58:
! 59: while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
! 60: $result = $row['LOB_1']->load();
! 61: var_dump($result);
! 62: }
! 63:
! 64: $drop = "DROP table lob_test";
! 65: $statement = oci_parse($c, $drop);
! 66: @oci_execute($statement);
! 67:
! 68: echo "Done\n";
! 69:
! 70: ?>
! 71: --EXPECTF--
! 72: Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d
! 73:
! 74: Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d
! 75:
! 76: Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d
! 77:
! 78: Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d
! 79: string(4) "data"
! 80: string(9) "long data"
! 81: string(9) "long data"
! 82: string(4) "data"
! 83: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>