Notable Changes in SQLite 3
Being used to the SQLite 2.x API, there are a few notable changes that I encountered.First, sqlite_get_table_printf() is gone. This isn't an insurmountable obstacle, but there are a lot of places in DataCrux where this is used. Just means more lines of code to change. They have to be replaced by a combo of sqlite3_mprintf() and sqlite3_exec(). Though in the case of DataCrux, I'm moving as much as possible to precompiled queries, so this will be a moot point.
Various changes to the precompiled query/virtual machine API. Instead of sqlite_vm, the pointer type for a precompiled query is sqlite3_stmt. The sqlite_compile() function is replaced by sqlite3_prepare(). Instead of just sqlite_bind(), we have things like sqlite3_bind_int(), sqlite3_bind_null(), etc. I imagine sqlite_bind_text() will do the job in most cases, but I haven't experimented thoroughly.
The error handling is different. Instead of sqlite functions indirectly returning error messages via reference, you have to explicitly call sqlite3_errmsg() to get a description. I think this probably makes more sense in the long run.
Aside from API changes, there some important advantages in using the newer engine. Precompiled queries no longer have to be created inside of each transaction, table structure can be altered on the fly, 64-bit signed ints for unique IDs, simultaneous read and write, and more scalable overall.
Notable Changes in SQLite 3
Posted Nov 30, 2004 — 1 comments below
Posted Nov 30, 2004 — 1 comments below
Charlie C. Li — Mar 03, 05 101