Last week I inquired whether anyone had any code for interfacing Ikarus with SQLite. Thanks to Dale Smith, who gave me some starter code, I now have a basic interface running. This uses a heuristic (i.e., kludge) Scheme program that scans sqlite3.h and builds a data structure describing all the constants it understands, so you can write code that uses SQLite names such as SQLITE_OK. The general C header file parser is still a great project for some unsuspecting student somewhere, but my little hack does get the job done.

I will be very happy to distribute it, once I have written some test code and documentation, and added prepared statements and user-defined functions, which I need. I expect that should be sometime next week. The biggest wart in the version as distributed is that it does way too many mallocs and frees. I have a plan for optimizing this, but will distribute the unoptimized first version anyway.

I was stymied by one of the SQLite routines, sqlite3_last_insert_rowid, which returns an int64. Fortunately, I discovered that there are undocumented native datatypes, unsigned-long- long and signed-long-long, that I can use here. I also discovered pointer-size, which will be very nice for mapping native data structures. I hope these things get documented in the next revision of the Ikarus manual.

-- v

Reply via email to