My tests on SQLite shows me returning zero. SqliteBrowser at least returns zero as a result on PC side, too. So, I really do not understand what problem might be.
My real wish is that AsInteger gets an internal control. If is null, return 0.
I can try solving it, too. However, I am kind of lost in details of Lazarus code. If someone knows internals of Lazarus, please direct me to the actual unit & function where I can write a line or two to make it return zero myself.
db.pas lines
line 337: function GetAsInteger: Longint; virtual;
line 363: procedure SetAsInteger(AValue: Longint); virtual;
line 399: property AsInteger: Longint read GetAsInteger write SetAsInteger;
fields.inc lines
line 478: function TField.GetAsInteger: Longint;
line 479:
line 480: begin
line 481: raise AccessError(SInteger);
line 482: end;
line 832: procedure TField.SetAsInteger(AValue: Longint);
line 833: begin
line 834: raise AccessError(SInteger);
line 835: end;
db.pas lines (linked to AccessError above)
line 322: function AccessError(const TypeName: string): EDatabaseError;
fields.inc lines (linked to AccessError above)
line 326: function TField.AccessError(const TypeName: string): EDatabaseError;
line 327:
line 328: begin
line 329: Result:=EDatabaseError.CreateFmt(SinvalidTypeConversion,[TypeName,FFieldName]);
line 330: end;
All I am seeing is raising an exception code. When I dig deeper, I find Format function in the end and that is main function possibly in one of pre-compiled files I suppose. So, I am stuck trying to fix my own patch of AsInteger since I do not know exactly where to look.