r9199: fold clsql-base and clsql-base-sys into clsql-base
[clsql.git] / sql / new-objects.lisp
index 55f5d1e0b0e8a31807af7020ebc8b0cc680e93a9..d2013b74009e325b04bf13968e9799bf6922bc1e 100644 (file)
@@ -434,6 +434,12 @@ associated with that database."))
  (setf (symbol-function (intern (symbol-name '#:store-instance)))
    (symbol-function 'update-records-from-instance))
 
+(defgeneric delete-instance-records (instance)
+  (:documentation
+   "Deletes the records represented by INSTANCE from the database
+associated with it. If instance has no associated database, an error
+is signalled."))
+
 (defmethod delete-instance-records ((object standard-db-object))
   (let ((vt (sql-expression :table (view-table (class-of object))))
         (qualifier (key-qualifier-for-instance object :database *default-database*)))
@@ -518,7 +524,7 @@ DATABASE-NULL-VALUE on the type of the slot."))
 
 (defmethod database-get-type-specifier (type args database)
   (declare (ignore type args))
-  (if (member (database-type database) '(:postgresql :postgresql-socket))
+  (if (member (database-underlying-type database) '(:postgresql :postgresql-socket))
           "VARCHAR"
           "VARCHAR(255)"))
 
@@ -533,7 +539,7 @@ DATABASE-NULL-VALUE on the type of the slot."))
                                         database)
   (if args
       (format nil "VARCHAR(~A)" (car args))
-      (if (member (database-type database) '(:postgresql :postgresql-socket))
+      (if (member (database-underlying-type database) '(:postgresql :postgresql-socket))
           "VARCHAR"
           "VARCHAR(255)")))
 
@@ -541,20 +547,20 @@ DATABASE-NULL-VALUE on the type of the slot."))
                                         database)
   (if args
       (format nil "VARCHAR(~A)" (car args))
-      (if (member (database-type database) '(:postgresql :postgresql-socket))
+      (if (member (database-underlying-type database) '(:postgresql :postgresql-socket))
           "VARCHAR"
           "VARCHAR(255)")))
 
 (defmethod database-get-type-specifier ((type (eql 'string)) args database)
   (if args
       (format nil "VARCHAR(~A)" (car args))
-      (if (member (database-type database) '(:postgresql :postgresql-socket))
+      (if (member (database-underlying-type database) '(:postgresql :postgresql-socket))
           "VARCHAR"
           "VARCHAR(255)")))
 
 (defmethod database-get-type-specifier ((type (eql 'wall-time)) args database)
   (declare (ignore args))
-  (case (database-type database)
+  (case (database-underlying-type database)
     (:postgresql
      "TIMESTAMP WITHOUT TIME ZONE")
     (:postgresql-socket
@@ -605,7 +611,7 @@ DATABASE-NULL-VALUE on the type of the slot."))
   (declare (ignore database))
   (progv '(*print-circle* *print-array*) '(t t)
     (let ((escaped (prin1-to-string val)))
-      (clsql-base-sys::substitute-char-string
+      (clsql-base::substitute-char-string
        escaped #\Null " "))))
 
 (defmethod database-output-sql-as-type ((type (eql 'symbol)) val database)