Files
TeslaRel410/BORLAND/BDE/EXAMPLES/PASCAL/TBLOPEN.PAS
T
CydandClaude Fable 5 63312e07f9 source410: literal 4.10 source reconstruction + BC++ 4.52 fleet toolchain archived
- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
  is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
  Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
  (extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
  BT game source (never mixed into CODE/). Round 1-3 state:
  * 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
    (BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
    since 1996.
  * BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
    its binary-recorded line 400 exactly.
  * BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
    (Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
    TeamScore=12 flagged [T4]).
  * MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
    (VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
    the period compiler is the drift detector).
  * Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
    (per-TU verification sweep under authentic OPT.MAK flags).
  * README: corrected roadmap - MECH.HPP is the capstone grown with the mech
    TU reconstructions; BTREG.CPP green = the header-family milestone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 07:33:26 -05:00

110 lines
3.8 KiB
ObjectPascal

{ tblopen.pas }
program TblOpen;
{$IfDef VER80}
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
DbiProcs, DbiTypes, DbiErrs;
{$Else}
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
SnipTool, SnipData;
{$EndIf}
const
szTblName = 'cust'; { Name of table to be opened }
szTblType = szDBASE; { Type of the above table }
{=====================================================================
Function:
TableOpen();
Description:
This example shows how to open and close a table.
===================================================================== }
var
rslt: DBIResult; { Value returned from IDAPI functions }
hDb: hDBIDb; { Handle to the database }
hCur: hDBICur; { Handle to the table }
begin
Screen('*** Opening a Table ***');
Screen(' Initializing IDAPI...');
InitOutput;
rslt := ChkRslt(DbiInit(nil), DBIERR_NONE, ' Error - Init');
if (rslt <> DBIERR_NONE) then { Check if successfull }
begin
Screen('');
Screen('*** End of Example ***');
CloseOutput;
exit;
end;
{ Open the standard database. Notice that we are opening the
database in READWRITE mode and SHARED mode. }
Screen(' Opening Standard Database...');
if (ChkRslt(DbiOpenDatabase('', nil, dbiREADWRITE, dbiOPENSHARED,
nil, 0, nil, nil, hDb),
DBIERR_NONE, ' Error - OpenDatabase.') <> DBIERR_NONE) then
begin
{ Clean up since an error occured }
ChkRslt(DbiExit, DBIERR_NONE, ' Error - Exit.');
Screen('');
Screen('*** End of Example ***');
CloseOutput;
exit;
end;
Screen(' Set the directory which is used by the database...');
ChkRslt(DbiSetDirectory(hDb, pCHAR(szTblDirectory)), DBIERR_NONE,
' Error - SetDirectory.');
{ Open the table. The important options are:
hDb - Handle to the database of the table
Paradox and dBASE use the STANDARD database
szTblName - Name of the table
szTblType - Type of the table - not needed if the table name
contains an extension
dbiREADWRITE - Open the table for both Reading and Writting
DBIOPENSHARED - Open the table in shared mode - other
applications can have concurrent access
xltFIELD - Field values are translated from Internal Paradox
types to types useable in the application. }
Screen(' Opening the '+szTblName+' Table...');
if (ChkRslt(DbiOpenTable(hDb, pCHAR(szTblName), pCHAR(szTblType),
nil, nil, 0, dbiREADWRITE,
dbiOPENSHARED, xltFIELD, FALSE, nil,
hCur),
DBIERR_NONE, ' Error - OpenTable.') <> DBIERR_NONE) then
begin
Screen(' Close the standard database...');
ChkRslt(DbiCloseDatabase(hDb), DBIERR_NONE,
' Error - CloseDatabase.');
Screen(' Exit IDAPI...');
ChkRslt(DbiExit, DBIERR_NONE, ' Error - Exit.');
Screen('');
Screen('*** End of Example ***');
CloseOutput;
exit;
end;
Screen('');
Screen(' The '+szTblName+' table was opened successfully!');
Screen('');
Screen(' Close the '+szTblName+' table...');
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
' Error - CloseCursor.');
Screen(' Close the standard database...');
ChkRslt(DbiCloseDatabase(hDb), DBIERR_NONE,
' Error - CloseDatabase.');
Screen(' Exit IDAPI...');
ChkRslt(DbiExit, DBIERR_NONE, ' Error - Exit.');
Screen('');
CloseOutput;
Screen('*** End of Example ***');
end.