Do I need to use sqlite3_close if the call to sqlite3_open indicated an
error? The documentation for sqlite3_open says "An sqlite3* handle is
returned in *ppDb, even if an error occurs." So I assumed the answer is yes.
But if I try this code (on a non-existing file and no write permissions):
int rc_o = sqlite3_open (filename, &db);
if (rc_o != SQLITE_OK) {
printf("ERROR: %i, %i, %s\n",
rc_o, sqlite3_errcode(db), sqlite3_errmsg(db));
int rc_c = sqlite3_close (db);
if (rc_c != SQLITE_OK) {
printf("ERROR: %i, %i, %s\n",
rc_c, sqlite3_errcode(db), sqlite3_errmsg(db));
}
}
I get:
ERROR: SQLITE_CANTOPEN, SQLITE_CANTOPEN, unable to open database file
ERROR: SQLITE_CANTOPEN, SQLITE_MISUSE, library routine called out of
sequence
Shouldn't sqlite3_close return SQLITE_OK?
And why is the rc_c different from the return value of the
sqlite3_errcode function? Isn't that function supposed to return the
error code of the last sqlite3_* function? Which is sqlite3_close in my
code.
_________________________________________________________________
Who is the sweetheart of the Japanese and always holds something in his
hands? Live Search knows! How about you?
http://search.live.com/images/results.aspx?q=Manneken%20pis&FORM=QBIR
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------