Annotation of embedaddon/php/ext/sqlite3/tests/sqlite3_19_columninfo.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SQLite3 columnType and columnName
! 3: --SKIPIF--
! 4: <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: require_once(dirname(__FILE__) . '/new_db.inc');
! 9: define('TIMENOW', time());
! 10:
! 11: echo "Creating Table\n";
! 12: var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
! 13:
! 14: echo "INSERT into table\n";
! 15: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
! 16: var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
! 17:
! 18: echo "SELECTING results\n";
! 19: $result = $db->query("SELECT * FROM test ORDER BY id ASC");
! 20: while ($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:
! 28: echo "Closing database\n";
! 29: var_dump($db->close());
! 30: echo "Done\n";
! 31: ?>
! 32: --EXPECTF--
! 33: Creating Table
! 34: bool(true)
! 35: INSERT into table
! 36: bool(true)
! 37: bool(true)
! 38: SELECTING results
! 39: Name: time - Type: 1
! 40: Name: id - Type: 3
! 41: Name: time - Type: 1
! 42: Name: id - Type: 3
! 43: Closing database
! 44: bool(true)
! 45: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>