1 /* prepare,execute,free,prepare, second prepare should pass.
3 * Author : Jitendra Lenka
5 #include<SqlNwConnection.h>
6 #include<SqlNwStatement.h>
12 AbsSqlConnection
*con
= new SqlNwConnection();
13 con
->setInnerConnection(NULL
);
14 SqlNwConnection
*conn
= (SqlNwConnection
*)con
;
15 conn
->setHost("localhost", 5678);
16 rv
= con
->connect("root","manager");
19 AbsSqlStatement
*stmt
= new SqlNwStatement();
20 stmt
->setInnerStatement(NULL
);
21 stmt
->setConnection(con
);
24 strcpy(statement
,"CREATE TABLE T1(F1 INT,F2 CHAR(20));");
27 rv
= stmt
->prepare(statement
);
28 if(rv
!=OK
) { delete stmt
; delete con
; return 1; }
29 printf("Prepare the Statement\n");
30 rv
= stmt
->execute(rows
);
31 if(rv
!=OK
) { delete stmt
; delete con
; return 2; }
32 printf("Execute the Statement\n");
35 strcpy(statement
,"DROP TABLE T1;");
36 rv
= stmt
->prepare(statement
);
37 if(rv
!=OK
) { printf("Test script failed\n"); delete stmt
; delete con
; return 3; }
38 printf("Again prepare passed\n");
40 rv
= stmt
->execute(rows
);
41 if(rv
==OK
)printf("Table dropped successfully\n");