X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-sqlite3%2Fsqlite3-sql.lisp;h=7b16b48b50319c967d4bc4876c96e327e61a8071;hb=5bb8544ca8a58d10b57f751bad2c9abf4d7a13c8;hp=927716a0c356f01a56861684bec099ce8ad05a04;hpb=fe6d36c16c61c855fc3b0c0c7c07f3cf3de4241d;p=clsql.git diff --git a/db-sqlite3/sqlite3-sql.lisp b/db-sqlite3/sqlite3-sql.lisp index 927716a..7b16b48 100644 --- a/db-sqlite3/sqlite3-sql.lisp +++ b/db-sqlite3/sqlite3-sql.lisp @@ -31,7 +31,7 @@ (defmethod database-name-from-spec (connection-spec (database-type (eql :sqlite3))) (check-sqlite3-connection-spec connection-spec) - (first connection-spec)) + (princ-to-string (first connection-spec))) (defmethod database-connect (connection-spec (database-type (eql :sqlite3))) (check-sqlite3-connection-spec connection-spec) @@ -303,6 +303,12 @@ (if (string-equal (fourth field-info) "0") 1 0))))) +(defmethod database-last-auto-increment-id ((database sqlite3-database) table column) + (declare (ignore table column)) + (car (query "SELECT LAST_INSERT_ROWID();" + :flatp t :field-names nil + :database database))) + (defmethod database-create (connection-spec (type (eql :sqlite3))) (declare (ignore connection-spec)) ;; databases are created automatically by Sqlite3 @@ -320,7 +326,26 @@ (or (string-equal ":memory:" name) (and (probe-file name) t)))) +(defmethod database-get-type-specifier ((type (eql 'integer)) + args database + (db-type (eql :sqlite3))) + (declare (ignore database)) + (if args + (format nil "INTEGER(~A)" (car args)) + "INTEGER")) + +(defmethod database-get-type-specifier ((type (eql 'integer)) + args database + (db-type (eql :sqlite3))) + (declare (ignore database)) + (if args + (format nil "INTEGER(~A)" (car args)) + "INTEGER")) + ;;; Database capabilities (defmethod db-type-has-boolean-where? ((db-type (eql :sqlite3))) nil) + +(defmethod db-type-has-auto-increment? ((db-type (eql :sqlite3))) + t)