Permalink
Browse files

better db-string fn (now supports wrapper, prefix, and postfix keys t…

…o make LIKE clauses easier to make
  • Loading branch information...
1 parent 9e82887 commit 3f7dcf4d105a01864cfcb9335b1696746cd0a867 @bobbysmith007 bobbysmith007 committed Mar 20, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 clsql.lisp
View
4 clsql.lisp
@@ -15,14 +15,14 @@
(make-instance 'clsql-sys:sql-ident-attribute
:name column :qualifier table))
-(defun db-string (s)
+(defun db-string (s &key (prefix "")(postfix "")(wrapper "") )
"escapes and wraps in single quotes so that the string is ready
to be spliced into a query (eg: with cl-interpol)"
(let ((it (trim-and-nullify (typecase s
(string s)
(t (princ-to-string s))))))
(when it
- #?"'${(clsql-sys:sql-escape-quotes it)}'")))
+ #?"'${prefix}${wrapper}${(clsql-sys:sql-escape-quotes it)}${wrapper}${postfix}'")))
(defun %clsql-subclauses (clauses)
(iter (for c in clauses)

0 comments on commit 3f7dcf4

Please sign in to comment.