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