X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Foperations.lisp;h=9d8440a474ca8e41ec8fd12d83310a11085736e0;hp=b4d3eab8db559a4848640a754e8e4882e36f093b;hb=b5890c31a60303397efedb2110f46c6388426170;hpb=8c6c643e3debe875bd14408cc3129d8148dfd125 diff --git a/sql/operations.lisp b/sql/operations.lisp index b4d3eab..9d8440a 100644 --- a/sql/operations.lisp +++ b/sql/operations.lisp @@ -66,7 +66,7 @@ (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 @@ -139,16 +139,26 @@ (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)) +(defsql sql-concat (:symbol "concat") (&rest rest) + (make-instance 'sql-function-exp + :name 'concat :args rest)) + (defsql sql-substr (:symbol "substr") (&rest rest) (if (= (length rest) 3) (make-instance 'sql-function-exp - :name 'substring :args rest) + :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) + (error 'sql-user-error :message "SUBSTRING must have 3 arguments."))) + (defsql sql-is (:symbol "is") (&rest rest) (make-instance 'sql-relational-exp :operator 'is :sub-expressions rest)) @@ -224,5 +234,11 @@ :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 - :name 'coalesce :args rest)) + :name 'userenv :args rest))