Re: [Zope] dtml-sqltest and capital column names
Talking to myself A slight correction to my patch so that tablename.columname will be rendered as to "tablename"."columnname". 146c146 from string import find, split, join, atoi, atof --- from string import find, split, join, atoi, atof, replace 165,166c165,166 if has_key('column'): self.column=args['column'] else: self.column=self.__name__ --- if has_key('column'): self.column='"'+replace(args['column'], '.', '"."')+'"' else: self.column='"'+replace(self.__name__, '.', '"."')+'"' It would be nice if someone could comment whether this makes sense for other dbs too. cheers, oliver ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] dtml-sqltest and capital column names
Hi, I'm using zope 2.2.2 with postgres 7.0.2 and ZPopyDA 0.6.4. I encountered a problem with dtml-sqltest and capitals in column names. Well, I simply couldn't get it to work because postgres requires column-names with "special characters" like capitals to be enclosed with quotation marks, ie. "COLUMNNAME" instead of COLUMNNAME - IIRC '_' also won't work. The problem is that dtml-sqltest only renders select * from table where COLUMNNAME='5' which will be interpreted by postgres like select * from table where columnname='5' Unfortunatly dtml-sqltest bla column="BLA" type=int throws the obvious error and everything else I tried didn't work too. In the end I patched lib/python/Shared/DC/ZRDB/sqltest.py to do what I want. 165,166c165,166 if has_key('column'): self.column=args['column'] else: self.column=self.__name__ --- if has_key('column'): self.column='"'+args['column']+'"' else: self.column='"'+self.__name__+'"' Any comment whether this would also apply/be necessary for other dbs? And if not, would there a better place (anywhere in ZPopyDA) to change/add some code? Or did I just miss something obvious and there's a sane way to make dtml-sqltest work with postgres and capitals. cheers, oliver ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )