Unrecognized token error for MasterFields names with spaces using SmartFetch

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Bob Boyd
Posts: 16
Joined: Thu 28 Jul 2016 19:26

Unrecognized token error for MasterFields names with spaces using SmartFetch

Post by Bob Boyd » Mon 21 May 2018 19:45

I am attempting to implement SmartFetch to reduce the memory usage of an application that opens a large database. I received unrecognized token errors when opening a linked detail table where the MasterFields field name contains spaces. The tables linked correctly when the IndexFieldNames property was used however SmartFetch with LiveBlock enabled requires the IndexFieldNames property to be blank so that property assignment was replaced by assigning the KeyFields and OrderFields properties. The detail table will open without errors until I setup the MasterFields/DetailFields with SmartFetch enabled.

I stepped through the table initialization and isolated the problem to the MasterFields by changing to a field without a space in the name which allowed the table to open without the error. I also tried commenting out the SmartFetch.Enabled = True statement when the MasterFields property used the name with spaces and the table also opened without errors. My final workaround attempt was to replace the "Test Set ID"' quotes with [Test Set ID] brackets like the TLiteTable default SQL statements but the same error was generated.

My initial testing of SmartFetch with LiveBlock resulted in a huge reduction in the amount of memory used for opening a large archive table and will solve several problems using our large databases. Any suggestions about how to make this work or did I discover a TLiteTable bug?

Original IndexFieldNames Table Setup:

Code: Select all

  With TestListLiteTable do
  begin
    Close;
    Connection := WC6SourceLite;
    TableName := 'CSetList';
    Options.StrictUpdate := False;
    Options.QuoteNames := True;
    Options.QueryRecCount := True;
    stKey := '"Test Set ID"; EquipmentID';
    IndexFieldNames := stKey;
    DetailFields := '"Test Set ID"';
    MasterFields := '"Test Set ID"';
    MasterSource := TestSetDS;
    Open;
  end;
New SmartFetch/KeyFields/OrderFields Setup:

Code: Select all

  With TestListLiteTable do
  begin
    Close;
    Connection := WC6SourceLite;
    TableName := 'CSetList';
    Options.StrictUpdate := False;
    Options.QuoteNames := True;
    Options.QueryRecCount := True;
    stKey := '"Test Set ID"; EquipmentID';
    KeyFields := stKey;
    SmartFetch.PreFetchedFields := stKey;
    SmartFetch.Enabled := True;		<<<--- Comment out and table opens without error!
    stOrd := '"Test Set ID", EquipmentID';
    OrderFields := stOrd;
    DetailFields := '"Test Set ID"';
    MasterFields := '"Test Set ID"';
    MasterSource := TestSetDS;
    Open;
  end;

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Unrecognized token error for MasterFields names with spaces using SmartFetch

Post by MaximG » Wed 23 May 2018 14:38

We reproduced the issue and fixed this error. The fix will be included in the next LiteDAC build. As a workaround, we can send you a night LiteDAC build including the required changes. For this, using e-support form (https://www.devart.com the "Support"\"Request Support" menu) provide us with your license number and IDE version you are interested in

Bob Boyd
Posts: 16
Joined: Thu 28 Jul 2016 19:26

Re: Unrecognized token error for MasterFields names with spaces using SmartFetch

Post by Bob Boyd » Thu 24 May 2018 18:34

Thanks for the update on this issue, I'm glad to hear it was confirmed and fixed. I submitted my request for the new build through the e-support form.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Unrecognized token error for MasterFields names with spaces using SmartFetch

Post by MaximG » Fri 25 May 2018 11:31

We sent you a link for downloading a night build of our driver.

Post Reply