BatcMove problems

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Matija
Posts: 4
Joined: Mon 22 Jul 2013 08:16

BatcMove problems

Post by Matija » Mon 22 Jul 2013 08:43

Hello!
I have problem with working BatchMove.
Let say I have two identical tables (MySQL).
Table1; ID (autonumber); field1; field2; field3; field4
Table2; ID (autonumber); field1; field2; field3; field4

Code: Select all

BatchMove.Mode := bmAppendUpdate;
BatchMove.Source; SELECT field1, field2 FROM Table1
BatchMove.Destination; SELECT field1, field2 FROM Table2
BatchMove.Execute;
How does this AppendUpdate works? When it recognize that is a new record or it's an old record need for update?
Is the Field1 that must be the same in both tables, than the system will update the record?
Does other filed play any role in this process?

Best regards,
Matija

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: BatcMove problems

Post by DemetrionQ » Mon 22 Jul 2013 13:57

Hello.

When the bmAppendUpdate mode is used, records in the destination dataset are replaced with the matching records from the source dataset. If there is no matching record in the destination dataset, the record will be appended to it. Records are searched by key fields. Therefore, for correct work of TCRBatchMove, key fields are required in the source and destination datasets.

Matija
Posts: 4
Joined: Mon 22 Jul 2013 08:16

Re: BatcMove problems

Post by Matija » Tue 23 Jul 2013 07:43

Hello,
Thank you for your answer. The problem was, that I didn't use key fields.
While I am not the owner of the source table, using the key field only in destination table it seem it's working also fine. Thank you again.

Best regards,
Matija

DemetrionQ
Devart Team
Posts: 271
Joined: Wed 23 Jan 2013 11:21

Re: BatcMove problems

Post by DemetrionQ » Tue 23 Jul 2013 08:20

If any other questions come up, please contact us.

Post Reply