Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
3.1.0
-
None
-
Windows Server 2008R2 x64
ODBC Driver 3.1 RC 32-Bit
Description
ODBC driver crashes when Bind Col All is followed by Get Data All.
While I'm not entirely sure, I think something similar is happening with SSIS during a data-flow (see the attached stack trace)
Steps to reproduce
- ODBC Test (Unicode)
- Full Connect -> ODBC 3.0
- Catalog --> SQL Columns --> Tablename "combined_test"
- Results --> Bind Col All
- Results --> Get Data All --> Crash
DDL for tests |
CREATE DATABASE ODBC_TEST;
|
USE ODBC_TEST;
|
create table combined_test (
|
id int auto_increment primary key,
|
contents longtext null,
|
blobcontent longblob null,
|
bitfield bit(1) null
|
);
|
Debugging in Visual Studio and the source code showed @ https://github.com/MariaDB/mariadb-connector-c/blob/34f8887af03d022416dd6593de91d0706e57f46b/libmariadb/mariadb_lib.c#L3281
mariadb_lib.c |
/* snip */
|
MYSQL_FIELD * STDCALL mysql_fetch_field_direct(MYSQL_RES *res,uint fieldnr)
|
{
|
return &(res)->fields[fieldnr];
|
}
|
Exception:
Unhandled exception thrown: read access violation.
|
res was nullptr.
|
Call Stack |
> maodbc.dll!mysql_fetch_field_direct(st_mysql_res * res, unsigned int fieldnr) Line 3281 C
|
maodbc.dll!MADB_StmtGetData(void * StatementHandle, unsigned short Col_or_Param_Num, short TargetType, void * TargetValuePtr, long BufferLength, long * StrLen_or_IndPtr, int InternalUse) Line 2529 C
|
maodbc.dll!SQLGetData(void * StatementHandle, unsigned short Col_or_Param_Num, short TargetType, void * TargetValuePtr, long BufferLength, long * StrLen_or_IndPtr) Line 1813 C
|
The same procedure via MySQL 8.0 Unicode Driver works (output below):
MySQL 8.0 Unicode Driver |
SQLColumns:
|
In: StatementHandle = 0x00607008, CatalogName = SQL_NULL_HANDLE, NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
|
TableName = "combined_test", NameLength3 = 13, ColumnName = SQL_NULL_HANDLE, NameLength4 = 0
|
Return: SQL_SUCCESS=0
|
|
Bind Col All:
|
icol, fCType, cbValueMax, pcbValue, rgbValue
|
1, SQL_C_WCHAR=-8, 66, 0, ""
|
2, SQL_C_WCHAR=-8, 66, 0, ""
|
3, SQL_C_WCHAR=-8, 66, 0, ""
|
4, SQL_C_WCHAR=-8, 66, 0, ""
|
5, SQL_C_SSHORT=-15, 2, 0, 0
|
6, SQL_C_WCHAR=-8, 22, 0, ""
|
7, SQL_C_SLONG=-16, 4, 0, 0
|
8, SQL_C_SLONG=-16, 4, 0, 0
|
9, SQL_C_SSHORT=-15, 2, 0, 0
|
10, SQL_C_SSHORT=-15, 2, 0, 0
|
11, SQL_C_SSHORT=-15, 2, 0, 0
|
12, SQL_C_WCHAR=-8, 66, 0, ""
|
13, SQL_C_WCHAR=-8, 66, 0, ""
|
14, SQL_C_SSHORT=-15, 2, 0, 0
|
15, SQL_C_SSHORT=-15, 2, 0, 0
|
16, SQL_C_SLONG=-16, 4, 0, 0
|
17, SQL_C_SLONG=-16, 4, 0, 0
|
18, SQL_C_WCHAR=-8, 5, 0, ""
|
|
Get Data All:
|
TST1005: Highest bound column is 18.
|
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE"
|
"", <Null>, "combined_test", "id", 4, "integer", 10, 4, 0, 10, 1, "", "0", 4, <Null>, <Null>, 1, "YES"
|
"", <Null>, "combined_test", "contents", -1, "longtext", 4294967295, 2147483647, <Null>, <Null>, 1, "", <Null>, -1, <Null>, 2147483647, 2, "YES"
|
"", <Null>, "combined_test", "blobcontent", -4, "longblob", 4294967295, 2147483647, <Null>, <Null>, 1, "", <Null>, -4, <Null>, 2147483647, 3, "YES"
|
"", <Null>, "combined_test", "bitfield", -7, "bit", 1, 1, 0, 10, 1, "", <Null>, -7, <Null>, <Null>, 4, "YES"
|
4 rows fetched from 18 columns.
|
|