r9882: Add optional size to VARCHAR type
[clsql.git] / sql / oodml.lisp
index 4562be8558eb43b0b79e2be50f58b2881052bfda..10bd5cf31beb46beaff278150fe44f0e9f25de66 100644 (file)
   (declare (ignore args database db-type))
   "BIGINT")
 
-(deftype varchar () 
+(deftype varchar (&optional size
   "A variable length string for the SQL varchar type."
+  (declare (ignore size))
   'string)
 
 (defmethod database-get-type-specifier ((type (eql 'varchar)) args
@@ -851,15 +852,15 @@ maximum of MAX-LEN instances updated in each query."
   View Classes VIEW-CLASSES are passed as arguments to SELECT."
   (declare (ignore all set-operation group-by having offset limit inner-join on)
            (optimize (debug 3) (speed 1)))
-  (labels ((ref-equal (ref1 ref2)
-            (equal (sql ref1)
-                   (sql ref2)))
-          (table-sql-expr (table)
-            (sql-expression :table (view-table table)))
-          (tables-equal (table-a table-b)
-            (when (and table-a table-b)
-              (string= (string (slot-value table-a 'name))
-                       (string (slot-value table-b 'name))))))
+  (flet ((ref-equal (ref1 ref2)
+           (string= (sql-output ref1 database)
+                    (sql-output ref2 database)))
+         (table-sql-expr (table)
+           (sql-expression :table (view-table table)))
+         (tables-equal (table-a table-b)
+           (when (and table-a table-b)
+             (string= (string (slot-value table-a 'name))
+                      (string (slot-value table-b 'name))))))
     (remf args :from)
     (remf args :where)
     (remf args :flatp)