Icon View Incident Report

Serious Serious
Reported By: David Szilagyi
Reported On: 10/18/2004
For: Version 4.12 Build 1
# 1863 Live Queries that Contain an Expression that Uses a BLOB Field Can Cause Incorrect Results

If an engine has custom functions and I use it then other DBISAM functions fails to work. See the Code below.

Let's make a custom function MD5:

with DBISAMEngine do
  with Functions.CreateFunction(ftString, 'MD5').Params do

... and write the following code to the DBISAMEngineCustomFunction procedure:

if AnsiCompareText(FunctionName, 'MD5') then
  if FunctionParams[0].IsNull then
    Result := Null;
    Result := AnsiLowerCase(MD5DigestToString(MD5String(FunctionParams[0].AsString)));

... let's 
say I have this query that works properly:

SELECT recno. floor(myfield / 1000) FROM mytable;

... and now modify it like this:

SELECT recno, floor(myfield / 1000) as F, MD5(anotherfield) as M FROM 

... and then I try this code:


... and it will return 0 and not the correct field value. (I think but I 
am not sure that if I use a grid to display the field values, then it 
works fine but if I don't have a DataSourec and a Grid then it will fail.

Comments Comments and Workarounds
The workaround is to declare the function result as an ftMemo data type instead of an ftString data type, but that has the side-effect of making the result set canned.

Resolution Resolution
Fixed Problem on 10/19/2004 in version 4.13 build 1