[Zope] Using SQL aggregate functions
John Williams
J.A.R.Williams@aston.ac.uk
01 Mar 2000 07:19:49 +0000
>>>>> "Monty Taylor" <mtaylor@goldridge.net>= writes:
Monty> I think I've found a small bug in ZMySQLDA. In db.py, there
Monty> is a dictionary called defs, which maps the types returned
Monty> by MySQL into single letter type flags, or some such
Monty> thing. When you use an aggregate function such as count,
Monty> the type returned is 'unhandled', which doesn't have a
Monty> matching key in the defs dictionary. I edited the db.py
Monty> file, adding an entry for 'unhandled' mapping it to 't'. I
Monty> don't know that 't' is really what it wants, maybe someone
Monty> else can shed light on which type would be better.
Monty>...
Monty> John Williams wrote:
>> I have been trying to use SQL aggregate functions in SQL
>> Methods to calculate some statistics e.g. something like
>>
>> SELECT id,count(id) from data group by field
>>
>> I am using MySQL, and the query works if entered directly from
>> another client, however Zopes SQL method returns an error. Is
>> this a known problem. Is there a known workaround or patch?
Thank you. This 'patch' did in fact work although the problem was in fact more
subtle than originally described - the 'unhandled' type error only
arose if I used joins in the select part of the statement.
--
Dr. John A.R. Williams