3 /*Create table and with all types of datatypes,Insert one valid record It Should be Passed */
6 $conn=odbc_connect('mycsql','root','manager');
9 echo "Connection Failed: " . $conn;
13 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT,f2 INT);");
14 $res = odbc_execute($sth);
17 echo "Error in Creation";
20 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES(12,120);");
21 $res = odbc_execute($sth);
24 echo "Error in Insertion";
27 $sth = 'select * from t1;';
28 $rs = odbc_exec($conn, $sth);
31 echo "Error in SQL-2";
34 odbc_result_all($rs, 'border = 5');
35 odbc_exec($conn,"DROP TABLE t1");
38 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 INT);");
39 $res = odbc_execute($sth);
42 echo "Error in Creation";
45 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES(12);");
46 $res = odbc_execute($sth);
49 echo "Error in Insertion";
52 $sth = 'select * from t1;';
53 $rs = odbc_exec($conn, $sth);
56 echo "Error in SQL-2";
59 odbc_result_all($rs, 'border = 5');
60 odbc_exec($conn,"DROP TABLE t1");
62 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 char(20));");
63 $res = odbc_execute($sth);
66 echo "Error in Creation";
69 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES('TWELVE');");
70 $res = odbc_execute($sth);
73 echo "Error in Insertion";
76 $sth = 'select * from t1;';
77 $rs = odbc_exec($conn, $sth);
80 echo "Error in SQL-2";
83 odbc_result_all($rs, 'border = 5');
84 odbc_exec($conn,"DROP TABLE t1");
86 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 SMALLINT);");
87 $res = odbc_execute($sth);
90 echo "Error in Creation";
93 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES(1);");
94 $res = odbc_execute($sth);
97 echo "Error in Insertion";
100 $sth = 'select * from t1;';
101 $rs = odbc_exec($conn, $sth);
104 echo "Error in SQL-2";
107 odbc_result_all($rs, 'border = 5');
108 odbc_exec($conn,"DROP TABLE t1");
110 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 BIGINT);");
111 $res = odbc_execute($sth);
114 echo "Error in Creation";
117 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES(10000001);");
118 $res = odbc_execute($sth);
121 echo "Error in Insertion";
124 $sth = 'select * from t1;';
125 $rs = odbc_exec($conn, $sth);
128 echo "Error in SQL-2";
131 odbc_result_all($rs, 'border = 5');
132 odbc_exec($conn,"DROP TABLE t1");
134 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 FLOAT);");
135 $res = odbc_execute($sth);
138 echo "Error in Creation";
141 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES(10.01);");
142 $res = odbc_execute($sth);
145 echo "Error in Insertion";
148 $sth = 'select * from t1;';
149 $rs = odbc_exec($conn, $sth);
152 echo "Error in SQL-2";
155 odbc_result_all($rs, 'border = 5');
156 odbc_exec($conn,"DROP TABLE t1");
158 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 DOUBLE);");
159 $res = odbc_execute($sth);
162 echo "Error in Creation";
165 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES(100001.100001);");
166 $res = odbc_execute($sth);
169 echo "Error in Insertion";
172 $sth = 'select * from t1;';
173 $rs = odbc_exec($conn, $sth);
176 echo "Error in SQL-2";
179 odbc_result_all($rs, 'border = 5');
180 odbc_exec($conn,"DROP TABLE t1");
182 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 DATE);");
183 $res = odbc_execute($sth);
186 echo "Error in Creation";
189 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES('2001-1-1');");
190 $res = odbc_execute($sth);
193 echo "Error in Insertion" ;
196 $sth = 'select * from t1;';
197 $rs = odbc_exec($conn, $sth);
200 echo "Error in SQL-2";
203 odbc_result_all($rs, 'border = 5');
204 odbc_exec($conn,"DROP TABLE t1");
206 $sth = odbc_prepare($conn,"CREATE TABLE t1(f1 TIMESTAMP);");
207 $res = odbc_execute($sth);
210 echo "Error in Creation";
213 $sth = odbc_prepare($conn, "INSERT INTO t1 VALUES('2001-11-30 01:01:01');");
214 $res = odbc_execute($sth);
217 echo "Error in Insertion";
220 $sth = 'select * from t1;';
221 $rs = odbc_exec($conn, $sth);
224 echo "Error in SQL-2";
227 odbc_result_all($rs, 'border = 5');
228 $res=odbc_exec($conn,"DROP TABLE t1");
231 echo "Error in Drop Table";
234 echo "\nTable Dropped\nTest Passed";