On Thursday, December 20, 2012 8:37:07 AM UTC-8, Charles Monteiro wrote:
>
> hi, I tried finding my answer by querying the posts here, but nothing
> quite jumped out.
>
> I'm trying to write code that is transparent at least minimally across
> Oracle and PG but obviously it would be really nice gravy to get it across
> some of the other major enterprise RDMS at the very least MS Sequel Server.
>
> The other issue to consider is that we plan to deploy over JRuby and are
> leveraging the Sequel JDBC drivers , so worst case for the scenario(s) that
> require the use of a cursor I can write code that is not so transparent I
> would appreciate some pointers there if I do have to resort to that
> approach.
>
> To be clear , I want to be able to manage what records get faulted into
> memory for a given query i.e. just in case there's effectively some other
> mechanism that does as much but by another name,
>
There's no cursor support in Sequel's jdbc adapter, unless it happens at a
level below Sequel (i.e. internal to the JDBC driver). Sequel uses an
enumerable interface for all database access, which is similar to how
cursors work. This allows you to stop processing a result set early if you
decide you don't need all rows.:
DB[:table].each{|row| row.break if row[:column] == 5}
Now depending on the underlying driver, that may still load all rows in the
table into memory. But Sequel itself processes the result a row at a
time. If you are using a driver that uses a cursor or another
streaming-type interface under the hood, you can process large result sets
without loading all rows into memory simultaneously.
In general, Sequel does a pretty good job at database-independence. If you
have questions about specific database-portability issues with Sequel,
please ask them, but it's certainly possible to use Sequel to write an
application that works on both Oracle, PostgreSQL, and Microsoft SQL Server.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sequel-talk/-/GONTZ_AavD4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.