Closed gagaxj closed 7 years ago
I've been working through the null issues here this morning and can confirm this issue.
I've found the source of this issue. It's line 233 of SQLClient.m. In some FreeTDS example code I've found, they use the value of pcol->status to check whether or not the column is null, while SQLClient only checks whether or not pcol->buffer is null. For whatever reason, the FreeTDS people decided not to reinitialize everything between each row.
if (pcol->status == -1) //column is null else //not null
I will create a pull request.
@nhgrif This issue is still not fixed. Did you create your pull request? Was it merged?
This was fixed in PR #12
I noticed an issue which is quite repeatable.
You can just set up a test table like below to repeat the issue. Let's say a column named myColumn, it is either varchar(5) or decimal(3,1). Have 3 rows of result. Row1, Row2, Row3.
If All these rows have NULL value of myColumn, the sql query result is fine. If only Row3 is NULL, it is also fine. If only Row2 is NULL, while Row1 is not, then there is a Problem. The query result for Row2 is not NULL, instead it uses the value from Row1.
I believe there is something wrong inside the function
Please fix it, thanks.