pypyodbc
pypyodbc copied to clipboard
parse DB2 SQL_XML = -370
I just added this to the array SQL_data_type_dict, and I was good to go to query DB2 xml data type using their ODBC driver.
SQL_SS_XML : (unicode, lambda x: x, SQL_C_WCHAR, create_buffer_u, 20500 , True ), SQL_SS_UDT : (bytearray, bytearray_cvt, SQL_C_BINARY, create_buffer, 5120 , True ), SQL_XML : (unicode, lambda x: x, SQL_C_WCHAR, create_buffer_u, 20500 , True ), SQL_BLOB : (bytearray, bytearray_cvt, SQL_C_BINARY, create_buffer, 102400, True ), SQL_CLOB : (unicode, lambda x: x, SQL_C_WCHAR, create_buffer_u, 2048 , False ), }
DB2 ODBC also has these types, it will be good to test all of them
//SQL extended data types SQL_GRAPHIC = -95 SQL_VARGRAPHIC = -96 SQL_LONGVARGRAPHIC = -97 SQL_BLOB = -98 SQL_CLOB = -99 SQL_DBCLOB = -350 SQL_XML = -370 SQL_CURSORHANDLE = -380 SQL_DATALINK = -400 SQL_USER_DEFINED_TYPE = -450
I did this test and all good
these tables are from their SAMPLE database
CREATE TABLE "EMP_PHOTO" ( "EMPNO" CHAR(6) NOT NULL, "PHOTO_FORMAT" VARCHAR(10) NOT NULL, "PICTURE" BLOB(102400) ) DATA CAPTURE NONE;
CREATE TABLE "EMP_RESUME" ( "EMPNO" CHAR(6) NOT NULL, "RESUME_FORMAT" VARCHAR(10) NOT NULL, "RESUME" CLOB(5120) ) DATA CAPTURE NONE;
CREATE TABLE "CUSTOMER" ( "CID" BIGINT NOT NULL, "INFO" XML, "HISTORY" XML ) DATA CAPTURE NONE;