3 /*Creating table with 3 INT fields, Create unique index on single field.
4 Create possible composite unique indexes in different Combinations
7 $conn=odbc_connect('mycsql','root','manager');
10 echo "Connection Failed";
14 $sth = odbc_prepare($conn,"create table t1 (f1 int ,f2 int,f3 int );");
15 $res = odbc_execute($sth);
18 echo "Error in Table Creation";
23 $sth = odbc_prepare($conn, "create index idx1 on t1(f1) unique;");
24 $res = odbc_execute($sth);
27 echo "Error in index";
30 echo "\ncreate index idx1 on t1(f1) unique;";
31 echo "\nIndex created\n";
33 $sth = odbc_prepare($conn, "create index idx2 on t1(f1,f2) unique;");
34 $res = odbc_execute($sth);
37 echo "\ncreate index idx1 on t1(f1) unique;";
40 echo "\ncreate index idx2 on t1(f1,f2) unique;";
41 echo "\nComposite key Index created\n";
43 $sth = odbc_prepare($conn, "create index idx5 on t1(f1,f2,f3) unique;");
44 $res = odbc_execute($sth);
47 echo "\nError in index creation;";
50 echo "\ncreate index idx5 on t1(f1,f2,f3) unique;";
51 echo "\nComposite key Index created\n";
53 $res = odbc_exec($conn, "DROP TABLE t1;");
56 echo "\ncError in drop table;";
59 echo "\nTable Dropped\nTest Passed";