1 // close the connection and call execute,it should fail.
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");
18 printf("Connection opened\n");
20 AbsSqlStatement
*stmt
= new SqlNwStatement();
21 stmt
->setInnerStatement(NULL
);
22 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 2; }
29 printf("prepared successfully\n");
31 rv
= con
->disconnect();
33 printf("Disconnect successfully\n");
35 rv
= stmt
->execute(rows
);
36 if(rv
== OK
) { printf("Test script failed \n"); delete stmt
; return 4; }
37 printf("Test script passed\n");