Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3::prepare Bound Variable Blob test
! 3: --SKIPIF--
! 4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: require_once(dirname(__FILE__) . '/new_db.inc');
! 9: require_once(dirname(__FILE__) . '/stream_test.inc');
! 10: define('TIMENOW', time());
! 11:
! 12: echo "Creating Table\n";
! 13: var_dump($db->exec('CREATE TABLE test (id STRING, data BLOB)'));
! 14:
! 15: echo "PREPARING insert\n";
! 16: $insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (?, ?)");
! 17:
! 18: echo "Opening blob stream\n";
! 19: $foo = fopen('sqliteBlobTest://fooo', 'r');
! 20: var_dump($foo);
! 21:
! 22: echo "BINDING Parameter\n";
! 23: var_dump($insert_stmt->bindValue(1, 'a', SQLITE3_TEXT));
! 24: var_dump($insert_stmt->bindParam(2, $foo, SQLITE3_BLOB));
! 25: $insert_stmt->execute();
! 26: echo "Closing statement\n";
! 27: var_dump($insert_stmt->close());
! 28:
! 29: echo "SELECTING results\n";
! 30: $results = $db->query("SELECT id, quote(data) AS data FROM test ORDER BY id ASC");
! 31: while ($result = $results->fetchArray(SQLITE3_NUM))
! 32: {
! 33: var_dump($result);
! 34: }
! 35: $results->finalize();
! 36:
! 37: echo "Closing database\n";
! 38: var_dump($db->close());
! 39: echo "Done\n";
! 40: ?>
! 41: --EXPECTF--
! 42: Creating Table
! 43: bool(true)
! 44: PREPARING insert
! 45: Opening blob stream
! 46: resource(%d) of type (stream)
! 47: BINDING Parameter
! 48: bool(true)
! 49: bool(true)
! 50: Closing statement
! 51: bool(true)
! 52: SELECTING results
! 53: array(2) {
! 54: [0]=>
! 55: string(1) "a"
! 56: [1]=>
! 57: string(23) "X'61626364656667006869'"
! 58: }
! 59: Closing database
! 60: bool(true)
! 61: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>