Discussion:
[freetds] XML Problems
Michael Kleehammer
2012-09-30 02:24:10 UTC
Permalink
Either there are two problems with selecting XML, or I am seriously
misunderstanding something.

I am using protocol version 7.2

First, when I select from an xml column, SQLDescribeCol reports the sqltype
as SQL_CHAR instead of the expected SQL_SS_XML.

python 7FFF79F56180 EXIT SQLDescribeCol with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x7fc35a616080
SQLUSMALLINT 1
SQLCHAR * 0x7fff59073a30
| s |
SQLSMALLINT 300
SQLSMALLINT * 0x0
SQLSMALLINT * 0x7fff59073a2e (SQL_CHAR)
SQLULEN * 0x7fff59073a20 (2147483647)
SQLSMALLINT * 0x7fff59073a1e (0)
SQLSMALLINT * 0x7fff59073a1c (SQL_NULLABLE)

Second, SQLGetData always returns SQL_SUCCESS, even when the buffer is too
small. It NULL terminates at the given buffer length but gives no
indication more should be read.

Am I missing something?

Thanks,
Michael Kleehammer
Frediano Ziglio
2012-09-30 10:01:46 UTC
Permalink
Post by Michael Kleehammer
Either there are two problems with selecting XML, or I am seriously
misunderstanding something.
I am using protocol version 7.2
First, when I select from an xml column, SQLDescribeCol reports the sqltype
as SQL_CHAR instead of the expected SQL_SS_XML.
FreeTDS support XML requesting char data, not in binary format, so the
result is SQL_CHAR (well, perhaps should be SQL_LONGVARCHAR).
Post by Michael Kleehammer
python 7FFF79F56180 EXIT SQLDescribeCol with return code 0
(SQL_SUCCESS)
SQLHSTMT 0x7fc35a616080
SQLUSMALLINT 1
SQLCHAR * 0x7fff59073a30
| s |
SQLSMALLINT 300
SQLSMALLINT * 0x0
SQLSMALLINT * 0x7fff59073a2e (SQL_CHAR)
SQLULEN * 0x7fff59073a20 (2147483647)
SQLSMALLINT * 0x7fff59073a1e (0)
SQLSMALLINT * 0x7fff59073a1c (SQL_NULLABLE)
Second, SQLGetData always returns SQL_SUCCESS, even when the buffer is too
small. It NULL terminates at the given buffer length but gives no
indication more should be read.
Am I missing something?
This seems a bug! Which version are you using? Did you check textsize setting?
Post by Michael Kleehammer
Thanks,
Michael Kleehammer
Regards,
Frediano

Loading...