xref: /PHP-7.1/ext/pdo_sqlite/tests/bug70862.phpt (revision cff9e16a)
1--TEST--
2PDO_sqlite: Testing sqliteCreateCollation()
3--SKIPIF--
4<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
5--FILE--
6<?php
7
8$db = new pdo('sqlite::memory:');
9$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
10
11$db->exec('CREATE TABLE test(field BLOB)');
12
13$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
14$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
15
16class HelloWrapper {
17	public function stream_open() { return true; }
18	public function stream_eof() { return true; }
19	public function stream_read() { return NULL; }
20	public function stream_stat() { return array(); }
21}
22stream_wrapper_register("hello", "HelloWrapper");
23
24$f = fopen("hello://there", "r");
25
26$stmt = $db->prepare('INSERT INTO test(field) VALUES (:para)');
27$stmt->bindParam(":para", $f, PDO::PARAM_LOB);
28$stmt->execute();
29
30var_dump($f);
31
32?>
33+++DONE+++
34--EXPECTF--
35string(0) ""
36+++DONE+++
37