Database independent interface for Common Lisp
(defvar *connection*
(dbi:connect :mysql
:database-name "test"
:username "nobody"
:password "1234"))
(let* ((query (dbi:prepare *connection*
"SELECT * FROM somewhere WHERE flag = ? OR updated_at > ?"))
(result (dbi:execute query 0 "2011-11-01")))
(loop for row = (dbi:fetch result)
while row
;; process "row".
))
CL-DBI is intended to provide the same interface for each database.
Not only, you don't have to learn each API of databases anymore, but this layer is especially convenient when you want to use the different database by environment.
For example, your application had better to use efficient database such as MySQL on the production environment, but you may want to use SQLite3 on your machine. In that case, all what you have to do is only to rewrite calling dbi:connect
.
This library will be available on Quicklisp when ready to use.
Create a subclass of <dbi-driver> and implement following methods.
And these methods may be overrided if needed.
Copyright (c) 2011 Eitarow Fukamachi (e.arrows@gmail.com)
Licensed under the LLGPL License.