Page 1 of 1

UniDAC 7.4.12 Could not convert variant of type (Null) into type (Double)

Posted: Wed 03 Jul 2019 14:22
by Alexey Afrosin
Hi!

I am Using UniDAC 7.4.12 with Sqlite 3.27.2.
When I open Query I get error : Could not convert variant of type (Null) into type (Double)

Code: Select all

procedure TForm2.Button1Click(Sender: TObject);
begin
  UniQuery1.Open;
end;
Before UniDAC I am using LiteDac 2.6.21 and this error don`t occurred.

Field mapping not acceptable in this case.

How I can fix it?

Re: UniDAC 7.4.12 Could not convert variant of type (Null) into type (Double)

Posted: Thu 04 Jul 2019 08:37
by Tarifer
Hello!
I got the same error/
I check the sources and found:

Code: Select all

unit LiteClassesUni;
...
procedure TSQLiteConnection.RegisterInternalFunctions;
begin
...
  TSQLiteFunctionManager(FunctionManager).RegisterFunction('ROUND', 2, InternalRound);
end;
...
procedure TSQLiteConnection.InternalRound(InValues: array of Variant; var ResultValue: Variant);
begin
  ResultValue := Round(double(InValues[0]) * Power(10, InValues[1])) / Power(10, InValues[1]);
end;
procedure TSQLiteConnection.InternalRound should check, if any values is NULL, and returns NULL in this case:

Code: Select all

procedure TSQLiteConnection.InternalRound(InValues: array of Variant; var ResultValue: Variant);
begin
  if VarIsNull(InValues[0]) or VarIsNull(InValues[1]) then
    ResultValue := Null
  else
    ResultValue := Round(double(InValues[0]) * Power(10, InValues[1])) / Power(10, InValues[1]);
end;
DevArt, please, fix this and similar functions.
Or make the way to disable redefining native functions.

Re: UniDAC 7.4.12 Could not convert variant of type (Null) into type (Double)

Posted: Thu 04 Jul 2019 13:36
by MaximG
Thank you for the information. We will investigate the described issue and let you know the results shortly.

Re: UniDAC 7.4.12 Could not convert variant of type (Null) into type (Double)

Posted: Fri 05 Jul 2019 12:14
by Alexey Afrosin
If you need examples, I can provide them

Re: UniDAC 7.4.12 Could not convert variant of type (Null) into type (Double)

Posted: Fri 05 Jul 2019 14:53
by MaximG
Please send us a test project via the e-support form on our website: https://www.devart.com/company/contactform.html

Re: UniDAC 7.4.12 Could not convert variant of type (Null) into type (Double)

Posted: Fri 19 Jul 2019 09:08
by MaximG
We've reproduced the issue and fixed it. The fix will be included in the new UniDAC build, which we're planning to release next week.