OFFSET, LIMIT not showing up in the DB logs

17 views
Skip to first unread message

Collin VanDyck

unread,
Oct 22, 2010, 10:26:41 AM10/22/10
to Lift
Using this function in Boot.scala:

DB.addLogFunc { (log: DBLog, time: Long) =>
info("query took " + time + " ms: " +
log.statementEntries.map(_.statement).mkString("\n"))
}

I'm fairly sure that LIMIT and OFFSET are being set by MetaMapper but
it threw me for a minute that they were not appearing in the DB logs.
Other tokens like SELECT, WHERE, and ORDER BY show up as expected.

Is there a way that I can get these to render in the logs as well?

David Pollak

unread,
Oct 22, 2010, 10:28:44 AM10/22/10
to lif...@googlegroups.com

What database are you using?

> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>

Collin VanDyck

unread,
Oct 22, 2010, 10:34:30 AM10/22/10
to Lift
DBCP + oracle.jdbc.driver.OracleDriver

On Oct 22, 10:28 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> .> For more options, visit this group at
>
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
>
>
>
>
>

Collin VanDyck

unread,
Oct 22, 2010, 10:35:47 AM10/22/10
to Lift
More specifically Oracle 10.2

On Oct 22, 10:34 am, Collin VanDyck <col...@nimbletechnique.com>
wrote:

Derek Chen-Becker

unread,
Oct 22, 2010, 11:07:18 AM10/22/10
to lif...@googlegroups.com
AFAIK, Oracle doesn't support LIMIT/OFFSET. It does support a function called ROW_NUMBER that can be used in a similar fashion, but Mapper doesn't have support for ROW_NUMBER. Details:

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions137.htm#sthref1981

We should probably add support for this, but at first glance this looks like a non-trivial change to MetaMapper because of the nested queries.

Derek

To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.

Collin VanDyck

unread,
Oct 22, 2010, 11:20:33 AM10/22/10
to Lift
Hi Derek,

Thanks for the update. I was thinking about contributing this change
back, but I'm afraid my Scala-Fu is not strong enough at the moment.
Maybe I'll take a look - anyways, appreciate the help, this is going
to speed up some of my queries :)

Collin



On Oct 22, 11:07 am, Derek Chen-Becker <dchenbec...@gmail.com> wrote:
> AFAIK, Oracle doesn't support LIMIT/OFFSET. It does support a function
> called ROW_NUMBER that can be used in a similar fashion, but Mapper doesn't
> have support for ROW_NUMBER. Details:
>
> http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functi...
> > <liftweb%2Bunsu...@googlegroups.com<liftweb%252Bunsubscribe@googlegroup s.com>>

David Pollak

unread,
Oct 22, 2010, 11:23:49 AM10/22/10
to lif...@googlegroups.com
On Fri, Oct 22, 2010 at 8:07 AM, Derek Chen-Becker <dchen...@gmail.com> wrote:
AFAIK, Oracle doesn't support LIMIT/OFFSET. It does support a function called ROW_NUMBER that can be used in a similar fashion, but Mapper doesn't have support for ROW_NUMBER. Details:

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions137.htm#sthref1981

We should probably add support for this, but at first glance this looks like a non-trivial change to MetaMapper because of the nested queries.

Hmmm... seeing as the whole proto thing is happening... is it a good time to do surgery on MetaMapper as well?

Tangentially, I had some code where I split all the JDBC handling out of the mapper package into a separate jdbc package.  It was a big hairy mess that will be easier once Lift is 2.8 only.  But that'll also be a substantial post 2.2 change to Lift... should we hold off on MetaMapper surgery until then?



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

Derek Chen-Becker

unread,
Oct 22, 2010, 11:44:40 AM10/22/10
to lif...@googlegroups.com
Yes, I think so. Right now having both 2.7.7 and 2.8.0 support complicates major restructuring, and this is a relatively minor thing. I've opened a ticket for it without a milestone just so we can track it, but I think it's OK to hold off for now.

https://liftweb.assembla.com/spaces/liftweb/tickets/692-add-support-for-using-row_number-with-oracle-to-achieve-limit-offset

Derek
Reply all
Reply to author
Forward
0 new messages