adding test scripts
[csql.git] / test / phptests / dropindextest.php
blob8d9ab970c72755b7d2787fb3318aad97d0950ea3
1 <html>
2 <body>
3 /* Creating table with 2 fields(say f1 int, f2 char(10)).
4 Create index idx1 on f1 field. Drop that index.Again create index with same name. It should be Passed.
5 check basic INSERT, SELECT */
6 <?php
7 $conn=odbc_connect('mycsql','root','manager');
8 if (!$conn)
10 echo "Connection Failed";
11 exit(1);
14 $sth = odbc_prepare($conn,"create table t1 (f1 int ,f2 char(10));");
15 $res = odbc_execute($sth);
16 if (!$res)
18 echo "Error in Table Creation";
19 exit(2);
21 echo "Table Created";
23 $sth = odbc_prepare($conn, "create index idx1 on t1(f1);");
24 $res = odbc_execute($sth);
25 if (!$res)
27 echo " error in index creation";
28 exit(3);
30 echo "\ncreate index idx1 on t1(f1);";
31 echo "\nIndex created\n";
33 $sth = odbc_prepare($conn, "drop index idx1;");
34 $res = odbc_execute($sth);
35 if (!$res)
37 odbc_exec($conn, "DROP TABLE t1;");
38 echo "\nError in Drop Index\nTest Failed\n";
39 exit(4);
41 echo "\ndrop index idx1;";
42 echo "\nIndex idx1 dropped\n";
44 $sth = odbc_prepare($conn, "create index idx1 on t1(f1);");
45 $res = odbc_execute($sth);
46 if (!$res)
48 echo "Error in index Creation";
49 exit(5);
51 echo "\ncreate index idx1 on t1(f1);";
52 echo "\nIndex created\n";
54 //$sth=odbc_prepare($conn,"DROP TABLE t1");
55 $res = odbc_exec($conn, "DROP TABLE t1;");
56 if (!$res)
58 echo "\nError in Drop Table";
59 exit(6);
61 echo "\nTable Dropped\nTest Passed";
62 odbc_close($conn);
65 </body>
66 </html>