My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 48: SQL Server 2005: XML data type is not supported?
1 person starred this issue and may be notified of changes. Back to list
Status:  Complete
Owner:  ----
Closed:  May 2009


 
Reported by john.cha...@googlemail.com, Apr 24, 2009
SQL Server 2005 includes a new data type "xml". See
http://msdn.microsoft.com/en-gb/library/ms187339.aspx

When using the "SQL Native Client" driver PyODBC encounters an xml column
in a results set, an error is raised.

No error is raised when "SQL Server" driver used to connect to same server
- a unicode object is returned instead.

What steps will reproduce the problem?

1. If you don't have a suitable table to hand, create a new table with an
XML column:

CREATE TABLE [dbo].[xml_test]
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[test] [xml] NULL
)

2. connect to SQL Server 2005 database using the "SQL Native Client" driver

3. execute a select from the table, no rows in the table are required

my_connection.execute( "select * from xml_test" )


What is the expected output? What do you see instead?

I would expect a unicode string containing the contents of the xml field.
Not worried about anything more fancy ;-)

What I get is an exception raised:

pyodbc.Error: ('ODBC data type -152 is not supported.  Cannot read column
test.', 'HY000')


What version of the product are you using? On what operating system?

PyODBC 2.1.5, reproduced on: Windows XP SP2 and Windows Server 2003

Apr 28, 2009
#1 john.cha...@googlemail.com
I believe I have a solution, which I am currently testing.

Are there any patch submission guidelines I need to observe when I'm ready?

Thanks in advance!

John
Apr 28, 2009
#2 john.cha...@googlemail.com
Attaching patch.

Apologies if there is a problem with the patch - I'm new to git and working on
Windows. Let me know if you require any changes.
sql_ss_xml_20090428.patch
4.1 KB   View   Download
May 14, 2009
Project Member #3 mkleehammer
Awesome -- thanks for the patch.  Applied to 31e2fae4adbf1b2af1726e5668a3414cf46b454f
which puts it into 2.1.6.

Do you have a need for 2.1.6 right away?  I assume you are already using the changes
since you provided a patch, but I'd be happy to make an official build if you need it.

Status: Verified
May 15, 2009
#4 john.cha...@googlemail.com
Many thanks for approving the patch.

An official build for 2.5 and 2.6 would be great if that's not a problem. The patched
code has been working fine in a test environment, but I haven't rolled out the
changes to production yet.

Regards,

John

Nov 21, 2010
Project Member #5 mkleehammer
(No comment was entered for this change.)
Status: Complete

Powered by Google Project Hosting