[Zope] ODBC Test Queries

Schmidt, Allen J. aschmidt@nv.cc.va.us
Wed, 18 Jul 2001 12:20:32 -0400


Great! Thanks!

I should be able to give this a try shortly. I use it a lot so that
functionality was sorely missed. 

Allen

-----Original Message-----
From: Christian Tismer [mailto:ctismer@gmx.net]
Sent: Wednesday, July 18, 2001 12:20 PM
To: Schmidt, Allen J.
Cc: 'zope@zope.org'; Tim Cook
Subject: Re: [Zope] ODBC Test Queries




"Schmidt, Allen J." wrote:
> 
> Not sure how many use the feature but I do all the time. The ODBC Test
> window.
> 
> Recently, not sure when it started, but when I execute a generic select
> statement, and the are  more that 25 results, I get the link at the bottom
> for the next batch. However, the query' is not getting passed to this link
> and so I do not actually get the next set. Instead I get an error stating
> the obvious - 'query' was not defined.

I had a closer look at it.
The problem exists with Gadfly as well. It only occourse when
you use a database connection and test it with some test SQL.
This is a limitation in Connection.py .
If you use ZSQLmethods, you will not have this problem.

Reason: ZSQLmethods carry their SQL template as a property.
A simple connection does not, since it has no permanent
property for the (temporary) SQL string. The alternative would
be to pass the SQL string as a parameter to the "next 50" link.
This isn't very nice since this is a GET request, which is limited
in size. But for not too large test SQL input, it will work.

Here the patch:

Edit the file "Connection.py"  (dir D:\Zope\lib\python\Shared\DC\ZRDB)

Locate line 189 ff in manage_test:

        if REQUEST is None:
            return result       #return unadulterated result objects

Add the following code snippet:

        #CT: passign the query parameter to the "next 50 results" link
        import urllib        
        REQUEST.environ["QUERY_STRING"] = "query=" + urllib.quote(query)


That's all, folks. The query will now be rendered as part of the
URL, and it works.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net/
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com/