3 require_once("../lib/lib.php");
5 db_createTable("table1", 4);
6 db_createTable("table2", 4);
7 db_createTable("table3", 4);
9 if(db_tableExists("table1")) echo "table 1 exists - correct\n";
10 else echo "table 1 not exists - wrong\n";
12 if(db_tableExists("table2")) echo "table 2 exists - correct\n";
13 else echo "table 2 not exists - wrong\n";
15 if(db_tableExists("table3")) echo "table 3 exists - correct\n";
16 else echo "table 3 not exists - wrong\n";
18 if(db_tableExists("table4")) echo "table 4 exists - wrong\n";
19 else echo "table 4 not exists - correct\n";
21 // now insert data test
22 db_insertData("table1", "data1", "data2", "data3", "data4");
24 // now try and do a gettables
25 echo "tabs looks like:\n";
26 $tabs = db_getTables();
30 $ret = db_selectData("table1", "1", "data1");
31 echo "did select 1 on table1 and got:\n";
34 echo "looks correct\n";
40 $ret2 = db_selectData("table1", "1", "notdata1");
41 echo "did select 2 on table1 and got:\n";
46 echo "looks correct\n";
50 $ret = db_deleteData("table1", "1", "data1");
52 // now try a select again
53 $ret = db_selectData("table1", "1", "data1");
54 echo "did select 1 on table1 and got:\n";
59 echo "looks correct\n";
62 // now delete the tables
63 $ret = db_deleteTable("table1");
64 $ret = db_deleteTable("table2");
65 $ret = db_deleteTable("table3");
67 if(db_tableExists("table1")) echo "table 1 exists - wrong\n";
68 else echo "table 1 not exists - correct\n";
70 if(db_tableExists("table2")) echo "table 2 exists - wrong\n";
71 else echo "table 2 not exists - correct\n";
73 if(db_tableExists("table3")) echo "table 3 exists - wrong\n";
74 else echo "table 3 not exists - correct\n";