3 /*Default value testing */
5 $conn=odbc_connect('mycsql','root','manager');
8 echo "Connection Failed";
12 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT default 10, f2 CHAR(20),primary key(f1));");
13 $res = odbc_execute($sth);
16 echo "Error in Creation";
21 $sth = odbc_prepare($conn, "INSERT INTO t1(f1,f2) VALUES(1,'One');");
22 $res = odbc_execute($sth);
25 echo "Error in Insertion";
28 echo "\nINSERT INTO t1(f1,f2) VALUES(1,'One');";
29 echo "\nRecord Inserted";
31 $sth = odbc_prepare($conn, "INSERT INTO t1(f2) VALUES('Ten');");
32 $res = odbc_execute($sth);
35 echo "Error in Insertion";
38 echo "\nINSERT INTO t1(f2) VALUES('Ten');";
39 echo "\nRecord Inserted\n";
41 $sth = 'select * from t1;';
42 $rs = odbc_exec($conn, $sth);
45 echo "Error in SQL-2";
48 echo "\nselect executed\n";
51 $sth=odbc_prepare($conn,"DROP TABLE t1;");
52 $res = odbc_execute($sth);
55 echo "\nError in Drop Table";
58 echo "\nTable Dropped \nTest Passed";