Commits

Anonymous committed f0345e4

add is-not-null function

Comments (0)

Files changed (1)

src/main/clj/org/bituf/sqlrat/clause.clj

   (as-clause [(str (str-name k) " NOT NULL")]))
 
 
+(defn is-not-null
+  "Is not null
+   Example: (is-not-null :location) => [\"location IS NOT NULL\"]"
+  [k]
+  (assert k)
+  (as-clause [(str (str-name k) " IS NOT NULL")]))
+
+
 ;;;
 ;; functions on 2 operands: ?-suffixed function names indicate parameterized SQL
 ;; taken from here: http://com.w3schools.com/sql/sql_where.asp
     (assert op)
     (assert k)
     (if (clause? v) (merge-clauses (as-clause (str (str-name k) op))
-                      (enclose v)) ;; sub-query
+                      (enclose v)) ; sub-query
       (as-clause [(str (str-name k) op \?) v])))
   ([op k v if-nil-fn1]
     (if (nil? v) (if-nil-fn1 k)