On Nov 25, 8:28 am, LauJensen <lau.jen...@bestinclass.dk> wrote:
> ClojureQL:
>
> (defn oracle-take
>   [tname limit]
>   (-> (table (str "(SELECT ROW_NUMBER() OVER (ORDER BY key ASC)"
>                   " AS rownumber,columns"
>                   " FROM " (to-tablename tname) ")"))
>       (select (where (<= :rownumber limit)))
>       (project ["*"])))
>
> (to-sql (oracle-table :users 10))
> ["SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY key ASC) AS
> rownumber,columns FROM users) WHERE (rownumber <= ?)" 10]
>
> From the outset it has been my ambition to make ClojureQL extremely
> composable and as far as possible allow users to directly insert
> strings into the query to allow for backend specific customization.
> The entire design-plan of this customization is not yet thought out so
> input is welcomed. To me, flexibility and leaving with the power to
> the user is the key to wide adoption across various backends.
>

My experience would agree with this assumption. I looked at the
original Clojure QL for use with H2 but didn't want to put in the
effort of writing a H2 driver to TEST a library that I may want to
use. If I can play with the library and I like it, its then no problem
at all to write some small workarounds for the non-standard behaviour
of the database I'm using.

Ideally though, it would be nice if workarounds for various databases
were added to the library as the appear - so in this example I can
call oracle-take without having to write it myself.

Saul

-- 
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

Reply via email to