Open GoogleCodeExporter opened 8 years ago
Original comment by mkleehammer
on 20 Nov 2010 at 7:04
Just an update: FreeTDS 0.91 always returns the same length for XML data, so it
is impossible to know the real length. It seems to return the maxtext value,
which in my case is 2147483647.
It happens to work when the XML length <= 1023 bytes because pyodbc uses a 1024
byte stack buffer. If the value is larger, it needs to allocate memory based
on the size the driver reports.
I'm digging through the FreeTDS source, but I don't see a quick fix yet.
Original comment by mkleehammer
on 29 Sep 2012 at 7:48
Original comment by mkleehammer
on 29 Sep 2012 at 7:48
My previous comment was incorrect. The length is not always the same.
Using FreeTDS 0.91 and pyodbc 3.0.6+, the problem is that a NULL terminator
sometimes overwites the last byte. Still working on it.
Original comment by mkleehammer
on 30 Sep 2012 at 12:52
I've raised two issues on the FreeTDS mailing list:
1) FreeTDS reports the column as SQL_CHAR instead of SQL_SS_XML
2) SQLGetData always returns SQL_SUCCESS, even if the buffer size is too small.
This means pyodbc 3.0.6+ is going to return XML as ANSI text and will work as
long as the text is less than 1024 characters (the internal buffer size used
for the first select).
In the meantime, you might consider using the Microsoft SQL Server Driver for
Linux. It works extremely well.
Original comment by mkleehammer
on 30 Sep 2012 at 2:27
Original issue reported on code.google.com by
s...@mitre.org
on 17 Nov 2010 at 8:08