Skip to Content.
Sympa Menu

freetds - Re: [freetds] Segfault When Fetching NVARCHAR(MAX) Column

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Segfault When Fetching NVARCHAR(MAX) Column
  • Date: Wed, 13 Jul 2011 10:01:09 +0200

>
> Which PyODBC/unixODBC version are you using?
> I bet is a mismatch between SQLWCHAR and Py_UNICODE type.
>
> Looking at not-working log mssql returns 0x49c == 1180. PyODBC try to
> read 1024 bytes and get 1022 bytes which left 158 bytes to read then
> PyODBC try to read 160 bytes (158 + 2 terminator). All is correct and
> should work but then pyodbc cores... Allocations seem good and should
> not cause problems however if Python is using Py_UNICODE_SIZE == 4
> should even convert string from UCS-2 to UCS-4 (I didn't test this).
>
> Which operating system/version are you using ?
>

On Ubuntu...


$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> conn = pyodbc.connect('DSN=sqlexpress;UID=sa;PWD=XXXXXX;')
>>> cursor = conn.cursor()
>>> cursor.execute("SELECT N'ciao a tutti'")
<pyodbc.Cursor object at 0x22bf450>
>>> cursor.fetchall()
[(u'\U00690063\U006f0061\U00610020\U00740020\U00740075\U00690074', )]
>>> u'ciao'
u'ciao'
>>>


$ python -c "import sys;print(sys.maxunicode<66000)and'UCS2'or'UCS4'"
UCS4


No comment....

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page