SQLite Archiver (Windows)
Check-in [ed4e6af2e8]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1:ed4e6af2e898dbec8b13ff732522d0e764f06f1f
Date: 2014-06-14 17:20:10
User: drh
Comment:In sqlarfs (the Fuse FS driver for SQLite archives) make sure it always runs in the foreground. And after it stops, clean up prepared statements and memory allocations and close the database connection before exiting.
Tags And Properties
Context
2014-08-13 14:18
[e69ad51287] Leaf: Created Makefile.vc for NMake/MSVC10, to build sqlar.exe on Win32. Windows doesn't have unistd.h; added workarounds to sqlar.c. Imported dirent from http://www.two-sdg.demon.co.uk/curbralan/code/dirent/dirent.html; this is a Windows emulation of POSIX dirent. Imported zlib from Tcl 8.6.0 sources (origin http://zlib.net/) (user: twylite, tags: win32)
2014-06-14 17:20
[ed4e6af2e8] Leaf: In sqlarfs (the Fuse FS driver for SQLite archives) make sure it always runs in the foreground. And after it stops, clean up prepared statements and memory allocations and close the database connection before exiting. (user: drh, tags: trunk)
2014-06-13 18:32
[aab6f9cff9] Add a short mention of the FuseFS adaptor to the documentation and homepage. (user: drh, tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sqlarfs.c.

215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230
...
232
233
234
235
236
237
238





239







240
241
  .getattr = sqlarfs_getattr,
  .readdir = sqlarfs_readdir,
  .open   	= sqlarfs_open,
  .read    = sqlarfs_read,
};
int main(int argc, char **argv){
  int rc;

  if( argc<2 ){
    fprintf(stderr, "Usage: %s SQLAR-ARCHIVE [-d] [-s] [-f] MOUNT-POINT\n",
            argv[0]);
    exit(1);
  }
  rc = sqlite3_open(argv[1], &g.db);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "Cannot open sqlar file [%s]\n", argv[1]);
    exit(1);
................................................................................
  rc = sqlite3_exec(g.db, "SELECT 1 FROM sqlar LIMIT 1", 0, 0, 0);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "File [%s] is not an SQLite archive\n", argv[1]);
    exit(1);
  }
  g.uid = getuid();
  g.gid = getgid();





  rc = fuse_main(argc-1, argv+1, &sqlarfs_methods, NULL);







  return rc;
}







>
|
|







 







>
>
>
>
>
|
>
>
>
>
>
>
>


215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
  .getattr = sqlarfs_getattr,
  .readdir = sqlarfs_readdir,
  .open   	= sqlarfs_open,
  .read    = sqlarfs_read,
};
int main(int argc, char **argv){
  int rc;
  char *azNewArg[5];
  if( argc!=3 ){
    fprintf(stderr, "Usage: %s SQLAR-ARCHIVE MOUNT-POINT\n",
            argv[0]);
    exit(1);
  }
  rc = sqlite3_open(argv[1], &g.db);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "Cannot open sqlar file [%s]\n", argv[1]);
    exit(1);
................................................................................
  rc = sqlite3_exec(g.db, "SELECT 1 FROM sqlar LIMIT 1", 0, 0, 0);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "File [%s] is not an SQLite archive\n", argv[1]);
    exit(1);
  }
  g.uid = getuid();
  g.gid = getgid();
  azNewArg[0] = argv[0];
  azNewArg[1] = "-f";
  azNewArg[2] = "-s";
  azNewArg[3] = argv[2];
  azNewArg[4] = 0;
  rc = fuse_main(4, azNewArg, &sqlarfs_methods, NULL);
  sqlite3_finalize(g.pStat);
  sqlite3_finalize(g.pFList);
  sqlite3_finalize(g.pExists);
  sqlite3_finalize(g.pRead);
  sqlite3_free(g.zCacheName);
  sqlite3_free(g.zCacheData);
  sqlite3_close(g.db);
  return rc;
}