adding test scripts
[csql.git] / test / sqlapi / Csql / Connect / transactionafterclose.c
blob726d0facbd994128cf21e2be38db78916e1b9e01
1 /*
2 close the connection and call commit, it should fail
3 close the connection and call rollback, it should fail.
4 */
6 #include"common.h"
8 int main()
10 DbRetVal rv = OK;
11 AbsSqlConnection *con = createConnection();
12 rv = con->connect("root","manager");
13 if(rv!=OK) {
14 delete con;
15 return 1;
17 printf("Connection opened\n");
19 rv = con->beginTrans();
20 if(rv!=OK) {
21 con->disconnect();
22 delete con;
23 return 2;
26 rv = con->disconnect();
27 if(rv !=OK) {
28 delete con;
29 return 3;
31 printf("Connection closed\n");
33 rv = con->commit();
34 if(rv==OK) {
35 printf("Test script failed\n");
36 delete con;
37 return 4;
39 printf("Commit Failed After closing connection,\n");
41 rv = con->rollback();
42 if(rv==OK) {
43 printf("Test script failed\n");
44 delete con;
45 return 4;
47 printf("Rollback Failed After closing connection,\n");
49 printf("Test script pased\n");
50 delete con;
51 return 0;