2sql-cl-sqlite.lisp (620B)
1 ;;; cl-2sql Copyright (c) 2011 Tomas Hlavaty 2 3 (defpackage :2sql-cl-sqlite 4 (:use :cl) 5 (:export :make-backend)) 6 7 (in-package :2sql-cl-sqlite) 8 9 (defun make-backend (database-path busy-timeout) 10 (let ((x (sqlite:connect database-path :busy-timeout busy-timeout))) 11 (lambda (msg &rest args) 12 (assert x) 13 (ecase msg 14 (:finish 15 (destructuring-bind () args 16 (sqlite:disconnect x) 17 (setq x nil))) 18 (:query (apply 'sqlite:execute-to-list x args)) 19 ;; TODO via prep stm http://common-lisp.net/project/cl-sqlite/ 20 #+nil(:prepare) 21 #+nil(:execute)))))