507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
if(stat(nam2,&fst)) fatal("Unable to stat '%s': %m\n",nam2);
if(!fst.st_size) fatal("File '%s' has zero size\n",nam2);
if(fst.st_mtime>t1 || fst.st_ctime>t1) leveluc=reset_usercache(levelfp,nam2,&fst,".LVL");
if(stat(nam3,&fst)) fatal("Unable to stat '%s': %m\n",nam3);
if(fst.st_mtime>t2 || fst.st_ctime>t2) solutionuc=reset_usercache(solutionfp,nam3,&fst,".SOL");
free(nam2);
free(nam3);
if(z=sqlite3_prepare_v3(userdb,"SELECT `OFFSET`, CASE WHEN ?3 THEN `DATA` ELSE `USERSTATE` END "
"FROM `USERCACHEDATA` WHERE `FILE` = ?1 AND `LEVEL` = ?2;",-1,SQLITE_PREPARE_PERSISTENT,&readusercachest,0)) {
fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
}
if(z=sqlite3_exec(userdb,"COMMIT;",0,0,0)) fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
fprintf(stderr,"Done\n");
}
|
|
|
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
if(stat(nam2,&fst)) fatal("Unable to stat '%s': %m\n",nam2);
if(!fst.st_size) fatal("File '%s' has zero size\n",nam2);
if(fst.st_mtime>t1 || fst.st_ctime>t1) leveluc=reset_usercache(levelfp,nam2,&fst,".LVL");
if(stat(nam3,&fst)) fatal("Unable to stat '%s': %m\n",nam3);
if(fst.st_mtime>t2 || fst.st_ctime>t2) solutionuc=reset_usercache(solutionfp,nam3,&fst,".SOL");
free(nam2);
free(nam3);
if(z=sqlite3_prepare_v3(userdb,"SELECT `OFFSET`, CASE WHEN ?3 THEN `USERSTATE` ELSE `DATA` END "
"FROM `USERCACHEDATA` WHERE `FILE` = ?1 AND `LEVEL` = ?2;",-1,SQLITE_PREPARE_PERSISTENT,&readusercachest,0)) {
fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
}
if(z=sqlite3_exec(userdb,"COMMIT;",0,0,0)) fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
fprintf(stderr,"Done\n");
}
|