From 3b7cb72a2117fe5e4599da811c9e2821de02824b Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Mon, 25 Jun 2012 11:09:44 -0400 Subject: [PATCH] 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 --- ChangeLog | 6 ++++++ sql/expressions.lisp | 3 ++- sql/metaclasses.lisp | 5 ++++- sql/utils.lisp | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) 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 -- 2.34.1