11 #ifndef TKEYVFS_NO_ROOT 18 callback(
void*,
int cnt,
char** vals,
char** col_name)
21 for (i = 0; i < cnt; ++
i) {
23 printf(
"%s: %s\n", col_name[i], vals[i]);
25 printf(
"%s: %s\n", col_name[i],
"NULL");
37 if (argc < 4 || argc > 5) {
39 "usage: %s: <op> <db-filename> <db-tkeyname> [<sql-statement>]\n",
44 #ifndef TKEYVFS_NO_ROOT 47 if (!strcmp(argv[1],
"r")) {
48 #ifndef TKEYVFS_NO_ROOT 49 rootFile =
new TFile(argv[2]);
56 #ifndef TKEYVFS_NO_ROOT
61 }
else if (!strcmp(argv[1],
"u")) {
62 #ifndef TKEYVFS_NO_ROOT 63 rootFile =
new TFile(argv[2],
"UPDATE");
70 #ifndef TKEYVFS_NO_ROOT
75 }
else if (!strcmp(argv[1],
"w")) {
76 #ifndef TKEYVFS_NO_ROOT 77 rootFile =
new TFile(argv[2],
"RECREATE");
83 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
84 #ifndef TKEYVFS_NO_ROOT
90 fprintf(
stderr,
"Unrecognized file mode designator %s", argv[1]);
94 fprintf(
stderr,
"Can't open database: %s\n", sqlite3_errmsg(db));
99 err = sqlite3_exec(db, argv[4],
callback, 0, &error_msg);
103 getline(&buf, &n, stdin);
104 err = sqlite3_exec(db, buf,
callback, 0, &error_msg);
107 if (err != SQLITE_OK) {
108 fprintf(
stderr,
"SQL error: %s\n", error_msg);
109 sqlite3_free(error_msg);
int tkeyvfs_open_v2(const char *filename, sqlite3 **ppDb, int flags, TFile *rootFile )
static int callback(void *, int cnt, char **vals, char **col_name)
int main(int argc, char **argv)