[egenix-users] mxODBCZopeDA unicode support
M.-A. Lemburg
mal at egenix.com
Wed Oct 18 20:27:49 CEST 2006
Kevin Campbell wrote:
> 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?
The next release of our mxODBC Zope DA will have support for dealing
with Unicode directly and also allow transparent encoding/decoding
of queries and results.
Note that the underlying mxODBC itself does work with Unicode,
so this is currently only a limitation in the Zope DA.
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Oct 18 2006)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the egenix-users
mailing list