![]() ![]() ![]() ![]() ![]() ![]() ![]() |
||
BDE API Examples (DbiCreateTempTable)Creates a temporary table that is deleted when the cursor is closed, unless the call is followed by a call to DbiMakePermanent.
Create a temporary table and return the cursor handleThis example uses the following input: hCur := CreateTempTable(Database1.Handle);function CreateTempTable(hDB: hDBIDb): hDBICur;
const
FIELDS = 3;
TABLE_NAME = 'TempTbl';
var
pFields: pFLDDesc;
TblDesc: CRTblDesc;
begin
// Initialize structures to zero...
Result := nil;
FillChar(TblDesc, sizeof(TblDesc), 0);
// Allocate memory for the field descriptors...
pFields := AllocMem(FIELDS * sizeof(FLDDesc));
try
// Create an AUTOINC field (Visual dBASE 7 field type only)...
pFields^.iFldNum := 1;
pFields^.szName := 'Field_Number_1';
pFields^.iFldType := fldINT32;
pFields^.iSubType := fldstAUTOINC;
Inc(pFields);
// Create a STRING field...
pFields^.iFldNum := 2;
pFields^.szName := 'Field_Number_2';
pFields^.iFldType := fldZSTRING;
pFields^.iUnits1 := 20;
Inc(pFields);
// Create a TIMESTAMP field (Visual dBASE 7 field type only)...
pFields^.iFldNum := 3;
pFields^.szName := 'Field_Number_3';
pFields^.iFldType := fldTIMESTAMP;
Dec(pFields, FIELDS - 1);
// Add the field and index information to the table descriptor...
TblDesc.szTblName := TABLE_NAME;
TblDesc.szTblType := szDBASE;
TblDesc.iFldCount := FIELDS;
TblDesc.pfldDesc := pFields;
//Create the table (even if it already exists)...
Check(DbiCreateTempTable(hDb, TblDesc, Result));
finally
Freemem(pFields);
end;
end;
| ||
|
DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains. |
||
| Trademarks & Copyright © 1998 Borland International, Inc. | ||