1 /* create table t1 with two fields,
2 * insert 10 rows into the table ,
3 * select with nonexisting fields.It Should be failed in Mysql, Passed in postgres and oracle
10 AbsSqlConnection
*con
= createConnection();
11 rv
= con
->connect("root","manager");
14 AbsSqlStatement
*stmt
= createStatement();
15 stmt
->setConnection(con
);
20 strcpy(statement
,"INSERT INTO t1 VALUES(?,?);");
21 if(strcmp(getenv("DSN"),"db2")==0)
22 strcpy(statement
,"INSERT INTO t1 VALUES(?,?)");
27 rv
= stmt
->prepare(statement
);
28 if(rv
!=OK
) { delete stmt
; delete con
; return 3; }
32 for( int i
= 0; i
< 2; i
++ ) {
33 for( int j
= 0; j
< 5; j
++ ) {
35 rv
= con
->beginTrans();
37 stmt
->setIntParam(1,f1var
);
38 stmt
->setIntParam(2,f2var
);
39 rv
= stmt
->execute(rows
);
45 printf("%d rows inserted\n",count
);
49 //*******************************************
50 strcpy(statement
,"SELECT F3 ,f2 FROM t1;");
51 if(strcmp(getenv("DSN"),"db2")==0)
52 strcpy(statement
,"SELECT F3 ,f2 FROM t1");
53 rv
= stmt
->prepare(statement
);
55 printf("Test script passed\n");
56 delete stmt
; delete con
; return 0;
58 if(strcmp(getenv("DSN"),"oracle")==0 || strcmp(getenv("DSN"),"psql")==0 || strcmp(getenv("DSN"),"sybase")==0)
60 printf("Test script Passed\n");
61 delete stmt
; delete con
; return 0;
63 printf("Test script failed\n");
64 delete stmt
; delete con
; return 4; }