1--TEST--
2Test sqlite_exec() function : error behaviour and functionality
3--SKIPIF--
4<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
5--FILE--
6<?php
7/* Prototype  : boolean sqlite_exec(string query, resource db[, string &error_message])
8 * Description: Executes a result-less query against a given database
9 * Source code: ext/sqlite/sqlite.c
10 * Alias to functions:
11 */
12
13echo "*** Testing sqlite_exec() : error functionality ***\n";
14
15// set up variables
16$fail = 'CRE ATE TABLE';
17$error_message = null;
18
19// procedural
20$db = sqlite_open(':memory:');
21var_dump( sqlite_exec($db, $fail, $error_message) );
22var_dump( $error_message );
23var_dump( sqlite_exec($db) );
24sqlite_close($db);
25
26// oo-style
27$db = new SQLiteDatabase(':memory:');
28var_dump( $db->queryExec($fail, $error_message, 'fooparam') );
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing sqlite_exec() : error functionality ***
34
35Warning: sqlite_exec(): near "CRE": syntax error in %s on line %d
36bool(false)
37%string|unicode%(24) "near "CRE": syntax error"
38
39Warning: sqlite_exec() expects at least 2 parameters, 1 given in %s on line %d
40NULL
41
42Warning: SQLiteDatabase::queryExec() expects at most 2 parameters, 3 given in %s on line %d
43NULL
44===DONE===
45