Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.0.6
-
None
Description
Connector would not return NULL for 0000-00-00 datetime values in case
of SQLGetData call, while doing that in SQLFetch.
If empty string fetched as SQL_C_TIMESTAMP with SQLGetData, the result is not NULL.
Also for 0000-00-00 date(time) indicator value is not set to SQL_NULL_DATA
And today's date is returned. That is not important though.
If the same column is bound with SQL_C_TIMESTAMP buffer using SQLBindCol, the value is NULL. And that makes sense - select cast('' as datetime) will return you NULL.
To repeat is easy
OK_SIMPLE_STMT(Stmt, "SELECT ''");
CHECK_STMT_RC(Stmt, SQLBindCol(Stmt, 1, SQL_C_TIMESTAMP, &Datetime, sizeof(SQL_TIMESTAMP_STRUCT), &sInd));
CHECK_STMT_RC(Stmt, SQLFetch(Stmt));
is_num(sInd, SQL_NULL_DATA);