r8926: add database-create database-destroy database-probe
[clsql.git] / db-sqlite / sqlite-sql.lisp
index 5a41b4d10ddef7273e9f2da8308ef21d46cd90e2..9b67f380b25cc7f9a1f35a9b3e69e23eedc2e0a0 100644 (file)
 
 (defmethod database-sequence-last (sequence-name (database sqlite-database))
   (declare (ignore sequence-name)))
+
+(defmethod database-create (connection-spec (type (eql :sqlite)))
+  (declare (ignore connection-spec))
+  ;; databases are created automatically by SQLite
+  t)
+
+(defmethod database-destroy (connection-spec (type (eql :sqlite)))
+  (destructuring-bind (name) connection-spec
+    (if (probe-file name)
+       (delete-file name)
+       nil)))
+
+(defmethod database-probe (connection-spec (type (eql :sqlite)))
+  (destructuring-bind (name) connection-spec
+    ;; TODO: Add a test that this file is a real sqlite database 
+    (and (probe-file name) t)))
+
+