X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Futils.lisp;h=362d16c178529ae67659996c181bbe5f2e4aac73;hp=e1de8571c4761c4eb83cfb04ec863a198857e9a9;hb=d9f41af62750c622945bb17b622a39689ee5b840;hpb=8a8ee2d7d791b7a3efaed06420802a925d16fca3 diff --git a/sql/utils.lisp b/sql/utils.lisp index e1de857..362d16c 100644 --- a/sql/utils.lisp +++ b/sql/utils.lisp @@ -56,7 +56,9 @@ (symbol (symbol-name identifier)) (string identifier))) (escaped (make-string (length unescaped)))) - (dotimes (i (length unescaped)) + (substitute #\_ #\- unescaped))) + +(dotimes (i (length unescaped)) (setf (char escaped i) (cond ((equal (char unescaped i) #\-) #\_) @@ -66,11 +68,12 @@ escaped)) (defmacro without-interrupts (&body body) - #+lispworks `(mp:without-preemption ,@body) #+allegro `(mp:without-scheduling ,@body) + #+clisp `(progn ,@body) #+cmu `(system:without-interrupts ,@body) - #+sbcl `(sb-sys::without-interrupts ,@body) - #+openmcl `(ccl:without-interrupts ,@body)) + #+lispworks `(mp:without-preemption ,@body) + #+openmcl `(ccl:without-interrupts ,@body) + #+sbcl `(sb-sys::without-interrupts ,@body)) (defun make-process-lock (name) #+allegro (mp:make-process-lock :name name) @@ -315,14 +318,25 @@ list of characters and replacement strings." (incf dpos)))))) +(defun getenv (var) + "Return the value of the environment variable." + #+allegro (sys::getenv (string var)) + #+clisp (ext:getenv (string var)) + #+(or cmu scl) + (cdr (assoc (string var) ext:*environment-list* :test #'equalp + :key #'string)) + #+lispworks (lw:environment-variable (string var)) + #+mcl (ccl::getenv var) + #+sbcl (sb-ext:posix-getenv var)) + (eval-when (:compile-toplevel :load-toplevel :execute) (when (char= #\a (schar (symbol-name '#:a) 0)) - (pushnew :lowercase-reader *features*))) + (pushnew :clsql-lowercase-reader *features*))) (defun symbol-name-default-case (str) - #-lowercase-reader + #-clsql-lowercase-reader (string-upcase str) - #+lowercase-reader + #+clsql-lowercase-reader (string-downcase str)) (defun convert-to-db-default-case (str database) @@ -334,10 +348,13 @@ list of characters and replacement strings." ;; Default CommonSQL behavior is to upcase strings (string-upcase str))) - (defun ensure-keyword (name) "Returns keyword for a name" (etypecase name (keyword name) (string (nth-value 0 (intern (symbol-name-default-case name) :keyword))) (symbol (nth-value 0 (intern (symbol-name name) :keyword))))) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (setq cl:*features* (delete :clsql-lowercase-reader cl:*features*))) +