Annotation of embedaddon/php/ext/oci8/tests/lob_017.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: returning multiple lobs (using persistent connection)
! 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: $c = oci_pconnect($user, $password, $dbase);
! 14:
! 15: $drop = "DROP table lob_test";
! 16: $statement = oci_parse($c, $drop);
! 17: @oci_execute($statement);
! 18:
! 19: $create = "CREATE table lob_test(lob_1 BLOB, lob_2 BLOB)";
! 20: $statement = oci_parse($c, $create);
! 21: oci_execute($statement);
! 22:
! 23: $init = "INSERT INTO lob_test VALUES(EMPTY_BLOB(), EMPTY_BLOB())";
! 24: $statement = oci_parse($c, $init);
! 25: oci_execute($statement);
! 26:
! 27: $select = "SELECT * FROM lob_test FOR UPDATE";
! 28: $statement = oci_parse($c, $select);
! 29: oci_execute($statement, OCI_DEFAULT);
! 30:
! 31: $row = oci_fetch_assoc($statement);
! 32:
! 33: $row['LOB_1']->write("first");
! 34: $row['LOB_2']->write("second");
! 35:
! 36: unset($row);
! 37:
! 38: oci_commit($c);
! 39:
! 40: $select = "SELECT * FROM lob_test FOR UPDATE";
! 41: $statement = oci_parse($c, $select);
! 42: oci_execute($statement, OCI_DEFAULT);
! 43:
! 44: $row = oci_fetch_assoc($statement);
! 45:
! 46: var_dump($row);
! 47: var_dump($row['LOB_1']->load());
! 48: var_dump($row['LOB_2']->load());
! 49:
! 50: $drop = "DROP table lob_test";
! 51: $statement = oci_parse($c, $drop);
! 52: @oci_execute($statement);
! 53:
! 54: echo "Done\n";
! 55:
! 56: ?>
! 57: --EXPECTF--
! 58: array(2) {
! 59: ["LOB_1"]=>
! 60: object(OCI-Lob)#%d (1) {
! 61: ["descriptor"]=>
! 62: resource(%d) of type (oci8 descriptor)
! 63: }
! 64: ["LOB_2"]=>
! 65: object(OCI-Lob)#%d (1) {
! 66: ["descriptor"]=>
! 67: resource(%d) of type (oci8 descriptor)
! 68: }
! 69: }
! 70: string(5) "first"
! 71: string(6) "second"
! 72: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>