X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fexpressions.lisp;h=d09b154e0ef99907195f6b41f078f420e7c95283;hb=78da4831fd20e83f64c74fd6140ed6e8ee73a495;hp=2b9b913da4685ed9180d0abd5156015092037ff9;hpb=43ebc59a11ebc66f3405e85f6aba5351ab707fb3;p=clsql.git diff --git a/sql/expressions.lisp b/sql/expressions.lisp index 2b9b913..d09b154 100644 --- 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 (and limit (eql :mssql (database-underlying-type database))) + (write-string " TOP " *sql-stream*) + (output-sql limit database) + (write-string " " *sql-stream*)) (when all - (write-string "ALL " *sql-stream*)) + (write-string " ALL " *sql-stream*)) (when (and distinct (not all)) - (write-string "DISTINCT " *sql-stream*) + (write-string " DISTINCT " *sql-stream*) (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)) @@ -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 limit + (when (and limit (not (eql :mssql (database-underlying-type database)))) (write-string " LIMIT " *sql-stream*) (output-sql limit database)) (when offset