r9125: work around myodbc bug
[clsql.git] / sql / sql.lisp
index 28d5a922b857a4f9dd9387f497ddcc02d5a7c2f1..21f5371b905685dd5e092914bc8491d44148b77b 100644 (file)
     (clsql-base-sys::signal-no-database-error database))
   (unless (is-database-open database)
     (database-reconnect database))
-  (dolist (table (list-tables database))
+  (when (db-type-has-views? (database-underlying-type database))
+    (dolist (view (list-views :database database))
+      (drop-view view :database database)))
+  (dolist (table (list-tables :database database))
     (drop-table table :database database))
-  (dolist (index (list-indexes database))
+  (dolist (index (list-indexes :database database))
     (drop-index index :database database))
-  (dolist (seq (list-sequences database))
+  (dolist (seq (list-sequences :database database))
     (drop-sequence seq :database database)))
 
 (defun print-query (query-exp &key titles (formats t) (sizes t) (stream t)
@@ -217,6 +220,10 @@ condition is true."
   (declare (ignore database))
   (db-timestring self))
 
+(defmethod database-output-sql ((self duration) database)
+  (declare (ignore database))
+  (format nil "'~a'" (duration-timestring self)))
+
 (defmethod database-output-sql (thing database)
   (if (or (null thing)
          (eq 'null thing))