When I open a SQLite 2.8.x db with sqlite3_open() I do not get any errors. I can even call sqlite3_exec() on it with some pragma commands, no errors returned.
However when I attempt to retrieve more info (the table structure) I get error code 26, the error message explains that the db is encrypted or malformed.
That doesn't sound right. sqlite3_open() *should* return an error when you try opening a 2.x database, citing that the file is not a SQLite (v3) database file.
Incidentally, I would expect that the simple solution is to do this: When given a file name to open, first try to open it with the v3 binary; if that returns an error citing 'not a SQLite database', then try opening it with the v2 binary; if neither fails to work, then the file isn't v3 or v2. Otherwise, based on which open() worked, your program logic now knows which binary/functions to use for further interactions with the file.
-- Darren Duncan