projects
/
clsql.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r9890: 17 Aug 2004 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git]
/
sql
/
operations.lisp
diff --git
a/sql/operations.lisp
b/sql/operations.lisp
index bc99d2a136eaf02297f8747a9c8e9eb250178393..9d8440a474ca8e41ec8fd12d83310a11085736e0 100644
(file)
--- a/
sql/operations.lisp
+++ b/
sql/operations.lisp
@@
-66,7
+66,7
@@
(defsql sql-minus (:symbol "minus") (&rest rest)
(make-instance 'sql-set-exp
(defsql sql-minus (:symbol "minus") (&rest rest)
(make-instance 'sql-set-exp
- :operator '
except
:sub-expressions rest))
+ :operator '
minus
:sub-expressions rest))
(defsql sql-limit (:symbol "limit") (&rest rest)
(make-instance 'sql-query-modifier-exp
(defsql sql-limit (:symbol "limit") (&rest rest)
(make-instance 'sql-query-modifier-exp
@@
-139,15
+139,25
@@
(make-instance 'sql-relational-exp
:operator 'in :sub-expressions rest))
(make-instance 'sql-relational-exp
:operator 'in :sub-expressions rest))
-(defsql sql-concat
(:symbol "concat
") (&rest rest)
+(defsql sql-concat
-op (:symbol "concat-op
") (&rest rest)
(make-instance 'sql-relational-exp
:operator '\|\| :sub-expressions rest))
(make-instance 'sql-relational-exp
:operator '\|\| :sub-expressions rest))
+(defsql sql-concat (:symbol "concat") (&rest rest)
+ (make-instance 'sql-function-exp
+ :name 'concat :args rest))
+
(defsql sql-substr (:symbol "substr") (&rest rest)
(defsql sql-substr (:symbol "substr") (&rest rest)
+ (if (= (length rest) 3)
+ (make-instance 'sql-function-exp
+ :name 'substr :args rest)
+ (error 'sql-user-error :message "SUBSTR must have 3 arguments.")))
+
+(defsql sql-substring (:symbol "substring") (&rest rest)
(if (= (length rest) 3)
(make-instance 'sql-function-exp
:name 'substring :args rest)
(if (= (length rest) 3)
(make-instance 'sql-function-exp
:name 'substring :args rest)
- (error '
clsql-sql-syntax-error "SUBSTR
must have 3 arguments.")))
+ (error '
sql-user-error :message "SUBSTRING
must have 3 arguments.")))
(defsql sql-is (:symbol "is") (&rest rest)
(make-instance 'sql-relational-exp
(defsql sql-is (:symbol "is") (&rest rest)
(make-instance 'sql-relational-exp
@@
-213,7
+223,7
@@
(defsql sql-between (:symbol "between") (&rest rest)
(if (= (length rest) 3)
(make-instance 'sql-between-exp :name 'between :args rest)
(defsql sql-between (:symbol "between") (&rest rest)
(if (= (length rest) 3)
(make-instance 'sql-between-exp :name 'between :args rest)
- (error '
clsql-sql-syntax-error
"BETWEEN must have 3 arguments.")))
+ (error '
sql-user-error :message
"BETWEEN must have 3 arguments.")))
(defsql sql-distinct (:symbol "distinct") (&rest rest)
(make-instance 'sql-query-modifier-exp :modifier 'distinct
(defsql sql-distinct (:symbol "distinct") (&rest rest)
(make-instance 'sql-query-modifier-exp :modifier 'distinct
@@
-224,5
+234,11
@@
:name 'coalesce :args rest))
(defsql sql-nvl (:symbol "nvl") (&rest rest)
:name 'coalesce :args rest))
(defsql sql-nvl (:symbol "nvl") (&rest rest)
+ (if (= (length rest) 2)
+ (make-instance 'sql-function-exp
+ :name 'coalesce :args rest)
+ (error 'sql-user-error :message "NVL accepts exactly 2 arguments.")))
+
+(defsql sql-userenv (:symbol "userenv") (&rest rest)
(make-instance 'sql-function-exp
(make-instance 'sql-function-exp
- :name '
coalesce
:args rest))
+ :name '
userenv
:args rest))