Error on filtering Null values locally

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
CISDL
Posts: 2
Joined: Wed 15 Oct 2014 07:43

Error on filtering Null values locally

Post by CISDL » Wed 15 Oct 2014 08:11

We wanted to filter a SmartQuery locally, so we set a filter expression like 'UPPER(MyColumn) like UPPER(MyValue)'.

When it comes to null values in the Column "MyColumn" an
“Could not convert variant of type (Null) into type (OleStr)” exception raises.

As we debugged, it seems the error occurs in MemData.pas in

Code: Select all

function TData.Eval(Node: TExpressionNode): boolean;
between the lines 5807 and 5813:

Code: Select all

  if (Node.LeftOperand.NodeType in [ntField, ntValue]) and Assigned(Node.LeftOperand.LeftOperand) then
    case Node.LeftOperand.LeftOperand.NodeType of
      ntLower:
        V1 := AnsiLowerCase(V1);
      ntUpper:
        V1 := AnsiUpperCase(V1);
    end;
So if the field value is a null value the AnsiLowerCase statement trys to convert and the described error occurs. I believe a simple AnsiLowerCase(VarToStr(V1)) instead of AnsiLowerCase(V1) could fix the problem.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Error on filtering Null values locally

Post by AlexP » Wed 15 Oct 2014 09:30

Hello,

Thank you, we will add the appropriate changes to support null value.

CISDL
Posts: 2
Joined: Wed 15 Oct 2014 07:43

Re: Error on filtering Null values locally

Post by CISDL » Wed 15 Oct 2014 11:02

Thank you for your fast response.
So the fix will be included in the next version which should be 9.4.13, right?
If so, in my opinion the topic can be closed.

Thank you!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Error on filtering Null values locally

Post by AlexP » Wed 15 Oct 2014 12:18

Yes, this fix will be included in the next ODAC build.

Post Reply