[Zope] "Zope DB instance has no attribute 'lock'"

Matthew T. Kromer matt@zope.com
Mon, 04 Mar 2002 17:56:26 -0500


Derek Simkowiak wrote:

>-> 	Should I change those three instances of self.lock to be 
>-> self._lock?
>
>	More info: doing this fixed my problem.  I am shocked and amazed
>that a product that *must* be one of the most popular around could have a
>typo in it (assuming, of course, that this is the Correct Fix for this
>particular problem).
>
>	What's worse, this bug was caused by another (imho) "bug", see 
>below for details.
>
>[...]
>
>
>SELECT * FROM applicants;
>
>	This results in an exception, caused by (imho) another "bug" in
>the database adapter.  It limits the number of results to 1000 on SELECT
>for whatever reason -- but when it adds the LIMIT code, it does not remove 
>the ";" at the end.  Here is the relevant code:
>
>                   if qtype == "SELECT" and max_rows:
>                       qs = "%s LIMIT %d" % (qs,max_rows)
>                       r=0
>                   db.query(qs)
>

Well, for what its worth, Andy made those changes to the DA based on 
some stability feedback I'd given him, and because he probably didn't 
get a whole lot of people testing the beta, it slipped through.  I know 
I make errors like this from time to time (the primary code path works 
but a secondary code path never is exercised).

Also, I dont think any of the Zope DAs do the right thing when you 
suffix the SQL command terminator to a command.  Granted, I think they 
should tolerate it, but they don't have to.  This has to do with the 
fact that most of the program APIs to databases do NOT use a semicolon 
in their API calls, only the bare statement is used.

I'd dearly love to see a re-implementation of Zope's RDBMS core 
interfaces, but this is not a trivial undertaking, and without a 
customer-funded requirement, Zope Corporation is not likely to perform 
that task.  I find there to be some troubling semantic issues with only 
exposing the API interface "query" from a connection object.  Still, not 
so troubling that I feel motivated to turn it in to an after-hours rewrite.

-- 
Matt Kromer
Zope Corporation  http://www.zope.com/