setting lock bucket mutex name
[csql.git] / test / phptests / odbc_error.php
blob8acd37da0b2d7babe44d772dc976f2aae16fe1ee
1 <html>
2 <body>
3 /*Testing odbc_error() and odbc_errormsg() for error handeling */
4 <?php
5 $conn=odbc_connect('mycsql','root','manager');
6 if (!$conn)
7 {echo "Connection Failed"; exit(1);}
9 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT, f2 CHAR(20),f3 SMALLINT,f4 BIGINT,f5 FLOAT, f6 DOUBLE,f7 DATE, f8 TIMESTAMP );");
10 $res = odbc_execute($sth);
11 if (!$res)
12 {echo "Error in Creation"; exit(2);}
13 echo "Table Created\n";
15 $query1 = "INSERT INTO t1(f1,f3,f4) values(10,1,100001);";
16 odbc_exec($conn,$query1);
17 if (odbc_error())
19 echo odbc_errormsg($conn);
21 echo "Record Inserted\n";
23 $query2 = "INSERT INTO t1(f1,f2,f9) values(20,'BCAD',1);";
24 odbc_exec($conn,$query2);
25 if (odbc_error())
27 echo "\nINSERT INTO t1(f1,f2,f9) values(20,'BCAD',1);\n";
28 echo odbc_errormsg($conn);
30 echo "\n";
32 $sth = 'SELECT * FROM t1;';
33 $rs = odbc_exec($conn, $sth);
34 if (!$rs)
35 {echo "Error in SQL-2";exit(3);}
36 odbc_result_all($rs, 'border = 5');
38 $sth=odbc_prepare($conn,"DROP TABLE t1;");
39 $res = odbc_execute($sth);
40 if (!$res)
41 {exit("\nError in Drop Table");}
42 echo "\nTable Dropped \nTest Passed";
43 odbc_close($conn);
46 </body>
47 </html>