#1 2018-06-21 22:40:03

camu72
Member
From: Salta - Argentina
Registered: 2015-07-12
Posts: 28

Delete in maped TSQLRecors to ExternalDB with SQLWhere sentences fail

Hi,
I have the follow situation

TSQLmyTable = class(TSQLRecord)
private
  FField_1: integer;
  FField_2: integer;
published
  Field_1: integer read FField_1 write FField_1;
  Field_2: integer read FField_2 write FField_2;
end;
  ...
  { in the model creation }
  ...
  VirtualTableExternalRegister(Result, TSQLmyTable, pPropConexion, 'MY_TABLE');
  Result.Props[TSQLmyTable].ExternalDB.
  MapField('ID','ID_MYTABLE').
  MapField('Field_1','FIELD_ONE').
  MapField('Field_2','FIELD_TWO').
    SetOptions([rpmNoCreateMissingTable, rpmNoCreateMissingField, rpmAutoMapKeywordFields]);

   

The TSQLmyTable point to an external DB (Firebird), and is maped to his real names.

The inserts, an updates are OK, but the Deletion in the follow way fails.

...
myRest.Delete(TSQLmyTable, 'FField_1 > 3')
...

or same SQLWhere where the count of IDs to delete was more than 1.
( when count of IDs is 1 run OK)
According to previous threads, I see that "myRest.Delete(aTable: TSQLRecordClass; SQLWhere: TRawUTF8)", first executes a select and obtains all the IDs that will be deleted according to the SQLWhere, to proceed with the "OnUpdateEvent" on the server.
As I can verify according to the trace, the "select" executes well and returns the list of IDs, but the "delete" fails and shows errors in the names of nonexistent fields, by the use of TSQLRecord names and not the real names of the database .
I do not understand why the select works well and the delete works poorly, both called with the same SQLWhere.
Any coments ar welcome...  thanks

Offline

#2 2018-06-22 10:17:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Delete in maped TSQLRecors to ExternalDB with SQLWhere sentences fail

There was indeed a problem here.

Please try https://synopse.info/fossil/info/ad37d9d785

Offline

#3 2018-06-22 12:36:27

camu72
Member
From: Salta - Argentina
Registered: 2015-07-12
Posts: 28

Re: Delete in maped TSQLRecors to ExternalDB with SQLWhere sentences fail

Thanks ab, you work at the speed of light. Everything works ok.

Offline

Board footer

Powered by FluxBB