LauJensen / clojureql

ClojureQL is superior SQL integration for Clojure
https://clojureql.sabrecms.com
Eclipse Public License 1.0
285 stars 39 forks source link

rownum problem with versions later than 1.0.0 #117

Closed ariel123 closed 12 years ago

ariel123 commented 12 years ago

In version 1.0.0 I was able to use rownum to query Oracle with no problem:

(select tbl (where (<= :rownum 2)))

It generated sql that works, i.e.

select mytable.* where rownum <= 2

but with later versions, [clojureql "1.1.0-SNAPSHOT"] the generated sql looks like that and of course it fails:

select mytable.* where mytable.rownum <= 2

Is there a way to fix it?

bendlas commented 12 years ago

you should be able to say (select tbl (where (<= "rownum" 2)))

ariel123 commented 12 years ago

That didn't work, it gave the following error: CompilerException java.sql.SQLSyntaxErrorException: ORA-01722: invalid number

bendlas commented 12 years ago

Ah, yes. It's taken as a String value in that case. Sorry.

The fact is, that column references are supposed to be quoted, so it's not an easy fix.

We would need some syntax for identifiers, that should be left alone.

In the meantime, please use (select tbl (where "rownum <= 2"))

ariel123 commented 12 years ago

Thank you. Your suggestion worked.