[egenix-users] mxODBCZopeDA unicode support

Kevin Campbell kev at logicalware.com
Wed Oct 18 18:46:04 CEST 2006


On Tue, Oct 17, 2006 at 06:16:26PM +0200, Charlie Clark wrote:
> Am 17.10.2006, 18:02 Uhr, schrieb Kevin Campbell <kev at logicalware.com>:
> 
> >Hi,
> >I'm trying to set up unicode support in mxODBCZopeDA, and I can't seem to
> >find any option to do so. There are examples for dealing with the mxodbc
> >library, which involve setting
> >   stringformat = mx.ODBC.Windows.MIXED_STRINGFORMAT
> >Unfortunately, there doesn't seem to be a configuration option for  
> >similar
> >in the zope adapter. The only solution I can see is to subclass the zope
> >adapter and override the connect() method, which would be less than  
> >ideal.
> >Is this the only solution?
> 
> Currently the best solution is to use an ExternalMethod. Apart from the  
> fact that you can't use ZSQL-Methods (well, you could if you pass in the  
> rendered version) this is best way to do this in Zope.

That's unfortunate. Having looked at using the adapter directly, it appears
it does not allow query strings to be passed as unicode objects or deal with
unicode at all in the query method. Rendering ZSQL methods embeds the 
parameters inside the query. It seems it is possible to work around this by
subclassing the connection object, encoding all supplied data as utf-8,
and mapping the results back to unicode objects. This isn't ideal.

I guess there's no alternative solution unless either ZSQL methods can be 
redesigned to maintain a distinction between the query and parameters, or
the query method of the mx.ODBC connection can be altered to accept unicode 
strings. Is the latter possible at all?

Regards,
Kevin

--
Kevin Campbell 
Logicalware Ltd
GPG Key: F480EC23



More information about the egenix-users mailing list