| 25 | } |
| 26 | |
| 27 | int test(){ |
| 28 | sqlite3 *db; |
| 29 | char *zErrMsg = 0; |
| 30 | int rc; |
| 31 | int i; |
| 32 | const char *commands[] = { |
| 33 | "CREATE TABLE t2(a INTEGER, b INTEGER, c VARCHAR(100));", |
| 34 | "INSERT INTO t2 VALUES(1,13153,'thirteen thousand one hundred fifty three');", |
| 35 | "INSERT INTO t2 VALUES(1,987,'some other number');", |
| 36 | "SELECT count(*) FROM t2;", |
| 37 | "SELECT datetime('2012-04-16 12:35:57', '+1 days');", |
| 38 | "SELECT a, b, c FROM t2;", |
| 39 | NULL |
| 40 | }; |
| 41 | |
| 42 | rc = sqlite3_open(":memory:", &db); |
| 43 | if( rc ){ |
| 44 | fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db)); |
| 45 | sqlite3_close(db); |
| 46 | exit(1); |
| 47 | } |
| 48 | for (i = 0; commands[i]; i++) { |
| 49 | rc = sqlite3_exec(db, commands[i], callback, 0, &zErrMsg); |
| 50 | if( rc!=SQLITE_OK ){ |
| 51 | fprintf(stderr, "SQL error on %d: %s\n", i, zErrMsg); |
| 52 | sqlite3_free(zErrMsg); |
| 53 | exit(1); |
| 54 | } |
| 55 | } |
| 56 | sqlite3_close(db); |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | int main(int argc, char **argv){ |
| 61 | sqlite3 *db; |