File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sqlite3 / tests / stream_test.inc
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:02 2012 UTC (12 years, 8 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

<?php

class SQLite3_Test_Stream
{
	private $position;
	public static $string_length = 10;
	public static $string = "abcdefg\0hi";

	public function stream_open($path, $mode, $options, &$opened_path)
	{
		$this->position = 0;
		return true;
	}

	public function stream_read($count)
	{
		$ret = substr(self::$string, $this->position, $count);
		$this->position += strlen($ret);
		return $ret;
	}

	public function stream_write($data)
	{
		return 0;
	}

	public function stream_stat()
	{
		return array('size' => self::$string_length);
	}

	public function stream_tell()
	{
		return $this->position;
	}

	public function stream_eof()
	{
		return ($this->position >= self::$string_length);
	}
}

stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable to register sqliteBlobTest stream");

?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>