code reorg for Transactionw!
[csql.git] / test / phptests / default.php
blobd903ed14e87d6c77995a4e3149a65b96abf58be3
1 <html>
2 <body>
3 /*Default value testing */
4 <?php
5 $conn=odbc_connect('mycsql','root','manager');
6 if (!$conn)
8 echo "Connection Failed";
9 exit(1);
12 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT default 10, f2 CHAR(20),primary key(f1));");
13 $res = odbc_execute($sth);
14 if (!$res)
16 echo "Error in Creation";
17 exit(2);
19 echo "Table Created";
21 $sth = odbc_prepare($conn, "INSERT INTO t1(f1,f2) VALUES(1,'One');");
22 $res = odbc_execute($sth);
23 if (!$res)
25 echo "Error in Insertion";
26 exit(2);
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);
33 if (!$res)
35 echo "Error in Insertion";
36 exit(3);
38 echo "\nINSERT INTO t1(f2) VALUES('Ten');";
39 echo "\nRecord Inserted\n";
41 $sth = 'select * from t1;';
42 $rs = odbc_exec($conn, $sth);
43 if (!$rs)
45 echo "Error in SQL-2";
46 exit(4);
48 echo "\nselect executed\n";
49 odbc_result_all($rs);
51 $sth=odbc_prepare($conn,"DROP TABLE t1;");
52 $res = odbc_execute($sth);
53 if (!$res)
55 echo "\nError in Drop Table";
56 exit(5);
58 echo "\nTable Dropped \nTest Passed";
59 odbc_close($conn);
62 </body>
63 </html>