adding test scripts
[csql.git] / test / phptests / paradelete.php
blob73c12d67f2fe885582efdfcd5fd9c58fc8edb0d4
1 <html>
2 <body>
3 /*Parateterised delete*/
4 <?php
5 $conn=odbc_connect('mycsql','root','manager');
6 if (!$conn)
8 echo "Connection Failed";
9 exit(1);
12 $res = odbc_exec($conn,"CREATE TABLE t1(f1 INT, f2 CHAR(20),f3 int);");
13 if (!$res)
15 echo "Error in Creation";
16 exit(2);
18 echo "Table Created\n";
20 $res = odbc_exec($conn,"INSERT INTO t1 values(10,'ABCD',1);");
21 if (!$res)
23 echo "Error in Creation";
24 exit(3);
26 echo "Table Created\n";
28 $res = odbc_exec($conn,"INSERT INTO t1 values(20,'PQRS',2);");
29 if (!$res)
31 echo "Error in Creation";
32 exit(4);
34 echo "Table Created\n";
36 $sth = 'SELECT * FROM t1;';
37 $rs = odbc_exec($conn, $sth);
38 if (!$rs)
40 echo "Error in SQL-2";
41 exit(5);
43 odbc_result_all($rs, 'border = 5');
45 $q = "DELETE FROM t1 WHERE f1=?;";
46 $res = odbc_prepare ($conn, $q);
47 $a = 10;
48 $exc = odbc_execute($res, array($a));
49 if (!$rs)
51 exit(6);
54 $sth = 'SELECT * FROM t1;';
55 $rs = odbc_exec($conn, $sth);
56 if (!$rs)
57 {exit("Error in SQL-2");}
58 odbc_result_all($rs, 'border = 5');
60 $sth=odbc_prepare($conn,"DROP TABLE t1;");
61 $res = odbc_execute($sth);
62 if (!$res)
63 {exit("\nError in Drop Table");}
64 echo "\nTable Dropped \nTest Passed";
65 odbc_close($conn);
68 </body>
69 </html>