BELLEKTE TABLOLAR OLUŞTURUN...vERİ AKTARIM İŞLEMLERINDE DISK YERINE BELLEĞİ KULLANARAK
ÇOK DAHA HIZLI İŞLEMLER YAPABİLİRSİNİZ
// öRNEK 1
Create an in-memory table using a custom field descriptor.
procedure MakeInMemTable1;
const
fldDes: array[0..2] of FLDDesc = (
// Field 1 - ALPHA
(iFldNum: 1;
szName: 'ALPHA';
iFldType: fldZSTRING;
iSubType: fldUNKNOWN;
iUnits1: 10;
iUnits2: 0;
iOffset: 0;
iLen: 0;
iNullOffset: 0;
efldvVchk: fldvNOCHECKS;
efldrRights: fldrREADWRITE),
// Field 2 - NUMERIC
(iFldNum: 2;
szName: 'NUMERIC';
iFldType: fldFLOAT;
iSubType: fldUNKNOWN;
iUnits1: 0;
iUnits2: 0;
iOffset: 0;
iLen: 0;
iNullOffset: 0;
efldvVchk: fldvNOCHECKS;
efldrRights: fldrREADWRITE),
// Field 3 - SHORT
(iFldNum: 3;
szName: 'SHORT';
iFldType: fldINT16;
iSubType: fldUNKNOWN;
iUnits1: 0;
iUnits2: 0;
iOffset: 0;
iLen: 0;
iNullOffset: 0;
efldvVchk: fldvNOCHECKS;
efldrRights: fldrREADWRITE));
var
hIMcur : hDBICur;
hNilDB : hDBIDb;
begin
Check(dbiOpenDatabase(nil, nil, dbiREADWRITE, dbiOPENSHARED, nil, 0, nil,
nil, hNilDB));
Check(dbiCreateInMemTable(hNilDB, 'InMemTbl', 3, @fldDes, hIMCur));
end;
//*************************************************************************************
// iKİNCİ ÖRNEK
Create an in-memory table by borrowing the field descriptor from an existing Paradox table.
The existing table is passed in the Tbl parameter.
procedure MakeInMemTable2(Tbl: TTable);
var
TblProps : CurProps;
PFDesc : pFldDesc;
hIMcur : hDBICur;
MemSize : Integer;
begin
Check(dbiGetCursorProps(Tbl.Handle, TblProps));
MemSize := SizeOf(FldDesc) * (TblProps.iFields);
PFDesc := AllocMem(MemSize);
try
Check(dbiGetFieldDescs(Tbl.Handle, PFDesc));
Check(dbiCreateInMemTable(Tbl.DBHandle, 'InMemTbl', 3, PFDesc, hIMCur));
finally
FreeMem(PFDesc, MemSize);
end;
end;