Friday, June 18, 2004, 8:33:26 AM, DRH wrote:
> A file format and API freeze is scheduled for July 1.  Users
> are encouraged to evaluate this release and make suggestions
> on how to improve the interface prior to that date.

I ported Tiago Dionizio's LuaSQLite to version 3.0.1. Here are a
few SQLite C API comments based on that experience...

0. Overall the new API is easy to use and understand; it is a logical
extension to the version 2 API. Porting was straightforward and
offered new opportunities for BLOBs and stronger dynamic data typing.

1. Windows DLLs will need sqlite3_libversion() function.

2. Loss of the sqlite_error_string(errnum) function complicates things
a bit. Before the change a glue library could defer capturing the
error string when an error occurred. In fact, it could simply pass the
error code back to the caller, and let the caller decide if a string
was necessary. Now the onus is on the library to capture the error
string immediately. Two reasons: the caller may perform db operations
before inspecting the returned result code and deciding the string is
desired, or the library may need to do some db cleanup functions
(e.g., sqlite3_finalize) after an error occurs, and the caller will
want the string associated with the original call, not the cleanup.

3. It would be convenient to be able to get the size of an integer
before calling one of sqlite3_column_int sqlite3_column_int64 or
sqlite3_column_double. Of course, the glue library can do this with
sqlite3_column_int64 and some arithmetic; the point is that when
sqlite3_column_type returns SQLITE_INTEGER it is not apparent which of
the three above calls to retrieve the value is optimal. [In the case
of Lua the only choice is double or text; asking sqlite for a double
may lose precision if the integer is larger than 52 bits; asking for
text leads to excessive type conversions on the Lua side.]

4. It is odd that sqlite3_exec returns an error message string (well I
guess it is legacy code). It triggers the only use of sqlite3_free in
the glue library just to handle this string. [The library doesn't use
sqlite3_mprintf() or sqlite3_vmprintf() preferring
sqlite3_bind_xxx().] Note that the comment in the source above
sqlite3_free is incorrect w.r.t. sqlite3_open.

e


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to