Thanks for the explanation Sean. That was helpful. Alex
On Tuesday, November 19, 2013 10:05:34 PM UTC-5, Sean Corfield wrote: > > In response to the (very reasonable) question from Alex Hudek in a > recent thread, here are some of my responses to questions that have > arisen about the inclusion of the minimal DSLs in the java.jdbc > contrib library: > > > Just wondering if the intention is to make the DSL the primary way to > work > > with the API or if clojure.java.jdbc.sql will be completely optional? > > Completely optional. > > The idea is just to provide some (optional) sugar for common > operations. I have no intention of going particularly deep on the DSL. > > If folks want a full DSL for SQL in Clojure, I'd suggest > https://github.com/jkk/honeysql or http://sqlkorma.com - the former is > a DSL to generate SQL that is compatible with clojure.java.jdbc, the > latter is a DSL that wraps clojure.java.jdbc. > > > Using the latest release of java.jdbc, does anybody know how I can > > construct a where clause when I want to check if the value is one of > many values? > > clojure.java.jdbc.sql is a deliberately minimal DSL - Justin Kramer's > HoneySQL is what I recommend for more expressive SQL construction > (that's the "official" recommendation based on discussions Justin and > I had about java.jdbc and HoneySQL at Clojure/conj 2012). > > > I want to generate sql string using clojure.java.jdbc.sql for eg. > > > > "SELECT B.ID , B.TITLE ,B.AUTHOR , C.CATEGORY , S.STATUS > > FROM BOOK B ,CATEGORY C , STATUS S > > WHERE (B.CATEGORY_ID=C.ID) AND > > (B.STATUS_ID = B.ID) AND > > (B.TITLE LIKE "%TOM%")" > > > > How to do this using clojure.java.jdbc.sql dsl functions? > > The basic DSL cannot do 'like' so you probably want to look at > HoneySQL which is the recommended way to extend clojure.java.jdbc. > > === > > The justification for the DSL at all is that it provides some sugar > for simple, common usage and also provides a template for other more > expansive DSLs that the community might write, by showing what the > primary API expects in terms of SQL strings and parameter vectors. > > At World Singles, we use the basic DSL to support a lot of "CRUD" > operations that are doing simple lookups, basic joins, and so on - and > we rely on HoneySQL for our reporting queries and anything that is > substantially more complex than the basic DSL offers. > > Will the DSL be expanded to support some additional common SQL operations? > > Perhaps, based on user feedback - assuming people want something > between raw strings and the sophistication of HoneySQL (or any other > DSL that the community may produce). > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > World Singles, LLC. -- http://worldsingles.com/ > > "Perfection is the enemy of the good." > -- Gustave Flaubert, French realist novelist (1821-1880) > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.