Thanks.  I only WISH I could do it on the db side.  As I don't have any control 
over the database (thank you vendor), I have to deal with it on the other side 
of an ODBC link.  Ugh!

Although I am in the midst of working out a caching scheme to help speed things 
up a bit.

I will give this a try and hope it's not too bad a hit on me.

Thanks again,


P.S.  mx.ODBC rocks!!

-----Original Message-----
From: Charlie Clark [mailto:[EMAIL PROTECTED]
Sent: Friday, September 23, 2005 12:15 PM
To: Dale Hirt
Subject: Re: [Zope-DB] Combine Result Sets

On 2005-09-23 at 18:14:40 [+0200], Dale Hirt <[EMAIL PROTECTED]> wrote:
> Hello,
> I have been searching both online and in this list's archives.  I am still 
> a bit stumped however.  I have two different ODBC connections to two 
> different Caché DB's.  They have the exact same structure and column names 
> and types.  I run a query against each of the connections and get back a 
> Shared.DC.ZRDB.Results class in each case.
> Has anyone come up with code to combine the results?  I would be much 
> appreciative.  If not, a pointer in the right direction would be helpful.

Hi Dale,

if I understand you correctly, you want to be able to UNION the two queries. 
If that is the case then I'd be tempted to do this on the database side if 
possible. Of course, Zope does make it easy to integrate the two result sets 
using a PythonScript.

As you can interate through the objects you can easily create two lists and 
combine them:

results = list(context.SQL1())
results += list(context.SQL2())

If performance is an issue then you should look at combining the results on 
the db side.

Charlie Clark

Professional Python Services directly from the Source
 >>> Python/Zope Consulting and Support ...
 >>> mxODBC.Zope.Database.Adapter ...   
 >>> mxODBC, mxDateTime, mxTextTools ...

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
Zope-DB mailing list

Reply via email to