Automated commit for debian release 6.7.2-1
[clsql.git] / sql / operations.lisp
index 7b558809a2503a2c65d4b459ece9a80a7b4ce575..faa22b5af7a8788aea28ef66d14b7b5619edf734 100644 (file)
@@ -46,6 +46,9 @@
   (make-instance 'sql-function-exp
                  :name 'all :args rest))
 
+(defsql sql-e-string (:symbol "E") (&rest rest)
+  (make-instance 'sql-escape-string-exp :string (first rest)))
+
 (defsql sql-not (:symbol "not") (&rest rest)
   (make-instance 'sql-value-exp
                  :modifier 'not :components rest))
   (make-instance 'sql-query-modifier-exp
                  :modifier 'having :components rest))
 
-(defsql sql-null (:symbol "null") (&rest rest)
-  (if rest
+(defsql sql-null (:symbol "null") (&optional not-null-thing)
+  (if not-null-thing
       (make-instance 'sql-relational-exp :operator 'is
-                     :sub-expressions (list (car rest) nil))
+                     :sub-expressions (list not-null-thing nil))
       (make-instance 'sql-value-exp :components 'null)))
 
-(defsql sql-not-null (:symbol "not-null") ()
-  (make-instance 'sql-value-exp
-                 :components '|NOT NULL|))
+(defsql sql-not-null (:symbol "not-null") (&optional not-null-thing)
+  (if not-null-thing
+      (make-instance
+       'sql-relational-exp
+       :operator 'IS
+       :sub-expressions (list not-null-thing
+                              (sql-expression :string "NOT NULL")))
+      (sql-expression :string "NOT NULL")))
 
 (defsql sql-exists (:symbol "exists") (&rest rest)
   (make-instance 'sql-function-exp