Page 1 of 1

best way to copy blobs from SDAC to LiteDAC over the network in Firemonkey FMX

Posted: Fri 21 Sep 2018 09:11
by witzl
Hi,

on serverside I have a SQL-Servertable, with 5000 blobs:

SQLServerTable:
ID: Integer
Pic: VarBinary

In my Firemonkey IOS App I have SDAC-Client and LiteDAC client.

SQLIteTable:
ID: Integer
Pic: VarBinary

I can connect via network to the SQLServerTable and want to copy the data to my local SQLiteTable.

What is the best way to copy the data?

Case 1:

Code: Select all

SQLServerTable : TMSQuery;
SQLiteTable : TLiteQuery;
SQLServerTable.SQL.Text := 'select ID, Pic from SQLServerTable';
SQLServerTable.open;

SQLiteTable.SQL.Text :=  'select ID, Pic from SQLiteTable';
SQLiteTable.open;

while not SQLServerTable.eof do begin
  SQLiteTable.Insert;
  SQLiteTable.FieldByName('ID').Value :=  SQServerTable.FieldByName('ID').Value;
  SQLiteTable.Post;
  SQLServerTable.next;
end;
SQLiteTable.Close;
SQLServerTable.Close;
Or should I use TLiteScript with parameters:

Case 2:

Code: Select all

SQLServerTable : TMSQuery;
SQLiteScript : TLiteScript;

SQLServerTable.SQL.Text := 'select ID, Pic from SQLServerTable';
SQLServerTable.open;

SQLiteScript.SQL.Text := 'insert into SQLiteTable (ID, PIC) values (:ID, :PIC)';

while not SQLServerTable.eof do begin
  SQLiteScript.ParamByName('ID').Value := SQServerTable.FieldByName('ID').Value;
  SQLiteScript.ParamByName('PIC').Value := SQServerTable.FieldByName('PIC').Value;
  SQLiteScript.Execute;
  SQLServerTable.next;
end;
SQLServerTable.Close;
Or do you have a better way? BulkCopy?

Case 2 doesn't work, the Pics are NOT copied!

Thanks in advance,
Dietrich

Re: best way to copy blobs from SDAC to LiteDAC over the network in Firemonkey FMX

Posted: Sat 22 Sep 2018 09:26
by MaximG
We have answered you in the forum. Please view the following topic:

https://forums.devart.com/viewtopic. ... 61#p131561