You are not logged in.
Pages: 1
Hi all,
I've to load data from a mysql external table and make some changes in the sqlite3 (without impacting mysql one) and finally to put records on an other MSSql external table. Is there a possibilty to unregister mysql table just after pumping data and to continue work only with sqlite3 ?
Thx.
Offline
AFAIR this is not feasible, nor wished.
You can use dedicated sub-class, then register it with a dedicated external engine and its exact MS SQL table name, then do your "pumping", and continue to work with the main SQlite3 class.
Online
Ok, I've created a sub-class named TSQLMyClass derived from TSQLClass that have external table but i dont know how to pump data from the sub-class into the mother one !
Offline
I've found the fillfrom() method but it doesn't copy all fields. This code copy records with empty fields :
var myRec : TSQLmyClass;
sqlRec: TSQLClass;
Results: TIntegerDynArray;
begin
try
myRec := TSQLmyClass.CreateAndFillPrepare(globalClient, '');
sqlRec:= TSQLClass.Create;
if globalClient.TransactionBeginRetry(TSQLClass, 20) then
try
globalClient.BatchStart(TSQLClass);
while myRec.FillOne do
begin
sqlRec.FillFrom(myRec);
globalClient.BatchAdd(sqlRec, true);
end;
globalClient.BatchSend(Results);
globalClient.Commit();
except
globalClient.RollBack();
end;
finally
myRec .Free;
sqlRec.Free;
end;
end;
Offline
As stated by the documentation of TSQLRecord.FillFrom():
source object must be a parent or of the same class as the current record
If thjs is not the case (i.e. TSQLClass is not tied to TSQLmyClass), you can use a temporary JSON conversion:
sqlRec.FillFrom(myRec.GetJSONValues(true,true,soInsert));
Online
Thx Arnaud, it works perfectly.
Offline
Pages: 1