xref: /PHP-8.1/ext/pdo_sqlite/tests/bug70862.phpt (revision 74859783)
1--TEST--
2PDO_sqlite: Testing sqliteCreateCollation()
3--EXTENSIONS--
4pdo_sqlite
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--EXPECT--
35string(0) ""
36+++DONE+++
37