r8983: add missing methods
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 12 Apr 2004 21:16:48 +0000 (21:16 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 12 Apr 2004 21:16:48 +0000 (21:16 +0000)
ChangeLog
db-aodbc/aodbc-sql.lisp

index eaafb77178ecba06aa0138c8e403887f854be93a..386351f3dbd215acd3ad6e9f0fc131adee6d1973 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+12 Apr 2004 Kevin Rosenberg (kevin@rosenberg.net)
+       * Version 2.6.10
+       * db-aodbc: Add methods for generic functions, some are
+       not yet implemented.
+
 12 Apr 2004 Kevin Rosenberg (kevin@rosenberg.net)
        * Version 2.6.9
        * base/package.lisp: Add missing symbols [Marcus Pearce]
index 24a6e47ea34b2fd3d403d0c60e5fd49c98696fb6..181c3edeee490678d82963ce2ef9a9f33c7f11cf 100644 (file)
              (setf (car rest) elem))
        list))))
 
+;;; Sequence functions
+
+(defun %sequence-name-to-table (sequence-name)
+  (concatenate 'string "_clsql_seq_" (sql-escape sequence-name)))
+
+(defun %table-name-to-sequence-name (table-name)
+  (and (>= (length table-name) 11)
+       (string= (subseq table-name 0 11) "_clsql_seq_")
+       (subseq table-name 11)))
+
+(defmethod database-create-sequence (sequence-name
+                                    (database aodbc-database))
+  (let ((table-name (%sequence-name-to-table sequence-name)))
+    (database-execute-command
+     (concatenate 'string "CREATE TABLE " table-name
+                 " (id int NOT NULL PRIMARY KEY AUTO_INCREMENT)")
+     database)
+    (database-execute-command 
+     (concatenate 'string "INSERT INTO " table-name
+                 " VALUES (0)")
+     database)))
+
+(defmethod database-drop-sequence (sequence-name
+                                  (database aodbc-database))
+  (database-execute-command
+   (concatenate 'string "DROP TABLE " (%sequence-name-to-table sequence-name)) 
+   database))
+
+(defmethod database-list-sequences ((database aodbc-database)
+                                    &key (owner nil))
+  (declare (ignore owner))
+  (mapcar #'(lambda (s) (%table-name-to-sequence-name (car s)))
+          (database-query "SHOW TABLES LIKE '%clsql_seq%'" 
+                          database nil)))
+
+(defmethod database-set-sequence-position (sequence-name
+                                           (position integer)
+                                           (database aodbc-database))
+  (database-execute-command
+   (format nil "UPDATE ~A SET id=~A" (%sequence-name-to-table sequence-name)
+           position)
+   database)
+  position)
+
+(defmethod database-sequence-next (sequence-name (database aodbc-database))
+  (warn "Not implemented."))
+
+(defmethod database-sequence-last (sequence-name (database aodbc-database))
+  (declare (ignore sequence-name)))
+
+(defmethod database-create (connection-spec (type (eql :aodbc)))
+  (warn "Not implemented."))
+
+(defmethod database-destroy (connection-spec (type (eql :aodbc)))
+  (warn "Not implemented."))
+
+(defmethod database-probe (connection-spec (type (eql :aodbc)))
+  (warn "Not implemented."))
+
 #+ignore                      
 (when (clsql-base-sys:database-type-library-loaded :aodbc)
   (clsql-base-sys:initialize-database-type :database-type :aodbc))