This function is intended for the quick copying of data from one connection (ODBC or Firebird/InterBase®) to another (Firebird/InterBase® only)
The ibec_CopyData function returns the number of records copied from SrcConnection to DestConnection.
function ibec_CopyData(SrcConnection : variant; DestConnection : variant; DestTableName : string; SelectStatement : string; Options : string; CallbackBlock : variant) : integer;
Possible options are:
Example of an Options string:
'CommitAfter=1000; CreateTable'
execute ibeblock as begin cbb = 'execute ibeblock (RecNo integer) as begin if (ibec_mod(RecNo, 100) = 0) then ibec_Progress(RecNo || 'records copied...'); end'; OdbcCon = ibec_CreateConnection(__ctODBC, 'DBQ=C:\IBE Demo\demo.mdb; DRIVER=Microsoft Access Driver (*.mdb)'); DB = ibec_CreateConnection(__ctInterBase, 'DBName="localhost:D:\FB2_DATA\IBEHELP.FBA"; ClientLib=C:\Program Files\Firebird\bin\fbclient.dll; user=SYSDBA; password=masterkey; names=WIN1251; sqldialect=3'); try use DB; if (exists(select * from rdb$relations where rdb$relation_name = 'IBEC_COPYDATA')) then begin execute statement 'drop table IBEC_COPYDATA'; commit; end; Country = 'US'; RecCount = ibec_CopyData(OdbcCon, DB, 'IBEC_COPYDATA', 'SELECT * FROM CUSTOMER WHERE COUNTRY < :Country', 'CommitAfter=100; EmptyTable; CreateTable; DontQuoteIdents', cbb); if (RecCount is not null) then ibec_ShowMessage(RecCount || 'records copied successfully.'); finally ibec_CloseConnection(DB); ibec_CloseConnection(OdbcCon); end; end