Hi, Richard, Thanks for the advice, I have look at the link and experiment with it. The example loadOrSaveDb is pretty clear and straightforward. However I did not get it working with the following example:
sqlite3 *db; char *zErrMsg = 0; void main(void) { int rc; char oph_sql_db[32], oph_sql_bk[32], s[10]; strcpy(oph_sql_db, "oph.bk3"); strcpy(oph_sql_bk, "oph.sav"); rc = sqlite3_open(":memory:", &db); if( rc!=SQLITE_OK ) fprintf(stderr, "ER! - Open in Memory DB : %s\n", zErrMsg); else printf("\nOpen Memory DB ok\n"); rc=loadOrSaveDb(&db, oph_sql_db, 0); if( rc!=SQLITE_OK ) fprintf(stderr, "ER! - Load DB from disk to Memory : %s\n", zErrMsg); else printf("\nLoad DB ok\n"); printf("\nHit any key + return to save back to hard disk\n"); scanf("%s", s); rc=loadOrSaveDb(&db, oph_sql_bk, 1); if( rc!=SQLITE_OK ) fprintf(stderr, "ER - Save in Memory to disk : %s\n", zErrMsg); else printf("\nSave Memory ok\n"); } it reports that the "Open Memory DB OK" and the other two statements return with NOT SQLITE_OK. Further more, if I open the DB normally and just call to save a backup copy, it actually save the db onto hard disk with file of identical size but it also return NOT SQLITE_OK. I am using sqlite 3.7.9 on Linuxmint, as I can not see any obvious reason for reporting error I am wondering could it be an issue of sqlite version? Please advice, thanks. kfl (Hong Kong). -- ----------------------------------------------------------------------------------------------------------- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users