[Zope] Request.py and duplicate column names
TFE MMS JARVIS JOHN
jarvis.sd082@ex.tel.co.jp
Tue, 2 Mar 1999 18:40:22 +0900
Hi All!
First off, I'd like to thank Digital Creations for an excellent (and
really fun) product.
I'm building a prototype web site interface for a database where I
work using Zope 1.10.2 and the ZOracleDA product and have a some
questions.
1. When trying to do a join (a lazy query, I know) like:
select a.*, b.*
from tablea a, tableb b
where a.b_id=a.id
Both tables have an ID column so Zope raises a 'ValueError'
exception with the message 'Duplicate column name, ID'.
I wonder if instead of raising an exception something like the
following could be done?
A diff of Shared/DC/ZRDB/Results.py:
120,131c120
< #raise ValueError, 'Duplicate column name, %s' % name
<
< #instead of error, append an extension to
< #create a unique name
< tempname=name
< nameext=1
< while schema.has_key(name):
< name=tempname+'_'+str(nameext)
< nameext=nameext+1
<
< #update with newly created name
< item['name']=name
---
> raise ValueError, 'Duplicate column name, %s' % name
I tested this some and it seems to work. Are there any problems
that could be caused by doing this?
2. I'll post the other questions separately because they are
unrelated.
TIA!,
John Jarvis
Tokyo Electron, FE Ltd.