I've written this quite some time ago (and it didn't receive much love since then, but it's functional and should be bug-free), but I just noticed I haven't mentioned it on my blog: fbsql is a clean C-API that can be used to create bindings for other languages (such as Python or Ruby). It's much simpler to use than the raw Interbase/Firebird API and it uses IBPP internally. So it's basically just forwarding the function calls to IBPP and abstracting the IBPP classes to a C interface that is straight forward and intuitive.
I have included a binding to Lisp, since this was my personal main goal with this project. I noticed that there is no way at all to access Interbase and/or Firebird from Lisp, and since I like toying around with Lisp, I thought that writing small database helper applications with it is a good way to get comfortable with it. The Lisp binding has two layers: First is the CFFI that is used to access the native C functions from the fbsql C-library and the second, more lispish layer is a bit more advanced and better to use. It includes thinks like
This little script creates a statement to the given database and transaction, executes "select * from test" and prints everything value in column 1 (which should be a short).
(with-statement (st database transaction)
(statement-prepare st "select * from table")
(statement-execute st)
(while-statement-fetch st
(format t "~a~%" (statement-get-short st 1))))
Lisp is so wonderfully compact. ;-)
Hi,
ReplyDeleteWhat lisp implementation did u use?
Thanx.
I used CLISP on Linux, haven't tested other implementations or platforms, yet. Did you run into problems with another Lisp implementation?
ReplyDeleteJust curious, never used CLISP.
ReplyDeleteActually, your lib was very useful to me for binding to Lua via FFI. Too bad IB api is so archaic, otherwise I would have used it directly, instead of IBPP which is such a bloat.