1--TEST--
2SQLite3 columnType and columnName
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5--FILE--
6<?php
7
8require_once(dirname(__FILE__) . '/new_db.inc');
9define('TIMENOW', time());
10
11echo "Creating Table\n";
12var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
13
14echo "INSERT into table\n";
15var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
16var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
17
18echo "SELECTING results\n";
19$result = $db->query("SELECT * FROM test ORDER BY id ASC");
20while ($row = $result->fetchArray(SQLITE3_NUM)) {
21	$totalColumns = $result->numColumns();
22	for ($i = 0; $i < $totalColumns; $i++) {
23		echo "Name: " . $result->columnName($i) . " - Type: " . $result->columnType($i) . "\n";
24	}
25}
26$result->finalize();
27
28echo "Closing database\n";
29var_dump($db->close());
30echo "Done\n";
31?>
32--EXPECTF--
33Creating Table
34bool(true)
35INSERT into table
36bool(true)
37bool(true)
38SELECTING results
39Name: time - Type: 1
40Name: id - Type: 3
41Name: time - Type: 1
42Name: id - Type: 3
43Closing database
44bool(true)
45Done
46