[freetds] Function sequence error from Linux => SQL Server 2000

Charles Bearden Charles.F.Bearden at uth.tmc.edu
Fri Apr 30 10:44:58 EDT 2004


> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org [mailto:freetds-
> bounces at lists.ibiblio.org] On Behalf Of ZIGLIO, Frediano, VF-IT
> Sent: Friday, April 30, 2004 1:38 AM
> To: FreeTDS Development Group
> Subject: RE: [freetds] Function sequence error from Linux => SQL
Server
> 2000
> 
> >
> > I appreciate James's and freddy77's responses.  I am learning
> > from this.
> > One more puzzling tidbit: I can insert the 8410 byte long record
into
> > the database as a Python non-Unicode string, but when I convert it
to
> > Unicode and try to insert it, Python raises the function
> > sequence error.
> > The string does not become longer when converted to Unicode.  The mx
> > connection object has its stringformat property set to
> > MIXED_STRINGFORMAT and its encoding property set to 'utf-8'.
> >
> > The same applies whether I use the stored procedure or a
> > composed INSERT
> > statement executed with the execute() method.
> >
> 
> Chuck, I don't know Python that much. How to convert string to
unicode?

Since version 2.0, Python has a built-in function unicode().  It takes
one mandatory argument (the string object to be converted to Unicode),
with two further optional arguments (the encoding of the string to be
converted, and a keyword specifying the handling of decoding errors),
and it returns a Unicode string object.  So if the variable 'xml'
contains an XML document in UTF-8 encoding as a plain string object, the
following line would convert it to a Unicode string object held in
'xmlu':

  xmlu = unicode(xml, 'utf-8')

> How did you declare store procedure?

I compose them in text files and execute them in the MS Query Analyzer
(at work, I'm a Linux guy in Windows exile; Cygwin and Python make life
bearable).  If I need to revise, I export them through Enterprise
Manager with the DROP statements, edit, and re-execute in Query
Analyzer.  Python/mxODBC/iODBC/FreeTDS are used only for SELECT, INSERT,
UPDATE, and DELETE, as well as for calling stored procedures (which
themselves only do only sets of the above statements). 

Thanks,

Chuck Bearden
Systems Analyst III
School of Health Information Sciences
University of Texas at Houston
713.500.3954 (voice)
713.500.3907 (fax)
Charles.F.Bearden at uth.tmc.edu



More information about the FreeTDS mailing list