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:
William Rogers
2015-05-22 20:10:10 -05:00
parent dca7552d8b
commit 5888c4a52c

View File

@@ -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;