X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Foperations.lisp;h=3270a83b3bcfdb1ef1a9d87905fe91a44a76b8d9;hb=9fb9efd51ef0477050f2c2ef0fe32bf1bef97067;hp=a3f6bbd09fefd79a504f78f95f87e92a1fa4fb3f;hpb=e567409d9fff3f7231c2a0bb69b345e19de2b246;p=clsql.git diff --git a/sql/operations.lisp b/sql/operations.lisp index a3f6bbd..3270a83 100644 --- a/sql/operations.lisp +++ b/sql/operations.lisp @@ -74,11 +74,11 @@ (defsql sql-group-by (:symbol "group-by") (&rest rest) (make-instance 'sql-query-modifier-exp - :modifier '|group by| :components rest)) + :modifier '|GROUP BY| :components rest)) (defsql sql-order-by (:symbol "order-by") (&rest rest) (make-instance 'sql-query-modifier-exp - :modifier '|order by| :components rest)) + :modifier '|ORDER BY| :components rest)) (defsql sql-having (:symbol "having") (&rest rest) (make-instance 'sql-query-modifier-exp @@ -123,6 +123,21 @@ (make-instance 'sql-relational-exp :operator 'like :sub-expressions rest)) +(defsql sql-~* (:symbol "~*") (&rest rest) + "This is the postgres regex match operator" + (make-instance 'sql-relational-exp + :operator '~* :sub-expressions rest)) + +(defsql |sql-~* ANY| (:symbol "~* ANY") (&rest rest) + "This is the postgres regex match any in an array" + (make-instance 'sql-relational-exp + :operator '|~* ANY| :sub-expressions rest)) + +(defsql sql-array (:symbol "array") (&rest rest) + "This is the postgres regex match any in an array" + (make-instance 'sql-array-exp + :operator 'array :sub-expressions rest)) + (defsql sql-uplike (:symbol "uplike") (&rest rest) (make-instance 'sql-upcase-like :sub-expressions rest)) @@ -153,6 +168,7 @@ :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 @@ -233,6 +249,16 @@ (make-instance 'sql-function-exp :name 'coalesce :args rest)) +(defsql sql-left (:symbol "left") (&rest rest) + "mssqlserver uses this to get the left n chars of a string" + (make-instance 'sql-function-exp + :name 'left :args rest)) + +(defsql sql-right (:symbol "right") (&rest rest) + "mssqlserver uses this to get the right n chars of a string" + (make-instance 'sql-function-exp + :name 'right :args rest)) + (defsql sql-nvl (:symbol "nvl") (&rest rest) (if (= (length rest) 2) (make-instance 'sql-function-exp @@ -254,3 +280,10 @@ (make-instance 'sql-function-exp :name 'upper :args rest) (error 'sql-user-error :message "UPPER must have 1 argument."))) + +(defsql sql-date_part (:symbol "date_part") (&rest rest) + "the date_part function for postgres" + (if (= (length rest) 2) + (make-instance 'sql-function-exp + :name 'date_part :args rest) + (error 'sql-user-error :message "date_part must have 2 arguments.")))