- 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>
151 lines
5.3 KiB
ObjectPascal
151 lines
5.3 KiB
ObjectPascal
{ LnkCrsr.pas }
|
|
program LnkCrsr;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
|
|
SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
const
|
|
szMasterTable = 'customer'; { Name of master table }
|
|
szDetailTable = 'orders'; { Name of the detail table }
|
|
szTblType = szPARADOX; { Table type to use. }
|
|
|
|
{=====================================================================
|
|
Code: LnkCrsr();
|
|
|
|
Input: None.
|
|
|
|
Return: None.
|
|
|
|
Description:
|
|
Linking cursors establishes a link between two cursors
|
|
such that the detail cursor has its record set limited to
|
|
the set of records matching the linking key values of the
|
|
master cursor.
|
|
===================================================================== }
|
|
|
|
var
|
|
hDb: hDBIDb; { Handle to the Database }
|
|
hCurMaster: hDBICur; { Handle to the master table }
|
|
hCurDetail: hDBICur; { Handle to the detail table }
|
|
const
|
|
uNumRecs: UINT32 = 10; { Number of records to display, 0 := all }
|
|
uFieldsMaster: UINT16 = 1; { Link the first field of Customer }
|
|
uFieldsDetail: UINT16 = 2; { To the second field of Orders
|
|
(Which is indexed) }
|
|
|
|
begin
|
|
Screen('*** Linked Cursor Example ***');
|
|
|
|
Screen(' Initializing the engine...');
|
|
if (InitAndConnect(hDb) <> DBIERR_NONE) then { Terminate example if }
|
|
begin { Initialization fails }
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Setting the default Database directory...');
|
|
ChkRslt(DbiSetDirectory(hDb, pCHAR(szTblDirectory)), DBIERR_NONE,
|
|
' Error - SetDirectory.');
|
|
|
|
Screen(' Open the "'+szMasterTable+'" master table...');
|
|
if (ChkRslt(DbiOpenTable(hDb, pCHAR(szMasterTable), pCHAR(szTblType),
|
|
nil, nil, 0, dbiREADWRITE, dbiOPENSHARED,
|
|
xltFIELD, FALSE, nil, hCurMaster),
|
|
DBIERR_NONE, ' Error - OpenTable.') <> DBIERR_NONE) then
|
|
begin
|
|
CloseDbAndExit(hDb);
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Display the first 10 records of the "'+szMasterTable+'" ' +
|
|
'master table...');
|
|
ChkRslt(DisplayTable(hCurMaster, uNumRecs), DBIERR_NONE,
|
|
' Error - DisplayTable.');
|
|
|
|
Screen(' ');
|
|
Screen(' Open the "'+szDetailTable+'" detail table...');
|
|
if (ChkRslt(DbiOpenTable(hDb, pCHAR(szDetailTable), pCHAR(szTblType),
|
|
nil, nil, 0, dbiREADWRITE, dbiOPENSHARED,
|
|
xltFIELD, FALSE, nil, hCurDetail),
|
|
DBIERR_NONE, ' Error - OpenTable.') <> DBIERR_NONE) then
|
|
begin
|
|
CloseDbAndExit(hDb);
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Display the first 10 records of the "'+szDetailTable+'" ' +
|
|
'detail table...');
|
|
ChkRslt(DisplayTable(hCurDetail, uNumRecs), DBIERR_NONE,
|
|
' Error - DisplayTable.');
|
|
|
|
Screen('');
|
|
Screen(' Set to the Customer_No index on the detail table...');
|
|
ChkRslt(DbiSwitchToIndex(hCurDetail, nil, nil, 2, FALSE),
|
|
DBIERR_NONE, ' Error - SwitchToIndex.');
|
|
|
|
Screen(' Link the tables...');
|
|
|
|
{ Put the Customer table into link mode }
|
|
ChkRslt(DbiBeginLinkMode(hCurMaster), DBIERR_NONE,
|
|
' Error - BeginLinkMode.');
|
|
|
|
{ Put the Orders table into link mode }
|
|
ChkRslt(DbiBeginLinkMode(hCurDetail), DBIERR_NONE,
|
|
' Error - BeginLinkMode.');
|
|
|
|
{ Link the two tables, specifying which fields
|
|
will be linked in the last two parameters.
|
|
Specifically, link the first field of Customers
|
|
to the indexed second field of Orders }
|
|
ChkRslt(DbiLinkDetail(hCurMaster, hCurDetail, 1, @uFieldsMaster,
|
|
@uFieldsDetail), DBIERR_NONE,
|
|
' Error - LinkDetail.');
|
|
|
|
Screen(' Display the "'+szDetailTable+'" detail table after the link:');
|
|
Screen(' Note that all Customer No''s correspond to the last');
|
|
Screen(' record displayed in the master table.');
|
|
ChkRslt(DisplayTable(hCurDetail, uNumRecs), DBIERR_NONE,
|
|
' Error - DisplayTable.');
|
|
|
|
Screen('');
|
|
Screen(' End the link...');
|
|
|
|
{ Unlink the detail table from the master table }
|
|
ChkRslt(DbiUnlinkDetail(hCurDetail),
|
|
DBIERR_NONE, ' Error - EndLinkMode.');
|
|
|
|
{ Take the Customer table out of link mode }
|
|
ChkRslt(DbiEndLinkMode(hCurMaster),
|
|
DBIERR_NONE, ' Error - EndLinkMode.');
|
|
|
|
{ Take the Orders table out of link mode }
|
|
ChkRslt(DbiEndLinkMode(hCurDetail),
|
|
DBIERR_NONE, ' Error - EndLinkMode.');
|
|
|
|
Screen(' Close the tables...');
|
|
|
|
{ Close the Master table }
|
|
ChkRslt(DbiCloseCursor(hCurMaster), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
|
|
{ Close the detail table }
|
|
ChkRslt(DbiCloseCursor(hCurDetail), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
|
|
Screen(' Close the Database and exit IDAPI...');
|
|
CloseDbAndExit(hDb);
|
|
|
|
Screen('*** End of Example ***');
|
|
|
|
end.
|