Say you have a simple rule that if people pay within a timeframe they get a X% discount
select ..... price*(1-X/100) from .... where ... paydate between startdiscount and enddiscount It is likely that there will be multiple SQL statements that will contain some form of this rule. A good approach is to find a way to compose multiple rules into a single query. There are many alternatives, views, database functions, manipulating/aggregating clojure structures that represent SQL queries. To make matters worse, this simple rule will also have a counterpart in the UI and possibly in other non SQL code. That is why a production system is appealing to me. You could just write a rule like this. (defrule timed-discount ( ....(between paydate startdiscount enddiscount) ... ) ( ... (:price (* :price (- 1 (/ X 100) ) ) ) ....) ) And it won't just create the SQL, but also be available for execution in the JVM or in say clojure script. All because the rule is declarative by nature. I think the shortcoming of ORM tools is that they bring a higher level technology like SQL and lower it down to the low level of imperative languages. A rule based system would not suffer from that problem. On Wednesday, October 30, 2013 8:50:48 AM UTC-5, Ray Miller wrote: > > On 30 October 2013 11:47, Kris Jenkins <krisaj...@gmail.com > <javascript:>>wrote: > >> FWIW, I too am interested in a better SQL tool for Clojure, but my take >> on it is that we don't need a new language on top of SQL, but a better way >> to use SQL directly. >> >> My thinking, plus an *alpha-grade* library, can be found here: >> https://github.com/krisajenkins/yesql#rationale >> > > Something similar I'm using in production on a couple of sites: > > https://github.com/ray1729/sql-phrasebook > > Ray. > > -- -- 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.