dequote database-identifiers and autoincrement-sequence
authorRuss Tyndall <russ@acceleration.net>
Mon, 25 Jun 2012 15:09:44 +0000 (11:09 -0400)
committerRuss Tyndall <russ@acceleration.net>
Mon, 25 Jun 2012 15:54:17 +0000 (11:54 -0400)
 * we can handle symbols, so we can probably handle quoted symbols
 * slot-definition initargs seem to some in unevaluated, so lets handle
   people doing the obvious thing and puting a quote in front of their symbols

ChangeLog
sql/expressions.lisp
sql/metaclasses.lisp
sql/utils.lisp

index 6df4c81960242c6a8c040be3dc0ea75e4c0a84c4..05224342b7350fc4cb1c6fec156cb3fdffcf94b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-25  Russ Tyndall  <russ@acceleration.net>
+       * sql/util.lisp, sql/metaclasses.lisp
+       Dequote database-identifiers if needed (passed a quoted symbol)
+       Metaclass args come through unquoted, so this eases interactions
+       with them
+
 2012-06-22  Russ Tyndall  <russ@acceleration.net>
        * sql/metaclasses.lisp: Changed compute-effective-slot-definition
        to correctly copy the autoincrement-sequence slot to the ESD
index cb8046fb09b6fb9e38bfbac3a14d8f38a8c4bf13..7a8c11a6b226d1202ad6158830a4f0a8fd701676 100644 (file)
@@ -1116,7 +1116,7 @@ uninclusive, and the args from that keyword to the end."
 
 (defmethod database-identifier ( name  &optional database find-class-p
                                  &aux cls)
-  "A function that takes whatever you give it, recurively coerces it,
+  "A function that takes whatever you give it, recursively coerces it,
    and returns a database-identifier.
 
    (escaped-database-identifiers *any-reasonable-object*) should be called to
@@ -1139,6 +1139,7 @@ uninclusive, and the args from that keyword to the end."
             a new db-id with that string as escaped"
            (let ((s (sql-output id database)))
              (make-instance '%database-identifier :escaped s :unescaped s))))
+    (setf name (dequote name))
     (etypecase name
       (null nil)
       (string (%make-database-identifier name database))
index 73c67cb732300a26ae526628be0be36e8be37b76..c3c81bb0aeffa3be4398a3b4fbb4c5eb36c9df22 100644 (file)
@@ -457,7 +457,10 @@ implementations."
 (defmethod initialize-instance :after
     ((obj view-class-direct-slot-definition)
      &key &allow-other-keys)
-  (setf (view-class-slot-column obj) (compute-column-name obj)))
+  (setf (view-class-slot-column obj) (compute-column-name obj)
+        (view-class-slot-autoincrement-sequence obj)
+        (dequote
+         (view-class-slot-autoincrement-sequence obj))))
 
 (defmethod compute-effective-slot-definition ((class standard-db-class)
                                               #+kmr-normal-cesd slot-name
index 52ee019943c3250946d6d465bbb3ca94210aaf43..e498f16888e52b07d56ddc80ce65195fe7907f75 100644 (file)
     (integer v)
     (number (truncate v))))
 
+(defun dequote (it)
+  (if (and (listp it) (eql (first it) 'quote))
+      (second it)
+      it))
+
 (defvar +whitespace-chars+
   '(#\space #\tab #\newline #\return
     ;; Tested: sbcl unicode, allegrocl, openmcl,clisp use #\no-break_space