1--TEST--
2SQLite3::blobOpen stream test
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8require_once(dirname(__FILE__) . '/new_db.inc');
9require_once(dirname(__FILE__) . '/stream_test.inc');
10define('TIMENOW', time());
11
12echo "Creating Table\n";
13var_dump($db->exec('CREATE TABLE test (id STRING, data BLOB)'));
14
15echo "PREPARING insert\n";
16$insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (?, ?)");
17
18echo "BINDING Parameter\n";
19var_dump($insert_stmt->bindValue(1, 'a', SQLITE3_TEXT));
20var_dump($insert_stmt->bindValue(2, 'TEST TEST', SQLITE3_BLOB));
21$insert_stmt->execute();
22echo "Closing statement\n";
23var_dump($insert_stmt->close());
24$stream = $db->openBlob('test', 'data', 1);
25var_dump($stream);
26echo "Stream Contents\n";
27var_dump(stream_get_contents($stream));
28echo "Closing Stream\n";
29var_dump(fclose($stream));
30echo "Closing database\n";
31var_dump($db->close());
32echo "Done\n";
33?>
34--EXPECTF--
35Creating Table
36bool(true)
37PREPARING insert
38BINDING Parameter
39bool(true)
40bool(true)
41Closing statement
42bool(true)
43resource(%d) of type (stream)
44Stream Contents
45string(9) "TEST TEST"
46Closing Stream
47bool(true)
48Closing database
49bool(true)
50Done
51