FS-7673: [mod_v8] Fixed ODBC NULL value incorrectly evaluated

This commit is contained in:
Saumar Hajjar authored and Michael Jerris committed 2015-09-29 11:23:36 -04:00
1 parent 2655c12e45
commit 4977f608fe
1 file changed
+8 -3
+8 -3
View File
@@ -315,12 +315,17 @@ JS_ODBC_FUNCTION_IMPL(GetData)
SQLULEN ColumnSize;
SQLCHAR name[1024] = "";
SQLCHAR *data = _colbuf;
SQLLEN pcbValue;
SQLDescribeCol(_stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
SQLGetData(_stmt, x, SQL_C_CHAR, _colbuf, _cblen, NULL);
SQLGetData(_stmt, x, SQL_C_CHAR, _colbuf, _cblen, &pcbValue);
if (name) {
arg->Set(String::NewFromUtf8(GetIsolate(), (const char *)name), String::NewFromUtf8(GetIsolate(), data ? (const char *)data : ""));
if (SQL_NULL_DATA == pcbValue) {
arg->Set(String::NewFromUtf8(GetIsolate(), (const char *)name), Null(info.GetIsolate()));
} else {
arg->Set(String::NewFromUtf8(GetIsolate(), (const char *)name), String::NewFromUtf8(GetIsolate(), data ? (const char *)data : ""));
}
}
}