Multiple result sets and ActiveRecord

Here's a question for y'all:

How can I/Is is possible to have ActiveRecord work with multiple
distinct result sets from a single SQL request?

Imagine the following:

<some model>.find_by_sql('SELECT * FROM A; SELECT * FROM B')

Will I just get a bunch of objects of <some model> type with A
attributes and a bunch with B attributes? Or will ActiveRecord bork?

Unfortunately, I just can't 'don't do this'. Here's my dilemma:

I'm in the process of writing a replacement of our application in
Rails. We started in ASP.NET and MS SQLServer. SQL Server doesn't
support nice things like MySQL's OFFSET to make paging lightweight.
Rails' hack for SQL server doesn't, um ... work! In any case we have
some out-of-this-world stored procedures that force SQLServer to do the
paging of our results for us :wink: . The result is two distinct result
sets: the first once contains the total count of rows that *could* be
returned and the second result is a subset of rows from the result set
already sorted, offset, and limited to what I want to display on the
current page.

As you can guess I pretty much need to work with these stored
procedures. Any advice?


Ok, I partially answered my own question...

<some model>.find_by_sql('SELECT * FROM A; SELECT * FROM B')

Will return results only from the first query, ignoring the second. So
my next question: how do I make AR NOT ignore the results from the
second record?

Jim Powers