I’m using Glorp in VisualWorks and with an Oracle database. Because Oracle does not know the LIMIT command, following query returns all the records of myTable for which the WHERE clause evaluates to true.
q := Glorp.SimpleQuery
returningManyOf: MyTable
where: [:each | each name = 'test']
limit: 10.
q orderBy: [:each | each id descending].
results:= aGlorpSession execute: q.
How would I go to incorporate ROWNUM in this Glorp query?
//edit Generated SQL:
SELECT t1.id, t1.name
FROM MyTable t1
WHERE (t1.name= ?) ORDER BY t1.id DESC
On Smalltalk.Glorp.DatabasePlatform I added two empty methods #printPreLimitWrapper:on: and #printPostLimitWrapper:on: which I override in Smalltalk.Glorp.OraclePlatform:
On Smalltalk.Glorp.SimpleQuery I added:
And on Smalltalk.Glorp.QuerySelectCommand I altered the following method: