adding test scripts
[csql.git] / test / sqlapi / Select / selecttest9.c
blob1ec7cb283193b3dbd48c2b9d3eb7af0c19bbfdd9
1 /* prepare,execute,prepare....,
2 * second prepare should pass.
4 * Author : Jitendra Lenka
5 */
7 #include"common.h"
9 int main()
11 DbRetVal rv = OK;
12 AbsSqlConnection *con = createConnection();
13 rv = con->connect("root","manager");
14 if(rv!=OK)return 1;
15 AbsSqlStatement *stmt = createStatement();
16 stmt->setConnection(con);
17 char statement[200];
18 strcpy(statement,"CREATE TABLE T1(F1 INT,F2 CHAR(20));");
19 int rows=0;
20 rv = stmt->prepare(statement);
21 if(rv!=OK) { delete stmt; delete con; return 1; }
22 printf("Prepared the statement\n");
23 rv = stmt->execute(rows);
24 if(rv!=OK) { delete stmt; delete con; return 2; }
25 printf("Execute the statement\n");
26 //again prepare
27 strcpy(statement,"DROP TABLE T1;");
28 rv = stmt->prepare(statement);
29 if(rv!=OK) {
30 printf("Test script failed\n");
31 delete stmt; delete con; return 3;
33 printf("Test script passed\n");
34 stmt->execute(rows);
35 stmt->free(); delete stmt; delete con;
36 return 0;