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

Derek Simkowiak dereks@realloc.net
Mon, 4 Mar 2002 15:43:28 -0800 (PST)


-> 	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.

	What am I missing?  Did I install an unstable beta release?  This
is version 2.0.9, the latest I could find.  I was recommending Zope +
MySQL as a solution for my client, but these basic, rudimentary errors are
changing my mind.  Version 2.0.9 and not even the fscking "test" page
works... what is up with that?


Thanks,
Derek
P.S.>
	
What was happening:

	I was testing with the string 

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)

	This results in an SQL code error, ala this result:

Error Value: (1064, "You have an error in your SQL syntax near '; LIMIT 
1000' at line 1")

	So changing my test string from "select * from applicants;"  to
"select * from applicants" fixed my problem.  I assume I'll have a similar
problem when I write my Z SQL method.

	Anyway, the SQL sytax error resulted in an exception, which
resulted in a call to _abort(), which tried to access self.lock (instead
of self._lock).

	Thank god I've been working with Python lately.  This and stories
of severe memory corruption in Zope 2.4.3 are highly disturbing.