r9125: work around myodbc bug
[clsql.git] / sql / table.lisp
index 4fb91685eff5e690b08ca954e33d3bab4c9d4f7b..b9a5ef1bd1534d9215e441123549c63d9d299ef0 100644 (file)
@@ -33,7 +33,7 @@
 ;; Tables 
 
 (defun create-table (name description &key (database *default-database*)
-                          (constraints nil))
+                          (constraints nil) (transactions t))
   "Create a table called NAME, in DATABASE which defaults to
 *DEFAULT-DATABASE*, containing the attributes in DESCRIPTION which is
 a list containing lists of attribute-name and type information pairs."
@@ -44,7 +44,8 @@ a list containing lists of attribute-name and type information pairs."
          (stmt (make-instance 'sql-create-table
                               :name table-name
                               :columns description
-                              :modifiers constraints)))
+                              :modifiers constraints
+                             :transactions transactions)))
     (execute-command stmt :database database)))
 
 (defun drop-table (name &key (if-does-not-exist :error)
@@ -173,6 +174,9 @@ specification of a table to drop the index from."
        (unless (index-exists-p index-name :database database)
          (return-from drop-index)))
       (:error t))
+    (unless (db-type-use-column-on-drop-index? 
+            (database-underlying-type database))
+      (setq on nil))
     (execute-command (format nil "DROP INDEX ~A~A" index-name
                              (if (null on) ""
                                  (concatenate 'string " ON "
@@ -185,6 +189,15 @@ specification of a table to drop the index from."
 OWNER is a string, this denotes a username and only indexs owned by
 OWNER are considered. Index names are returned as a list of strings."
   (database-list-indexes database :owner owner))
+
+(defun list-table-indexes (table &key (owner nil)
+                                     (database *default-database*))
+  "List all indexes in DATABASE for a TABLE, which defaults to
+*default-database*. If OWNER is :all , all indexs are considered. If
+OWNER is a string, this denotes a username and only indexs owned by
+OWNER are considered. Index names are returned as a list of strings."
+  (database-list-table-indexes (database-identifier table)
+                              database :owner owner))
   
 (defun index-exists-p (name &key (owner nil) (database *default-database*))
   "Test for existence of an index called NAME in DATABASE which