2 Char and varchar field length should not be more than 8000 bytes.
3 CREATE TABLE t1(f1 INT,f2 CHAR(8002)); It should be failed because size should not greater than 8000
4 CREATE TABLE t1(f1 INT,f2 VARCHAR(8002)); It should be failed because size should not greater than 8000
12 AbsSqlConnection
*con
= createConnection();
13 rv
= con
->connect("root","manager");
18 printf("Connection opened\n");
19 AbsSqlStatement
*stmt
= createStatement();
20 stmt
->setConnection(con
);
23 strcpy(statement
,"CREATE TABLE t1(f1 INT,f2 CHAR(8002));");
25 rv
= stmt
->prepare(statement
);
26 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 2; }
27 rv
= stmt
->execute(rows
);
29 strcpy(statement
,"DROP TABLE t1;");
30 rv
= stmt
->prepare(statement
);
31 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 3; }
32 rv
= stmt
->execute(rows
);
33 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 4; }
34 printf("Table dropped\n");
41 printf("Table Creation Failed\n");
44 strcpy(statement
,"CREATE TABLE t1(f1 INT,f2 VARCHAR(8002));");
46 rv
= stmt
->prepare(statement
);
47 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 6; }
48 rv
= stmt
->execute(rows
);
50 strcpy(statement
,"DROP TABLE t1;");
51 rv
= stmt
->prepare(statement
);
52 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 7; }
53 rv
= stmt
->execute(rows
);
54 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 8; }
55 printf("Table dropped\n");
62 printf("Table Creation Failed\n");
66 strcpy(statement
,"GETALLTABLES;");
68 rv
= stmt
->prepare(statement
);
69 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 10; }
71 if(rv
!=OK
) { delete stmt
; con
->disconnect(); delete con
; return 11; }
72 printf("\t TABLES\n");
73 printf("\t--------\n");
74 while(stmt
->next() !=NULL
) {
75 printf("\t%s\n",stmt
->getFieldValuePtr(2)); //stmt->getFieldValuePtr(2) returns the TABLE_NAME (src/sql/SqlStatement.cxx)
80 printf("Connection Closed\n");
82 delete stmt
; delete con
;