Guest User

Untitled

a guest
Feb 3rd, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. testapp.core=> (select testt (where (and {:acronym [like "%on%"]} {:name [like "%an%"]})))
  2. ({:id 11, :app_id 5122, :name "Sem Vitae Aliquam Company", :acronym "Henderson"} {:id 76, :app_id 1090, :name "Erat Company", :acronym "Fontenoille"})
  3.  
  4.  
  5. testapp.core=> mysearch
  6. {:acronym "%on%", :name "%an%"}
  7.  
  8.  
  9. testapp.core=> (select testt (where (and (map (fn [[key val]] ({key [like val]}))) mysearch)))
  10. ()
  11.  
  12.  
  13. testapp.core=> (sql-only(select testt (where (and (map (fn [[key val]] ({key [like val]}))) mysearch))))
  14. "SELECT `test`.* FROM `test` WHERE (? AND (`test`.`acronym` = ? AND `test`.`name` = ?))"
  15.  
  16.  
  17. testapp.core=> (dry-run(select testt (where (and (map (fn [[key val]] ({key [like val]}))) mysearch))))
  18. dry run :: SELECT `test`.* FROM `test` WHERE (? AND (`test`.`acronym` = ? AND `test`.`name` = ?)) :: [#object[clojure.core$map$fn__4549 0x720696f clojure.core$map$fn__4549@720696f] %on% %an%]
  19. [{:id 1}]
Advertisement
Add Comment
Please, Sign In to add comment