summaryrefslogtreecommitdiff
path: root/ext/sqlite/tests/sqlite_last_error_error.phpt
blob: c930048365a4663cacfe2498e28a25b11964e152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--TEST--
Test sqlite_last_error() function : error conditions 
--SKIPIF--
<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
--FILE--
<?php
/* Prototype  : int sqlite_last_error(resource db)
 * Description: Returns the error code of the last error for a database. 
 * Source code: ext/sqlite/sqlite.c
 * Alias to functions: 
 */

echo "*** Testing sqlite_last_error() : error conditions ***\n";

// Zero arguments
echo "\n-- Testing sqlite_last_error() function with Zero arguments --\n";
var_dump( sqlite_last_error() );

//Test sqlite_last_error with one more than the expected number of arguments
echo "\n-- Testing sqlite_last_error() function with more than expected no. of arguments --\n";

$db = sqlite_open(':memory:');
$extra_arg = 10;
var_dump( sqlite_last_error($db, $extra_arg) );
sqlite_close($db);

$db = new SQLiteDatabase(':memory:');
var_dump( $db->lastError($extra_arg) );

?>
===DONE===
--EXPECTF--
*** Testing sqlite_last_error() : error conditions ***

-- Testing sqlite_last_error() function with Zero arguments --

Warning: sqlite_last_error() expects exactly 1 parameter, 0 given in %s on line %d
NULL

-- Testing sqlite_last_error() function with more than expected no. of arguments --

Warning: sqlite_last_error() expects exactly 1 parameter, 2 given in %s on line %d
NULL

Warning: SQLiteDatabase::lastError() expects exactly 0 parameters, 1 given in %s on line %d
NULL
===DONE===