Can SQLite access the Gears database files from a application? When I
try to open the database file that contains my table, SQLite gives me
the error unable to open database file.
My code is slightly modified from the SQLite documentation code. I am
running on a mac.
C++ code:
#include <iostream>
#include "sqlite3.h"
using namespace std;
static int callback(void *NotUsed, int argc, char **argv, char
**azColName){
int i;
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg = 0;
int rc;
/*
if( argc!=3 ){
fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
exit(1);
}
*/
rc = sqlite3_open("/Users/benchung/Libary/Application Support/Google/
Google Gears for Safari/localhost/http_8888/database-
aircraft#database", &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n",
sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}
sqlite3_close(db);
return 0;
}