Back to index

php5  5.3.10
stream_test.inc
Go to the documentation of this file.
00001 <?php
00002 
00003 class SQLite3_Test_Stream
00004 {
00005        private $position;
00006        public static $string_length = 10;
00007        public static $string = "abcdefg\0hi";
00008 
00009        public function stream_open($path, $mode, $options, &$opened_path)
00010        {
00011               $this->position = 0;
00012               return true;
00013        }
00014 
00015        public function stream_read($count)
00016        {
00017               $ret = substr(self::$string, $this->position, $count);
00018               $this->position += strlen($ret);
00019               return $ret;
00020        }
00021 
00022        public function stream_write($data)
00023        {
00024               return 0;
00025        }
00026 
00027        public function stream_stat()
00028        {
00029               return array('size' => self::$string_length);
00030        }
00031 
00032        public function stream_tell()
00033        {
00034               return $this->position;
00035        }
00036 
00037        public function stream_eof()
00038        {
00039               return ($this->position >= self::$string_length);
00040        }
00041 }
00042 
00043 stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable to register sqliteBlobTest stream");
00044 
00045 ?>