projects
/
clsql.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed a bug where the order by was being destructively modified,
[clsql.git]
/
sql
/
expressions.lisp
diff --git
a/sql/expressions.lisp
b/sql/expressions.lisp
index 281da967706d13118df81abbe738d17cf8e0d698..7a8c11a6b226d1202ad6158830a4f0a8fd701676 100644
(file)
--- a/
sql/expressions.lisp
+++ b/
sql/expressions.lisp
@@
-128,10
+128,8
@@
"Top-level call for generating SQL strings. Returns an SQL
string appropriate for DATABASE which corresponds to the
supplied lisp expression SQL-EXPR."
"Top-level call for generating SQL strings. Returns an SQL
string appropriate for DATABASE which corresponds to the
supplied lisp expression SQL-EXPR."
- (progv '(*sql-stream*)
- `(,(make-string-output-stream))
- (output-sql sql-expr database)
- (get-output-stream-string *sql-stream*)))
+ (with-output-to-string (*sql-stream*)
+ (output-sql sql-expr database)))
(defmethod output-sql (expr database)
(write-string (database-output-sql expr database) *sql-stream*)
(defmethod output-sql (expr database)
(write-string (database-output-sql expr database) *sql-stream*)
@@
-813,7
+811,8
@@
uninclusive, and the args from that keyword to the end."
(output-sql attributes database))
(when values
(write-string " VALUES " *sql-stream*)
(output-sql attributes database))
(when values
(write-string " VALUES " *sql-stream*)
- (output-sql values database))
+ (let ((clsql-sys::*in-subselect* t))
+ (output-sql values database)))
(when query
(write-char #\Space *sql-stream*)
(output-sql query database)))
(when query
(write-char #\Space *sql-stream*)
(output-sql query database)))
@@
-870,10
+869,9
@@
uninclusive, and the args from that keyword to the end."
(write-string "UPDATE " *sql-stream*)
(output-sql table database)
(write-string " SET " *sql-stream*)
(write-string "UPDATE " *sql-stream*)
(output-sql table database)
(write-string " SET " *sql-stream*)
- (output-sql (apply #'vector (update-assignments)) database)
- (when where
- (write-string " WHERE " *sql-stream*)
- (output-sql where database))))
+ (let ((clsql-sys::*in-subselect* t))
+ (output-sql (apply #'vector (update-assignments)) database))
+ (output-sql-where-clause where database)))
t)
;; CREATE TABLE
t)
;; CREATE TABLE
@@
-941,7
+939,7
@@
uninclusive, and the args from that keyword to the end."
(when (and (eq :mysql (database-underlying-type database))
transactions
(db-type-transaction-capable? :mysql database))
(when (and (eq :mysql (database-underlying-type database))
transactions
(db-type-transaction-capable? :mysql database))
- (write-string "
Type=InnoDB
" *sql-stream*))))
+ (write-string "
ENGINE=innodb
" *sql-stream*))))
t)
t)
@@
-1118,7
+1116,7
@@
uninclusive, and the args from that keyword to the end."
(defmethod database-identifier ( name &optional database find-class-p
&aux cls)
(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, recur
s
ively coerces it,
and returns a database-identifier.
(escaped-database-identifiers *any-reasonable-object*) should be called to
and returns a database-identifier.
(escaped-database-identifiers *any-reasonable-object*) should be called to
@@
-1141,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))))
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))
(etypecase name
(null nil)
(string (%make-database-identifier name database))