[egenix-users] mxODBC Cursor Unicode issue with method executedirect().

Cliff Xuan Cliff.Xuan at artsalliancemedia.com
Tue Aug 7 17:16:02 CEST 2007


The query itself is fine as it works in MS SQL Query Browser.
I found it might be a Microsoft problem
http://support.microsoft.com/kb/821789
Weird though as it's a problem in SQL Server 2000, but my db is 2005.
Never mind. 
You mentioned that I shouldn't need to use executedirect() with MS SQL.
What's the reason behind that? Is it to do with the Python type binding?

Many Thanks
Cliff Xuan 

Arts Alliance Media Ltd
Company Registration No. 04801432 
Registered office: 9-11 North End Road, London W14 8ST 
Registered in England & Wales

-----Original Message-----
From: Charlie Clark [mailto:charlie at egenix.com] 
Sent: 07 August 2007 15:50
To: Cliff Xuan; egenix-users at egenix.com
Subject: Re: [egenix-users] mxODBC Cursor Unicode issue with method
executedirect().

Am 07.08.2007, 16:37 Uhr, schrieb Cliff Xuan  
<Cliff.Xuan at artsalliancemedia.com>:

> selectsql2= """
>                 select id
>                 from vwUserWide
>                 where
>                 caller_language_id in ('none','en') and (
>                 username like ('%' + ? + '%')
>                 or (coalesce(firstname+' ','')+coalesce(lastname,''))
> like ('%' + ? + '%')
>                 or email like ('%' + ? + '%')
>                 or venue_longname like ('%' + ? + '%')
>                 or venue_shortname like ('%' + ? + '%') )
>             """
> cur.execute(selectsql2,  [(u'\xe5', u'\xe5', u'\xe5',
> u'\xe5',u'\xe5',)])
> cur.executedirect(selectsql2,  [(u'\xe5', u'\xe5', u'\xe5',
> u'\xe5',u'\xe5',)])
> This time executedirect() returns nothing as before. Execute() doesn't
> work any more, the error message reads "Unable to derive parameter
> information when parameter marker is a function argument".

This is a bit of a convoluted query but it looks like there is a problem

with the ('%' + ? + '%') syntax. Can you rewrite that using strings?
ie.,  
'%?%' and this should get recognised as a string for quoting purposes.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
>>> 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,MacOSX for free ! ::::

     eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
            Registered at Amtsgericht Duesseldorf: HRB 46611



More information about the egenix-users mailing list