Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TFDLocalSQL, EDatabaseError, ESQLiteNativeException


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 11 - Last Post: Jul 13, 2017 12:16 AM Last Post By: Dmitry Arefiev
Joachim Breuer

Posts: 14
Registered: 4/10/03
TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 6, 2017 5:03 AM
I like to edit data in a TDBGrid with TFDLocalSQL and a FDQuery.

Exception der Klasse ESQLiteNativeException mit der Meldung '[FireDAC][Phys][SQLite] ERROR: 'True' is not a valid boolean value for field 'ABoolean''...

Steps to reproduce:
1. Use the InMemDB example from the Embarcadero samples
2. Edit TfrmMain.FormCreate to:
procedure TfrmMain.FormCreate(Sender: TObject);
begin
  with Brands do begin
    with FieldDefs do begin
      Clear;
      Add('Code', ftInteger);
      Add('Name', ftString, 20);
      
      Add('ABoolean', ftBoolean);
 
    end;
    Active := True;
    AppendRecord([1, 'Audi', True]);
    AppendRecord([2, 'BMW', False]);
    AppendRecord([3, 'Mercedes', True]);
  end;

3. Run the application, go to the query tab and try to edit and save the name Audi for example.

What is wrong?

Edited by: Joachim Breuer on Jul 7, 2017 2:02 AM
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 7, 2017 1:38 AM   in response to: Joachim Breuer in response to: Joachim Breuer
Could you please post here the call stack for the exception.

--
With best regards,
Dmitry
Joachim Breuer

Posts: 14
Registered: 4/10/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 7, 2017 2:00 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
We use Delphi 10.2

main thread ($66c):
006c0625 +119 InMemDB.exe FireDAC.Stan.Error FDException
0081196d +041 InMemDB.exe FireDAC.Phys.SQLiteWrapper TSQLiteHandle.Check
0081819a +13e InMemDB.exe FireDAC.Phys.SQLiteWrapper TSQLiteStatement.ExecuteBase
008257ae +142 InMemDB.exe FireDAC.Phys.SQLite TFDPhysSQLiteCommand.InternalExecute
007544ac +068 InMemDB.exe FireDAC.Phys Process_HandleSystemFailure
007545de +042 InMemDB.exe FireDAC.Phys Process_SingleRow
00755533 +1f7 InMemDB.exe FireDAC.Phys TFDPhysCommand.ExecuteBase
00754089 +009 InMemDB.exe FireDAC.Phys TFDPhysCommandAsyncExecute.Execute
00724118 +054 InMemDB.exe FireDAC.Stan.Async TFDStanAsyncExecutor.ExecuteOperation
0072445a +06e InMemDB.exe FireDAC.Stan.Async TFDStanAsyncExecutor.Run
0074ef94 +0d0 InMemDB.exe FireDAC.Phys TFDPhysCommand.ExecuteTask
0074efe5 +121 InMemDB.exe FireDAC.Phys TFDPhysCommand.ExecuteTask
0075573f +05b InMemDB.exe FireDAC.Phys TFDPhysCommand.Execute
0075b387 +443 InMemDB.exe FireDAC.DApt TFDDAptTableAdapter.ProcessRequest
0075c5ab +6ff InMemDB.exe FireDAC.DApt TFDDAptTableAdapter.ProcessUpdate
0075cbea +04a InMemDB.exe FireDAC.DApt TFDDAptTableAdapter.Update
0085cd49 +069 InMemDB.exe FireDAC.Comp.Client TFDCustomTableAdapter.Update
00860f6f +107 InMemDB.exe FireDAC.Comp.Client TFDAdaptedDataSet.DoProcessUpdateRequest
0083783f +0d3 InMemDB.exe FireDAC.Comp.DataSet TFDDataSet.InternalPost
006b1149 +029 InMemDB.exe Data.DB TDataSet.CheckOperation
006b0c44 +048 InMemDB.exe Data.DB TDataSet.Post
008378f9 +029 InMemDB.exe FireDAC.Comp.DataSet TFDDataSet.Post
00881555 +105 InMemDB.exe Vcl.DBCtrls TDBNavigator.BtnClick
00881090 +010 InMemDB.exe Vcl.DBCtrls TDBNavigator.ClickHandler
005af72b +073 InMemDB.exe Vcl.Controls TControl.Click
0087b994 +000 InMemDB.exe Vcl.Buttons TSpeedButton.Click
0087b97e +0ea InMemDB.exe Vcl.Buttons TSpeedButton.MouseUp
00881d39 +019 InMemDB.exe Vcl.DBCtrls TNavButton.MouseUp
005afb64 +038 InMemDB.exe Vcl.Controls TControl.DoMouseUp
005afbe6 +076 InMemDB.exe Vcl.Controls TControl.WMLButtonUp
005af1be +2be InMemDB.exe Vcl.Controls TControl.WndProc
005b3934 +1f8 InMemDB.exe Vcl.Controls TWinControl.WndProc
005b3344 +02c InMemDB.exe Vcl.Controls TWinControl.MainWndProc
005aedf8 +024 InMemDB.exe Vcl.Controls TControl.Perform
005b35d0 +0b0 InMemDB.exe Vcl.Controls TWinControl.IsControlMouseMsg
005b3b86 +44a InMemDB.exe Vcl.Controls TWinControl.WndProc
005b3344 +02c InMemDB.exe Vcl.Controls TWinControl.MainWndProc
0053ef24 +014 InMemDB.exe System.Classes StdWndProc
753a62fb +00b user32.dll DispatchMessageW
00666a97 +0f3 InMemDB.exe Vcl.Forms TApplication.ProcessMessage
00666ada +00a InMemDB.exe Vcl.Forms TApplication.HandleMessage
00666e0d +0c9 InMemDB.exe Vcl.Forms TApplication.Run
0089c739 +049 InMemDB.exe InMemDB 29 +4 initialization
74dc38f2 +022 KERNEL32.DLL BaseThreadInitThunk
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 3:49 AM   in response to: Joachim Breuer in response to: Joachim Breuer
This looks like a secondary exception. And there should be first one.
Do you see it ? Could you please provide call stack of it ?

--
With best regards,
Dmitry
Joachim Breuer

Posts: 14
Registered: 4/10/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 5:02 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Dmitry Arefiev wrote:
This looks like a secondary exception. And there should be first one.
Do you see it ? Could you please provide call stack of it ?

--
With best regards,
Dmitry

Hello Dmitry,

you are right, here is the first exception:

:756bdbe8 KERNELBASE.RaiseException + 0x48
:00697e3b DatabaseError + $E3
:00697eda DatabaseErrorFmt + $36
:006a145e TBooleanField.SetAsString + $1D2
:0069b11c TField.AssignValue + $218
:0083a795 TFDDataSet.SetKeyFields + $7D
:0083aad7 TFDDataSet.SetRange + $27
:00869806 TSQLiteVDSCursor.VTabFilter + $5CA
:0081bff0 TSQLiteVCursor.xFilter + $9C
:0081a85a FDxFilter + $26
:0079ca77 sqlite3_value_numeric_type + $6087
:0079569b sqlite3_result_error_nomem + $18B
:00795798 sqlite3_step + $74
:008180b1 TSQLiteStatement.ExecuteBase + $55
:008257b3 TFDPhysSQLiteCommand.InternalExecute + $147
:007544af Process_HandleSystemFailure + $6B
:007545e3 Process_SingleRow + $47
:00755538 TFDPhysCommand.ExecuteBase + $1FC
:0075408e TFDPhysCommandAsyncExecute.Execute + $E
:0072445f TFDStanAsyncExecutor.Run + $73
:0074efe8 TFDPhysCommand.ExecuteTask + $124
:00755744 TFDPhysCommand.Execute + $60
:0075b38d TFDDAptTableAdapter.ProcessRequest + $449
:0075c5b0 TFDDAptTableAdapter.ProcessUpdate + $704
:0075cbef TFDDAptTableAdapter.Update + $4F
:0085cd4f TFDCustomTableAdapter.Update + $6F
:00860f74 TFDAdaptedDataSet.DoProcessUpdateRequest + $10C

You can't reproduce it with the InMemDB.exe and my changes?

Edited by: Joachim Breuer on Jul 12, 2017 5:04 AM
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 7:44 AM   in response to: Joachim Breuer in response to: Joachim Breuer
You can't reproduce it with the InMemDB.exe and my changes?

I got that the issue is with German localization and 'True' / 'False' literals. But was interested in exact place where the exception is raised.

If you have FireDAC sources, then please try:
* open FireDAC.Phys.SQLiteVDataSet unit
* locate there TSQLiteVDSCursor.VTabFilter method, SetVarRec subroutine
* locate there lines:
      else if oFld.DataType = ftBoolean then
        UnicodeString(AVar.VUnicodeString) := S_FD_Bools[oIn.AsBoolean]

* replace them with:
      else if oFld.DataType = ftBoolean then
        if oIn.AsBoolean then
          UnicodeString(AVar.VUnicodeString) := STextTrue
        else
          UnicodeString(AVar.VUnicodeString) := STextFalse

* save unit and add path to FireDAC sources to your IDE Library Path.

Does it work now ?

--
With best regards,
Dmitry
Joachim Breuer

Posts: 14
Registered: 4/10/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 8:10 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Dmitry Arefiev wrote:
You can't reproduce it with the InMemDB.exe and my changes?

I got that the issue is with German localization and 'True' / 'False' literals. But was interested in exact place where the exception is raised.

If you have FireDAC sources, then please try:
* open FireDAC.Phys.SQLiteVDataSet unit
* locate there TSQLiteVDSCursor.VTabFilter method, SetVarRec subroutine
* locate there lines:
      else if oFld.DataType = ftBoolean then
        UnicodeString(AVar.VUnicodeString) := S_FD_Bools[oIn.AsBoolean]

* replace them with:
      else if oFld.DataType = ftBoolean then
        if oIn.AsBoolean then
          UnicodeString(AVar.VUnicodeString) := STextTrue
        else
          UnicodeString(AVar.VUnicodeString) := STextFalse

* save unit and add path to FireDAC sources to your IDE Library Path.

Does it work now ?

--
With best regards,
Dmitry

Yes, this works:

      else if oFld.DataType = ftBoolean then
        if oIn.AsBoolean then
          UnicodeString(AVar.VUnicodeString) := 'Wahr'
        else
          UnicodeString(AVar.VUnicodeString) := 'Falsch'
 
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 8:29 AM   in response to: Joachim Breuer in response to: Joachim Breuer
UnicodeString(AVar.VUnicodeString) := 'Wahr'
UnicodeString(AVar.VUnicodeString) := 'Falsch'

And the same result with STextTrue and STextFalse (I mean, they are the same with your German literals) ?

--
With best regards,
Dmitry
Joachim Breuer

Posts: 14
Registered: 4/10/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 11:20 PM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Dmitry Arefiev wrote:
UnicodeString(AVar.VUnicodeString) := 'Wahr'
UnicodeString(AVar.VUnicodeString) := 'Falsch'

And the same result with STextTrue and STextFalse (I mean, they are the same with your German literals) ?

--
With best regards,
Dmitry

No, STextTrue and STextFalse is unknown. ([dcc32 Fehler] FireDAC.Phys.SQLiteVDataSet.pas(1890): E2003 Undeklarierter Bezeichner: 'STextTrue')

Where is the declaration of STextTrue and STextFalse?
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 12, 2017 11:29 PM   in response to: Joachim Breuer in response to: Joachim Breuer
Where is the declaration of STextTrue and STextFalse?

Data.DBConsts

--
With best regards,
Dmitry
Joachim Breuer

Posts: 14
Registered: 4/10/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 13, 2017 12:13 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Dmitry Arefiev wrote:
Where is the declaration of STextTrue and STextFalse?

Data.DBConsts

--
With best regards,
Dmitry

Adding Data.DBConsts to the uses. Now it run.
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDLocalSQL, EDatabaseError, ESQLiteNativeException  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 13, 2017 12:16 AM   in response to: Joachim Breuer in response to: Joachim Breuer
Adding Data.DBConsts to the uses. Now it run.

Thank you for info.

--
With best regards,
Dmitry
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02