|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /home/pathumthani_integration/integration/common/classDB/sqlite/ |
Upload File : |
<?php
/**********************************************************************
* ezSQL initialisation for SQLite
*/
// Include ezSQL core
include_once "../shared/ez_sql_core.php";
// Include ezSQL database specific component
include_once "ez_sql_sqlite.php";
// Initialise database object and establish a connection
// at the same time - db_path / db_name
$db = new ezSQL_sqlite('./','sqlite_test.db');
// Create a table..
$db->query("CREATE TABLE test_table ( MyColumnA INTEGER PRIMARY KEY, MyColumnB TEXT(32) );");
// Insert test data
for($i=0;$i<3;++$i)
{
$db->query('INSERT INTO test_table (MyColumnB) VALUES ("'.md5(microtime()).'");');
}
// Get list of tables from current database..
$my_tables = $db->get_results("SELECT * FROM sqlite_master WHERE sql NOTNULL;");
// Print out last query and results..
$db->debug();
// Loop through each row of results..
foreach ( $my_tables as $table )
{
// Get results of DESC table..
$db->get_results("SELECT * FROM $table->name;");
// Print out last query and results..
$db->debug();
}
// Get rid of the table we created..
$db->query("DROP TABLE test_table;");
?>