Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 53
FEAT: Add spatial type support (geography, geometry, hierarchyid)#423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
af13019246fcfd2cbd60d65f1d1aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -865,6 +865,7 @@ def _get_c_type_for_sql_type(self, sql_type: int) -> int: | ||
| ddbc_sql_const.SQL_BINARY.value: ddbc_sql_const.SQL_C_BINARY.value, | ||
| ddbc_sql_const.SQL_VARBINARY.value: ddbc_sql_const.SQL_C_BINARY.value, | ||
| ddbc_sql_const.SQL_LONGVARBINARY.value: ddbc_sql_const.SQL_C_BINARY.value, | ||
| ddbc_sql_const.SQL_SS_UDT.value: ddbc_sql_const.SQL_C_BINARY.value, | ||
| # ODBC 3.x date/time types (reported by ODBC 18 driver) | ||
| ddbc_sql_const.SQL_TYPE_DATE.value: ddbc_sql_const.SQL_C_TYPE_DATE.value, | ||
| ddbc_sql_const.SQL_TYPE_TIME.value: ddbc_sql_const.SQL_C_TYPE_TIME.value, | ||
| @@ -1052,6 +1053,7 @@ def _map_data_type(self, sql_type): | ||
| SQL_SS_TIME2(-154) for time columns | ||
| SQL_DATETIMEOFFSET(-155) for datetimeoffset columns | ||
| SQL_SS_XML(-152) for xml columns | ||
| SQL_SS_UDT(-151) for geography/geometry/hierarchyid columns | ||
| ODBC 2.x aliases (9, 10, 11) are also accepted defensively. | ||
| @@ -1097,6 +1099,7 @@ def _map_data_type(self, sql_type): | ||
| ddbc_sql_const.SQL_BINARY.value: bytes, | ||
| ddbc_sql_const.SQL_VARBINARY.value: bytes, | ||
| ddbc_sql_const.SQL_LONGVARBINARY.value: bytes, | ||
| ddbc_sql_const.SQL_SS_UDT.value: bytes, | ||
| # UUID | ||
dlevy-msft-sql marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ddbc_sql_const.SQL_GUID.value: uuid.UUID, | ||
| # XML — driver reports SQL_SS_XML (-152), fetched as str | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -20,13 +20,14 @@ | ||
| // Macro definitions | ||
| //------------------------------------------------------------------------------------------------- | ||
| // This constant is not exposed via sql.h, hence define it here | ||
| // These constants are not exposed via sql.h, hence define them here | ||
| #define SQL_SS_TIME2 (-154) | ||
| #define SQL_SS_TIMESTAMPOFFSET (-155) | ||
| #define SQL_C_SS_TIMESTAMPOFFSET (0x4001) | ||
| #define MAX_DIGITS_IN_NUMERIC 64 | ||
| #define SQL_MAX_NUMERIC_LEN 16 | ||
| #define SQL_SS_XML (-152) | ||
| #define SQL_SS_UDT (-151) | ||
dlevy-msft-sql marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| #define STRINGIFY_FOR_CASE(x) \ | ||
| case x: \ | ||
| @@ -3285,6 +3286,7 @@ SQLRETURN SQLGetData_wrap(SqlHandlePtr StatementHandle, SQLUSMALLINT colCount, p | ||
| } | ||
| break; | ||
| } | ||
| case SQL_SS_UDT: | ||
| case SQL_BINARY: | ||
| case SQL_VARBINARY: | ||
| case SQL_LONGVARBINARY: { | ||
| @@ -3555,6 +3557,7 @@ SQLRETURN SQLBindColums(SQLHSTMT hStmt, ColumnBuffers& buffers, py::list& column | ||
| ret = SQLBindCol_ptr(hStmt, col, SQL_C_GUID, buffers.guidBuffers[col - 1].data(), | ||
| sizeof(SQLGUID), buffers.indicators[col - 1].data()); | ||
| break; | ||
| case SQL_SS_UDT: | ||
| case SQL_BINARY: | ||
| case SQL_VARBINARY: | ||
| case SQL_LONGVARBINARY: | ||
| @@ -3683,6 +3686,7 @@ SQLRETURN FetchBatchData(SQLHSTMT hStmt, ColumnBuffers& buffers, py::list& colum | ||
| case SQL_WLONGVARCHAR: | ||
| columnProcessors[col] = ColumnProcessors::ProcessWChar; | ||
| break; | ||
| case SQL_SS_UDT: | ||
| case SQL_BINARY: | ||
| case SQL_VARBINARY: | ||
| case SQL_LONGVARBINARY: | ||
| @@ -3981,6 +3985,10 @@ size_t calculateRowSize(py::list& columnNames, SQLUSMALLINT numCols) { | ||
| case SQL_BIT: | ||
| rowSize += sizeof(SQLCHAR); | ||
| break; | ||
| case SQL_SS_UDT: | ||
| rowSize += (static_cast<SQLLEN>(columnSize) == SQL_NO_TOTAL || columnSize == 0) | ||
| ? SQL_MAX_LOB_SIZE : columnSize; | ||
| break; | ||
| case SQL_BINARY: | ||
| case SQL_VARBINARY: | ||
| case SQL_LONGVARBINARY: | ||
| @@ -4043,7 +4051,8 @@ SQLRETURN FetchMany_wrap(SqlHandlePtr StatementHandle, py::list& rows, int fetch | ||
| if ((dataType == SQL_WVARCHAR || dataType == SQL_WLONGVARCHAR || dataType == SQL_VARCHAR || | ||
| dataType == SQL_LONGVARCHAR || dataType == SQL_VARBINARY || | ||
| dataType == SQL_LONGVARBINARY || dataType == SQL_SS_XML) && | ||
| dataType == SQL_LONGVARBINARY || dataType == SQL_SS_XML || | ||
| dataType == SQL_SS_UDT) && | ||
| (columnSize == 0 || columnSize == SQL_NO_TOTAL || columnSize > SQL_MAX_LOB_SIZE)) { | ||
dlevy-msft-sql marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| lobColumns.push_back(i + 1); // 1-based | ||
| } | ||
| @@ -4181,7 +4190,8 @@ SQLRETURN FetchAll_wrap(SqlHandlePtr StatementHandle, py::list& rows, | ||
| if ((dataType == SQL_WVARCHAR || dataType == SQL_WLONGVARCHAR || dataType == SQL_VARCHAR || | ||
| dataType == SQL_LONGVARCHAR || dataType == SQL_VARBINARY || | ||
| dataType == SQL_LONGVARBINARY || dataType == SQL_SS_XML) && | ||
| dataType == SQL_LONGVARBINARY || dataType == SQL_SS_XML || | ||
| dataType == SQL_SS_UDT) && | ||
| (columnSize == 0 || columnSize == SQL_NO_TOTAL || columnSize > SQL_MAX_LOB_SIZE)) { | ||
dlevy-msft-sql marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| lobColumns.push_back(i + 1); // 1-based | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.