1--TEST--
2SQLite3_stmt::readOnly check
3--SKIPIF--
4<?php require_once(__DIR__ . '/skipif.inc');
5$version = SQLite3::version();
6if ($version['versionNumber'] < 3007004) {
7  die("skip");
8}
9?>
10--FILE--
11<?php
12
13require_once(__DIR__ . '/new_db.inc');
14define('TIMENOW', time());
15
16echo "Creating Table\n";
17var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
18
19echo "INSERT into table\n";
20var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
21var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
22
23echo "Checking select statement\n";
24$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
25var_dump($stmt->readOnly());
26
27echo "Checking update statement\n";
28$stmt = $db->prepare("UPDATE test SET id = 'c' WHERE id = ?");
29var_dump($stmt->readOnly());
30
31echo "Checking delete statement\n";
32$stmt = $db->prepare("DELETE FROM test");
33var_dump($stmt->readOnly());
34
35echo "Closing database\n";
36var_dump($db->close());
37echo "Done\n";
38?>
39--EXPECT--
40Creating Table
41bool(true)
42INSERT into table
43bool(true)
44bool(true)
45Checking select statement
46bool(true)
47Checking update statement
48bool(false)
49Checking delete statement
50bool(false)
51Closing database
52bool(true)
53Done
54