When I try to do a select on a table with one of the columns defined as XML data type, I get the following error. Removing xml from the selected columns resolves the issue.
Error: Unrecognised data type 0xF1 at offset 0x02BC
at parse (/home/dataservices/node_modules/tedious/lib/metadata-parser.js:21:11)
at Object.parser [as 129] (/home/dataservices/node_modules/tedious/lib/token/colmetadata-token-parser.js:11:16)
at Parser.nextToken (/home/dataservices/node_modules/tedious/lib/token/token-stream-parser.js:81:35)
at Parser.addBuffer (/home/dataservices/node_modules/tedious/lib/token/token-stream-parser.js:65:17)
at Connection.sendDataToTokenStreamParser (/home/dataservices/node_modules/tedious/lib/connection.js:527:35)
at Connection.STATE.SENT_CLIENT_REQUEST.events.data (/home/dataservices/node_modules/tedious/lib/connection.js:189:23)
at Connection.dispatchEvent (/home/dataservices/node_modules/tedious/lib/connection.js:433:59)
at MessageIO.Connection.connectOnPort (/home/dataservices/node_modules/tedious/lib/connection.js:387:20)
at MessageIO.EventEmitter.emit (events.js:96:17)
at MessageIO.eventData (/home/dataservices/node_modules/tedious/lib/message-io.js:57:12)
I'd post a fix with the updated data-type.js file, but I am not very sure how to define the data type there, especially the declaration and writeParameterData function. I am not very well versed with the tds protocol or ms sql server.
Unfortunately support for the XML data type is non-trivial. It will require implementation of support for the MS-BINXML format. As it is a discreet format that is not a core part of TDS, it should be implemented as a library separate from tedious, that tedious can then depend on.
I'm afraid that I have no plans to implement the format. If someone else does, then I'd consider adding a dependency on the new library and support for the XML data type.
I was mislead by the TDS documentation. Some testing shows that XML column values are returned as text. So it may not be too difficult to implement. I'll investigate further.
@pekim thanks. I've been working around it by typecasting xml into text in my queries right now.
Add support for parsing XML data type in result sets.