Hi
I upgraded to the latest version and to my surprise I got some crashes on this
ssql := 'SELECT COUNT(*) FROM ACTIONS';
PrepareDataset(aDataset, ssql);
Number := aDataset.Fields[0].asInteger;
Now the SQLite cannot retrieve this field as integer
a) it is a breaking change that should be mentioned somewhere
b) it is not very smart because guess what it is always an integer and if empty should return 0
now I have to do
ssql := 'SELECT COUNT(*) FROM ACTIONS';
PrepareDataset(aDataset, ssql);
Variant:= aDataset.Fields[0].Value;
Number := Variant
Now I have a hard time to call this upgrade an improvement at least for this feature
I have the same problem with the FTS tables but there I can understand it is all text not regular databases
Any thoughs? thanks
PW
Breaking changes on select count (*)
Re: Breaking changes on select count (*)
Hello,
We cannot reproduce the problem on the latest LiteDAC version 2.1.4. Please run the following code, and let us know the result.
We cannot reproduce the problem on the latest LiteDAC version 2.1.4. Please run the following code, and let us know the result.
Code: Select all
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils, LiteAccess;
var
LiteConnection: TLiteConnection;
LiteQuery: TLiteQuery;
begin
LiteConnection := TLiteConnection.Create(nil);
try
LiteConnection.Database := ':memory:';
LiteConnection.Connect;
LiteConnection.ExecSQL('create table test (id integer)');
LiteConnection.ExecSQL('insert into test values(1),(2),(3),(4),(5),(6),(7)');
LiteQuery := TLiteQuery.Create(nil);
try
LiteQuery.Connection := LiteConnection;
LiteQuery.SQL.Text := 'select count(*) from test';
LiteQuery.Open;
Writeln(IntToStr(LiteQuery.Fields[0].AsInteger));
finally
LiteQuery.Free;
end;
finally
LiteConnection.Free;
readln;
end;
end.