[Zope-DB] log sql generated

Dieter Maurer dieter@handshake.de
Fri, 29 Nov 2002 22:31:04 +0100


Ben Avery writes:
 > ...
 > Is there a way of logging the sql generated by the ZSQL methods, so I 
 > can locate the bug more easily?
When we had big problems at my former employer with
Oracle 8.1.7 (a long time ago), I added logging to
ZOracleDA. It provided the SQL command and the timing
for the command.

   You can do something like that for your DA, too.
   (You will use Zope's logging facility in the module "zLog"
   for that).

   But it requires code modification.

An alternative:

   When you call a Z SQL method with a parameter "src_=1",
   it does not execute the generated SQL but instead returns
   the source.

 > or if I have to hack the source, which file would this be in?
Z SQL Methods are implemented in "Shared/DC/ZRDB/DA.py".
When you go for the DA apprach, it will probably in
the "db.py" file of your DA product.


Dieter