Page 1 of 1
SQLite Userlib Problems
Posted: Wed Dec 17, 2003 4:00 pm
by Karbon
More directed at El_Choni than anyone else
Seems like SQLiteOpen() will return a non-zero result no matter what you pass to it. Makes it difficult to detect invalid databases..
Thanks!
Posted: Wed Dec 17, 2003 5:37 pm
by El_Choni
In this case, it's not my fault. This is what the sqlite.dll source comments:
Code: Select all
/*
** A function to open a new sqlite database.
**
** If the database does not exist and mode indicates write
** permission, then a new database is created. If the database
** does not exist and mode does not indicate write permission,
** then the open fails, an error message generated (if errmsg!=0)
** and the function returns 0.
**
** If mode does not indicates user write permission, then the
** database is opened read-only.
**
** The Truth: As currently implemented, all databases are opened
** for writing all the time. Maybe someday we will provide the
** ability to open a database readonly. The mode parameters is
** provided in anticipation of that enhancement.
*/
sqlite *sqlite_open(const char *filename, int mode, char **errmsg);
So 0 is never returned. If the DB doesn't exist, it's created. Anyway, a DBhandle is returned. Sorry, anyway.
I hope I have some time to fix the bug with the dbindex soon. Cya,
Posted: Wed Dec 17, 2003 5:40 pm
by Karbon
I was afraid that was the case! Thanks!