corrected to accept hostname and connect to network
[csql.git] / test / sqlnetwork / Connect / conntest3.c
blobce4dcd03c970a0d76bb0f5101d77ae6b512caf7f
1 /* close the connection and call prepare ,it should fail
3 * Author : Jitendra Lenka
4 */
5 #include<SqlNwConnection.h>
6 #include<SqlNwStatement.h>
7 #include<SqlFactory.h>
9 int main()
11 DbRetVal rv = OK;
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");
17 if(rv !=OK)return 1;
18 printf("Connection opened\n");
20 AbsSqlStatement *stmt = new SqlNwStatement();
21 stmt->setInnerStatement(NULL);
22 stmt->setConnection(con);
23 char statement[200];
24 strcpy(statement,"CREATE TABLE T1(F1 INT);");
26 int rows;
27 rv = con->disconnect();
28 if(rv!=OK)return 2;
29 printf("Connection closed\n");
31 rv = stmt->prepare(statement);
32 if(rv==OK)
35 delete stmt;
36 delete con;
37 printf("Test script failed\n");
38 return 3;
40 printf("Test script passed\n");
41 delete stmt;
42 delete con;
43 return 0;