Subject | Bug in 4.8.6 |
---|---|
Author | sboydlns |
Post date | 2010-01-19T14:50:46Z |
I've found a bug in 4.8.6. Retrieving data from a stored procedure that returns a BLOB cast as a VARCHAR results in previous values of the column being repeated for all subsequent rows where that column is NULL. The problem seems to be in TIBOBlobStream.Create. It is not checking the value of FXSQLVar.SQLInd to see if the column is NULL before assigning the column's value to the BLOB stream.
If fixed it by changing the code as follows:
if ((FXSQLVar.SQLInd^ <> -1) and (not Assigned( FColumnData ))) then
^^^^^^^^^^^^^^^^^^
begin
if ( st = SQL_TEXT ) or ( st = SQL_TEXT_ ) then
begin
SetLength( String_Buffer, FXSQLVar.sqllen );
Move( FXSQLVar.SQLData^, String_Buffer[1], FXSQLVar.sqllen );
end
else
if ( st = SQL_VARYING ) or ( st = SQL_VARYING_ ) then
begin
with PSQL_VARCHAR( FXSQLVar.SQLData )^ do
begin
tmpInt := vary_len_low + vary_len_high * 256;
SetLength( String_Buffer, tmpInt );
Move( vary_string, String_Buffer[1], tmpInt );
end;
end;
If fixed it by changing the code as follows:
if ((FXSQLVar.SQLInd^ <> -1) and (not Assigned( FColumnData ))) then
^^^^^^^^^^^^^^^^^^
begin
if ( st = SQL_TEXT ) or ( st = SQL_TEXT_ ) then
begin
SetLength( String_Buffer, FXSQLVar.sqllen );
Move( FXSQLVar.SQLData^, String_Buffer[1], FXSQLVar.sqllen );
end
else
if ( st = SQL_VARYING ) or ( st = SQL_VARYING_ ) then
begin
with PSQL_VARCHAR( FXSQLVar.SQLData )^ do
begin
tmpInt := vary_len_low + vary_len_high * 256;
SetLength( String_Buffer, tmpInt );
Move( vary_string, String_Buffer[1], tmpInt );
end;
end;