projects
/
clsql.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
specify data type translation for mssql ODBC database Date->"smalldatetime"
[clsql.git]
/
sql
/
expressions.lisp
diff --git
a/sql/expressions.lisp
b/sql/expressions.lisp
index 45d4631b5eaccf70b878b49a6b79907b9d4930c4..c7236a454f56cb4c4c08a102c4ee61381c162996 100644
(file)
--- a/
sql/expressions.lisp
+++ b/
sql/expressions.lisp
@@
-586,12
+586,16
@@
uninclusive, and the args from that keyword to the end."
(when *in-subselect*
(write-string "(" *sql-stream*))
(write-string "SELECT " *sql-stream*)
(when *in-subselect*
(write-string "(" *sql-stream*))
(write-string "SELECT " *sql-stream*)
+ (when (and limit (eql :mssql (database-underlying-type database)))
+ (write-string " TOP " *sql-stream*)
+ (output-sql limit database)
+ (write-string " " *sql-stream*))
(when all
(when all
- (write-string "ALL " *sql-stream*))
+ (write-string "
ALL " *sql-stream*))
(when (and distinct (not all))
(when (and distinct (not all))
- (write-string "DISTINCT " *sql-stream*)
+ (write-string "
DISTINCT " *sql-stream*)
(unless (eql t distinct)
(unless (eql t distinct)
- (write-string "ON " *sql-stream*)
+ (write-string "
ON " *sql-stream*)
(output-sql distinct database)
(write-char #\Space *sql-stream*)))
(let ((*in-subselect* t))
(output-sql distinct database)
(write-char #\Space *sql-stream*)))
(let ((*in-subselect* t))
@@
-657,7
+661,7
@@
uninclusive, and the args from that keyword to the end."
(when (cdr order)
(write-char #\, *sql-stream*))))
(output-sql order-by database)))
(when (cdr order)
(write-char #\, *sql-stream*))))
(output-sql order-by database)))
- (when
limit
+ (when
(and limit (not (eql :mssql (database-underlying-type database))))
(write-string " LIMIT " *sql-stream*)
(output-sql limit database))
(when offset
(write-string " LIMIT " *sql-stream*)
(output-sql limit database))
(when offset
@@
-797,9
+801,9
@@
uninclusive, and the args from that keyword to the end."
(declaim (inline listify))
(defun listify (x)
(declaim (inline listify))
(defun listify (x)
- (if (
atom
x)
- (list x)
-
x
))
+ (if (
listp
x)
+ x
+
(list x)
))
(defmethod output-sql ((stmt sql-create-table) database)
(flet ((output-column (column-spec)
(defmethod output-sql ((stmt sql-create-table) database)
(flet ((output-column (column-spec)
@@
-991,7
+995,9
@@
uninclusive, and the args from that keyword to the end."
(cons (symbol-name-default-case "ZEROFILL") "ZEROFILL")
(cons (symbol-name-default-case "AUTO-INCREMENT") "AUTO_INCREMENT")
(cons (symbol-name-default-case "DEFAULT") "DEFAULT")
(cons (symbol-name-default-case "ZEROFILL") "ZEROFILL")
(cons (symbol-name-default-case "AUTO-INCREMENT") "AUTO_INCREMENT")
(cons (symbol-name-default-case "DEFAULT") "DEFAULT")
- (cons (symbol-name-default-case "UNIQUE") "UNIQUE")))
+ (cons (symbol-name-default-case "UNIQUE") "UNIQUE")
+ (cons (symbol-name-default-case "IDENTITY") "IDENTITY (1,1)") ;; added for sql-server support
+ ))
(defmethod database-constraint-statement (constraint-list database)
(declare (ignore database))
(defmethod database-constraint-statement (constraint-list database)
(declare (ignore database))