Consult between 2 server

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cybsistemas
Posts: 118
Joined: Mon 12 Sep 2005 17:31
Location: Argentina

Consult between 2 server

Post by cybsistemas » Fri 07 May 2010 13:55

This can be done ?

UPDATE [email protected] SET fieldname1 = (SELECT fieldname2 FROM [email protected] WHERE tablename2.id = tablename1.id);

As it would be the sentence

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 11 May 2010 08:13

MySQL server doesn't allow such syntax.

cybsistemas
Posts: 118
Joined: Mon 12 Sep 2005 17:31
Location: Argentina

Post by cybsistemas » Tue 11 May 2010 10:26

Thanks

cybsistemas
Posts: 118
Joined: Mon 12 Sep 2005 17:31
Location: Argentina

Post by cybsistemas » Sun 23 May 2010 23:46

Yes, It can with engine Federated. (1,7 seconds)

But is faster that way:

MyConnectionLocal.Server: = 'localhost';
MyConnectionRemote.Server: = 'remote.dyndns.org;

MyCommandLocal.SQL.Text: = 'insert into tableLocal select Id, price from articles;
MyCommandLocal.SQL.Add ('where mark = true ');
MyCommandLocal.Execute; / / (5 records)

DumpLocal.Tablenames: = 'TableLocal;
DumpLocal.BackupToFile ('File.Sql');


DumpRemote.RestoreFromFile ('file.sql');

MyCommandRemote.Sql.Text: = update articles set price = select price from tableremote where articles.id = tableremote.id'
MyCommandRemote.Execute; / / (0,7 seconds)

Post Reply