From: Russ Tyndall Date: Mon, 25 Jun 2012 15:09:44 +0000 (-0400) Subject: dequote database-identifiers and autoincrement-sequence X-Git-Tag: v6.3.0~13 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=3b7cb72a2117fe5e4599da811c9e2821de02824b dequote database-identifiers and autoincrement-sequence * 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 --- diff --git a/ChangeLog b/ChangeLog index 6df4c81..0522434 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-06-25 Russ Tyndall + * 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 * sql/metaclasses.lisp: Changed compute-effective-slot-definition to correctly copy the autoincrement-sequence slot to the ESD diff --git a/sql/expressions.lisp b/sql/expressions.lisp index cb8046f..7a8c11a 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -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)) diff --git a/sql/metaclasses.lisp b/sql/metaclasses.lisp index 73c67cb..c3c81bb 100644 --- a/sql/metaclasses.lisp +++ b/sql/metaclasses.lisp @@ -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 diff --git a/sql/utils.lisp b/sql/utils.lisp index 52ee019..e498f16 100644 --- a/sql/utils.lisp +++ b/sql/utils.lisp @@ -22,6 +22,11 @@ (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