Yesterday I spent some time trying to solve a SQLite problem that turned out to be due to using an old version of sqlite3, so that when I tried to open a database created with a newer SQLite library, it would output "Error: file is encrypted or is not a database". Later I found out this was because that SQLite 3 file versions are generally not forward-compatible and my sqlite3 tool was too old.

Opening the database file in a hex editor, I saw it says at the very beginning, "SQLite format 3".

Can I suggest storing the full version number of the SQLite library in the format of the SQLite file. That way, tools using the SQLite library can use this to output a couple of useful errors and warnings: - If a user tries to use a tool to open a database file, and the database file was created with a more recent version of the library than the tool was, the tool can warn that it's probably not forward-compatible and you need a more recent version of the tool. - If a user uses a tool to open a database file, and the library version of the tool is *newer* than the library version that created the database file (I assume this will work, if SQLite 3 format versions are backward-compatible), the tool can warn you that if you save changes to the database file, it will be saved in the newer file format, and the file may no longer be compatible with the program that generated it originally.

Bennett

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to