mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-11-25 17:59:54 +08:00
Correction to SQLGetData string length handling
According to http://download.oracle.com/otn_hosted_doc/timesten/703/TimesTen-Documentation/ms.odbc.pdf and https://msdn.microsoft.com/en-us/library/ms710980(v=vs.85).aspx, the string length should not include the NULL character at the end. Previous behavior would likely work without problems for any language that uses C-style null terminated strings, but adds a null character in the string when using the driver with a language that does not use C-style strings.
This commit is contained in:
@@ -1797,7 +1797,7 @@ static SQLRETURN SQL_API _SQLGetData(
|
||||
{
|
||||
char *str = mdb_col_to_string(mdb, mdb->pg_buf,
|
||||
col->cur_value_start, col->col_type, col->cur_value_len);
|
||||
int len = strlen(str) + 1; // including \0
|
||||
int len = strlen(str);
|
||||
if (stmt->pos >= len) {
|
||||
free(str);
|
||||
return SQL_NO_DATA;
|
||||
|
||||
Reference in New Issue
Block a user