felipe Sun May 17 16:51:59 2009 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/sqlite3/tests sqlite3_02_open.phpt
sqlite3_31_changes.phpt
sqlite3_31_open.phpt
sqlite3_32_changes.phpt
sqlite3_32_createAggregate_paramCount.phpt
sqlite3_32_last_insert_rowid_param.phpt
sqlite3_33_createAggregate_notcallable.phpt
sqlite3_33_load_extension_param.phpt
sqlite3_33_reset.phpt
sqlite3_34_load_extension_ext_dir.phpt
sqlite3_close_error.phpt
sqlite3_close_with_params.phpt
sqlite3_enable_exceptions.phpt
sqlite3_exec_wrongparams.phpt
sqlite3_lasterrorcode_with_params.phpt
sqlite3_lasterrormsg_with_params.phpt
sqlite3_loadextension_with_wrong_param.phpt
sqlite3_open_empty_string.phpt
sqlite3_openblob_wrongparams.phpt
sqlite3_prepare_faultystmt.phpt
sqlite3_prepare_with_empty_string.phpt
sqlite3_prepare_wrongparams.phpt
sqlite3_prepared_stmt_clear_with_params.phpt
sqlite3_query_error.phpt
sqlite3_querysingle_error.phpt
sqlite3_version_noparam.phpt
sqlite3result_fetcharray_with_two_params_fails.phpt
sqlite3result_numcolumns_error.phpt
sqlite3result_reset_with_params_fails.phpt
sqlite3stmt_reset_params.phpt
Log:
- New tests (testfest BelgiumUG)
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_02_open.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_02_open.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_02_open.phpt
--TEST--
SQLite3::open test, testing for function parameters
--CREDITS--
Felix De Vliegher
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
try {
$db = new SQLite3();
} catch (Exception $e) {
var_dump($e->getMessage());
}
?>
--EXPECTF--
%string|unicode%(60) "SQLite3::__construct() expects at least 1 parameter, 0
given"
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_31_changes.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_31_changes.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_31_changes.phpt
--TEST--
SQLite3::changes (parameters) tests
--CREDITS--
Ward Hus
#...@php TESTFEST 2009 (BELGIUM)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db);
var_dump($db->changes());
echo "Done\n";
?>
--EXPECTF--
object(SQLite3)#1 (0) {
}
int(0)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_31_open.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_31_open.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_31_open.phpt
--TEST--
SQLite3::re-initialize object tests
--CREDITS--
Jelle Lampaert
#Belgian Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
try {
$db = new SQLite3('db1.db');
$db->open('db1.db');
} catch (Exception $ex) {
var_dump($ex->getMessage());
}
?>
--EXPECTF--
%string|unicode%(29) "Already initialised DB Object"
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_32_changes.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_32_changes.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_32_changes.phpt
--TEST--
SQLite3::changes empty str tests
--CREDITS--
Ward Hus
#@ PHP TESTFEST 2009 (BELGIUM)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
//$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE pageView(id INTEGER PRIMARY KEY, page CHAR(256), access
INTEGER(10))');
$db->exec('INSERT INTO pageView (page, access) VALUES (\'test\', \'000000\')');
echo $db->changes("dummy");
?>
--EXPECTF--
Warning: SQLite3::changes() expects exactly 0 parameters, 1 given in %s on line
%d
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt
--TEST--
SQLite3::createAggregate Test that an error is thrown when no parameters are
present
--CREDIT--
James Cauwelier
# Belgium PHP TestFest
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->createAggregate ();
$db->close();
echo "Done"
?>
--EXPECTF--
Warning: SQLite3::createAggregate() expects at least 3 parameters, 0 given in
%s on line %d
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt
--TEST--
SQLite3::lastInsertRowID parameter test
--CREDITS--
Jelle Lampaert
#Belgian Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
echo "Creating Table\n";
var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
echo "Inserting data\n";
var_dump($db->exec('INSERT INTO test (time, id) VALUES(2, 1)'));
echo "Request last inserted id\n";
try {
$db->lastInsertRowID("");
} catch (Exception $ex) {
var_dump($ex->getMessage());
}
echo "Closing database\n";
var_dump($db->close());
echo "Done";
?>
--EXPECTF--
Creating Table
bool(true)
Inserting data
bool(true)
Request last inserted id
Warning: SQLite3::lastInsertRowID() expects exactly 0 parameters, %d given in
%s on line %d
Closing database
bool(true)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
--TEST--
SQLite3::createAggregate() Test whether a supplied PHP function is valid when
using in an aggregate function
--CREDIT--
James Cauwelier
# Belgium PHP TestFest (2009)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
function aggregate_step ($var) { return $var; }
function aggregate_final ($var) { return $var; }
$db = new SQLite3(':memory:');
$db->createAggregate ('TESTAGGREGATE', 'aggregate_test_step',
'aggregate_final');
$db->createAggregate ('TESTAGGREGATE2', 'aggregate_step',
'aggregate_test_final');
var_dump($db->createAggregate ('TESTAGGREGATE3', 'aggregate_step',
'aggregate_final'));
$db->close();
echo "Done"
?>
--EXPECTF--
Warning: SQLite3::createAggregate(): Not a valid callback function
aggregate_test_step in %s on line %d
Warning: SQLite3::createAggregate(): Not a valid callback function
aggregate_test_final in %s on line %d
bool(true)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
--TEST--
SQLite3::loadExtension with empty extension test
--CREDITS--
Jelle Lampaert
#Belgian Testfest 2009
--INI--
sqlite3.extension_dir=/tmp
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
try {
$db->loadExtension("");
} catch (Extension $ex) {
var_dump($ex->getMessage());
}
?>
--EXPECTF--
Warning: SQLite3::loadExtension(): Empty string as an extension in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_33_reset.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_33_reset.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_33_reset.phpt
--TEST--
SQLite3:: reset
--CREDITS--
Ward Hus & James Cauwelier
#@ PHP TESTFEST 2009 (BELGIUM)
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
$stmt->reset("dummy");
$stmt->reset();
//var_dump($db);
//var_dump($db->close());
echo "Done\n";
?>
--EXPECTF--
Warning: SQLite3Stmt::reset() expects exactly 0 parameters, 1 given in %s on
line %d
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
--TEST--
SQLite3::loadExtension with disabled extensions
--CREDITS--
Jelle Lampaert
#Belgian Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
try {
$db->loadExtension("");
} catch (Extension $ex) {
var_dump($ex->getMessage());
}
?>
--EXPECTF--
Warning: SQLite3::loadExtension(): SQLite Extension are disabled in %s on line
%d
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_close_error.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_close_error.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_close_error.phpt
--TEST--
SQLite3::close parameters
--CREDITS--
Jachim Coudenys
# TestFest 2009 Belgium
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
echo 'Testing SQLite3 close with one parameter' . PHP_EOL;
$db->close('parameter');
echo "Done";
?>
--EXPECTF--
Testing SQLite3 close with one parameter
Warning: SQLite3::close() expects exactly 0 parameters, 1 given in %s on line %d
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_close_with_params.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_close_with_params.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_close_with_params.phpt
--TEST--
SQLite3::close test with parameters
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->close('invalid argument'));
echo "Done\n";
?>
--EXPECTF--
Warning: SQLite3::close() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
--TEST--
SQLite3::enableExceptions test
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->enableExceptions(true));
try{
$db->query("SELECT * FROM non_existent_table");
} catch(Exception $e) {
echo $e->getMessage().PHP_EOL;
}
var_dump($db->enableExceptions(false));
$db->query("SELECT * FROM non_existent_table");
var_dump($db->enableExceptions("wrong_type","wrong_type"));
echo "Closing database\n";
var_dump($db->close());
echo "Done\n";
?>
--EXPECTF--
NULL
no such table: non_existent_table
NULL
Warning: SQLite3::query(): no such table: non_existent_table in %s on line %d
Warning: SQLite3::enableExceptions() expects at most 1 parameter, 2 given in %s
on line %d
NULL
Closing database
bool(true)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt
--TEST--
SQLite3::exec test, testing for wrong type parameters
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec(array ('a','b','c'), 20090509);
?>
--EXPECTF--
Warning: SQLite3::exec() expects exactly 1 parameter, 2 given in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt
--TEST--
SQLite3::lastErrorCode test with parameters
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->lastErrorCode('invalid argument'));
echo "Done\n";
?>
--EXPECTF--
Warning: SQLite3::lastErrorCode() expects exactly 0 parameters, 1 given in %s
on line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt
--TEST--
SQLite3::lastErrorMsg test with parameters
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->lastErrorMsg('invalid argument'));
echo "Done\n";
?>
--EXPECTF--
Warning: SQLite3::lastErrorMsg() expects exactly 0 parameters, 1 given in %s on
line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt
--TEST--
SQLite3::loadExtension test with wrong parameter type
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->loadExtension(array()));
echo "Done\n";
?>
--EXPECTF--
Warning: SQLite3::loadExtension() expects parameter 1 to be
%binary_string_optional%, array given in %s on line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_open_empty_string.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_open_empty_string.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_open_empty_string.phpt
--TEST--
SQLite3::open test with empty string argument via the constructor
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--FILE--
<?php
try{
$db = new SQLite3('');
} catch(Exception $e) {
echo $e->getMessage().PHP_EOL;
}
echo "Done\n";
?>
--EXPECTF--
Unable to expand filepath
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt
--TEST--
SQLite3::blobOpen test, testing stream with wrong parameter count
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?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);
}
}
$db = new SQLite3(':memory:');
stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable
to register sqliteBlobTest stream");
echo "Creating table: " . var_export($db->exec('CREATE TABLE test (id STRING,
data BLOB)'),true) . "\n";
echo "PREPARING insert\n";
$insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (?, ?)");
echo "BINDING Parameters:\n";
var_dump($insert_stmt->bindValue(1, 'a', SQLITE3_TEXT));
var_dump($insert_stmt->bindValue(2, 'TEST TEST', SQLITE3_BLOB));
$insert_stmt->execute();
echo "Closing statement: " . var_export($insert_stmt->close(), true) . "\n";
echo "Open BLOB with wrong parameter count\n";
$stream = $db->openBlob();
var_dump($stream);
echo "Done\n";
?>
--EXPECTF--
Creating table: true
PREPARING insert
BINDING Parameters:
bool(true)
bool(true)
Closing statement: true
Open BLOB with wrong parameter count
Warning: SQLite3::openBlob() expects at least 3 parameters, 0 given in %s on
line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt
--TEST--
SQLite3::prepare test, testing for faulty statement
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
$stmt = $db->prepare('SELECT foo FROM bar');
var_dump($stmt);
?>
--EXPECTF--
Warning: SQLite3::prepare(): Unable to prepare statement: 1, no such table: bar
in %s on line %d
bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt
--TEST--
SQLite3::prepare test with empty string argument
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
var_dump($db->prepare(''));
echo "Done\n";
?>
--EXPECTF--
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt
--TEST--
SQLite3::prepare test, testing for wrong parameters
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
$stmt = $db->prepare();
?>
--EXPECTF--
Warning: SQLite3::prepare() expects exactly 1 parameter, 0 given in %s on line
%d
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt
--TEST--
SQLite3Stmt::clear test with parameters
--CREDITS--
Thijs Feryn <[email protected]>
#TestFest PHPBelgium 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
define('TIMENOW', time());
echo "Creating Table\n";
$db->exec('CREATE TABLE test (time INTEGER, id STRING)');
echo "INSERT into table\n";
var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ",
'b')"));
echo "SELECTING results\n";
$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
var_dump($stmt->clear('invalid argument'));
echo "Closing database\n";
var_dump($db->close());
echo "Done\n";
?>
--EXPECTF--
Creating Table
INSERT into table
bool(true)
SELECTING results
Warning: SQLite3Stmt::clear() expects exactly 0 parameters, 1 given in %s on
line %d
NULL
Closing database
bool(true)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_query_error.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_query_error.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_query_error.phpt
--TEST--
SQLite3::query parameters
--CREDITS--
Jachim Coudenys
# TestFest 2009 Belgium
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
echo 'Testing SQLite3 query without parameters' . PHP_EOL;
$db->query();
echo 'Testing SQLite3 query with one array parameter' . PHP_EOL;
$db->query(array());
echo 'Testing SQLite3 qeury with empty string parameter' . PHP_EOL;
var_dump($db->query(''));
echo "Done";
?>
--EXPECTF--
Testing SQLite3 query without parameters
Warning: SQLite3::query() expects exactly 1 parameter, 0 given in %s on line %d
Testing SQLite3 query with one array parameter
Warning: SQLite3::query() expects parameter 1 to be %binary_string_optional%,
array given in %s on line %d
Testing SQLite3 qeury with empty string parameter
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_querysingle_error.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_querysingle_error.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_querysingle_error.phpt
--TEST--
SQLite3::query parameters
--CREDITS--
Jachim Coudenys
# TestFest 2009 Belgium
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
echo 'Testing SQLite3 querySingle without parameters' . PHP_EOL;
$db->querySingle();
echo 'Testing SQLite3 querySingle with one array parameter' . PHP_EOL;
$db->querySingle(array());
echo 'Testing SQLite3 qeurySingle with empty string parameter' . PHP_EOL;
var_dump($db->querySingle(''));
echo "Done";
?>
--EXPECTF--
Testing SQLite3 querySingle without parameters
Warning: SQLite3::querySingle() expects at least 1 parameter, 0 given in %s on
line %d
Testing SQLite3 querySingle with one array parameter
Warning: SQLite3::querySingle() expects parameter 1 to be
%binary_string_optional%, array given in %s on line %d
Testing SQLite3 qeurySingle with empty string parameter
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_version_noparam.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_version_noparam.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_version_noparam.phpt
--TEST--
SQLite3::version test, testing for missing function parameters
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
var_dump(SQLite3::version('dummy'));
?>
--EXPECTF--
Warning: SQLite3::version() expects exactly 0 parameters, 1 given in %s on line
%d
NULL
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt?view=markup&rev=1.1
Index:
php-src/ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt
+++
php-src/ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt
--TEST--
SQLite3Result::fetchArray() test, testing two params causes a failure
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray(1,2));
?>
--EXPECTF--
Warning: SQLite3Result::fetchArray() expects at most 1 parameter, 2 given in %s
on line %d
NULL
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt
+++ php-src/ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt
--TEST--
SQLite3Result::numColumns parameters
--CREDITS--
Jachim Coudenys
# TestFest 2009 Belgium
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
echo 'Creating Table' . PHP_EOL;
var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
echo 'Inserting data' . PHP_EOL;
var_dump($db->exec('INSERT INTO test (time, id) VALUES(2, 1)'));
echo 'Fetching number of columns' . PHP_EOL;
$result = $db->query('SELECT id FROM test');
var_dump($result->numColumns('time'));
echo 'Done';
?>
--EXPECTF--
Creating Table
bool(true)
Inserting data
bool(true)
Fetching number of columns
Warning: SQLite3Result::numColumns() expects exactly 0 parameters, 1 given in
%s on line %d
NULL
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt
+++ php-src/ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt
--TEST--
SQLite3Result::reset test, testing an exception is raised when calling reset
with parameters
--CREDITS--
Michelangelo van Dam
# Belgian PHP Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");
$result = $db->query('SELECT bar FROM foo');
$result->reset(1);
?>
--EXPECTF--
Warning: SQLite3Result::reset() expects exactly 0 parameters, 1 given in %s on
line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3stmt_reset_params.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3stmt_reset_params.phpt
+++ php-src/ext/sqlite3/tests/sqlite3stmt_reset_params.phpt
--TEST--
SQLite3Stmt::reset with parameter test
--CREDITS--
Jelle Lampaert
#Belgian Testfest 2009
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$db = new SQLite3(':memory:');
echo "Creating Table\n";
var_dump($db->exec('CREATE TABLE foobar (id INTEGER, name STRING)'));
echo "INSERT into table\n";
var_dump($db->exec("INSERT INTO foobar (id, name) VALUES (1, 'john')"));
$query = "SELECT name FROM foobar WHERE id = 1";
echo "Prepare query\n";
$stmt = $db->prepare($query);
echo "Reset query\n";
try {
$stmt->reset("foo");
} catch (Exception $ex) {
var_dump($ex->getMessage());
}
echo "Closing database\n";
$stmt = null;
$result = null;
var_dump($db->close());
echo "Done\n";
?>
--EXPECTF--
Creating Table
bool(true)
INSERT into table
bool(true)
Prepare query
Reset query
Warning: SQLite3Stmt::reset() expects exactly 0 parameters, %d given in %s on
line %d
Closing database
bool(true)
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php