Request.py and duplicate column names
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.
On 2 Mar 99, at 18:40, TFE MMS JARVIS JOHN wrote:
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
What about select * from tablea a, tableb b where a.b_id=a.id Wouldn't this give you vars called a.id and b.id? Hmmm... I bet Zope won't like that. Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com ICQ: 14856937
Brad Clements wrote:
On 2 Mar 99, at 18:40, TFE MMS JARVIS JOHN wrote:
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
Is there any chance that you're trying to do something like: select * from a, b where a.b_id = b.id ^ Note that I'm joining a field in a to a field in b here (not 2 fields in a) Hope this helps. --chris
participants (3)
-
Brad Clements -
chris.hunter@humancode.com -
TFE MMS JARVIS JOHN