1<?php 2 3// Copied from ext/sqlite3/tests/stream_test.inc 4 5class PDOSQLite_Test_Stream 6{ 7 public $context; 8 private $position; 9 public static $string_length = 10; 10 public static $string = "abcdefg\0hi"; 11 12 public function stream_open($path, $mode, $options, &$opened_path) 13 { 14 $this->position = 0; 15 return true; 16 } 17 18 public function stream_read($count) 19 { 20 $ret = substr(self::$string, $this->position, $count); 21 $this->position += strlen($ret); 22 return $ret; 23 } 24 25 public function stream_write($data) 26 { 27 return 0; 28 } 29 30 public function stream_stat() 31 { 32 return array('size' => self::$string_length); 33 } 34 35 public function stream_tell() 36 { 37 return $this->position; 38 } 39 40 public function stream_eof() 41 { 42 return ($this->position >= self::$string_length); 43 } 44} 45 46stream_wrapper_register('pdosqliteBlobTest', PDOSQLite_Test_Stream::class) or die("Unable to register pdosqliteBlobTest stream"); 47