Files
TeslaRel410/BORLAND/BDE/EXAMPLES/PASCAL/RDOLOCK.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

108 lines
4.0 KiB
ObjectPascal

{ rdolock.pas }
program RdOLock;
{$IfDef VER80}
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
DbiProcs, DbiTypes, DbiErrs;
{$Else}
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
SnipTool, SnipData;
{$EndIf}
const
szTblName = 'customer'; { Name of table to be opened }
szTblType = szPARADOX; { Type of the above table }
{=====================================================================
Function:
RdoLock();
Description:
This example shows how to make a directory read-only. A
directory is made read-only by calling the DbiAcqPersistTableLock
function with the fully qualified pathname of the directory
to lock. The 'filename' that is locked is PARADOX.DRO, which
IDAPI interprets as making the directory read-only (no file
named PARADOX.DRO should exist).
Note: Local Share needs to be set to 'TRUE' in IDAPI.CFG in order
for this example to work.
===================================================================== }
var
rslt: DBIResult; { Value returned from IDAPI functions }
hDb: hDBIDb; { Handle to the database }
hCur: hDBICur; { Handle to the table }
szLockName: array[0..DBIMAXPATHLEN] of CHAR;
begin
Screen('*** Making a directory read-only ***');
Screen(' Initializing IDAPI...');
if (InitAndConnect(hDb) <> DBIERR_NONE) then { Terminate example if }
begin { Initialization fails }
Screen('*** End of Example ***');
exit;
end;
ChkRslt(DbiSetDirectory(hDb, pCHAR(szTblDirectory)), DBIERR_NONE,
' Error - SetDirectory.');
{ Specify the directory to lock }
MakeFullPath(szLockName);
StrCat(szLockName, '\paradox.dro');
{ Mark the directory as read only. Note that the type of the
lock has to be set to 'PARADOX'. }
ChkRslt(DbiAcqPersistTableLock(hDb, szLockName, pCHAR(szTblType)),
DBIERR_NONE, ' AcqPersistTableLock.');
Screen(' Opening the '+szTblName+' table for Read/Write...');
Screen(' Expect error - directory read only...');
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(' Table opened in Read/Write mode - make certain local'+
' share is TRUE in IDAPI.CFG');
Screen(' in order to make a local directory read-only');
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
' Error - CloseCursor.');
end;
Screen('');
Screen(' Opening the '+szTblName+' Table for Read only...');
if (ChkRslt(DbiOpenTable(hDb, pCHAR(szTblName), pCHAR(szTblType),
nil, nil, 0, dbiREADONLY,
dbiOPENSHARED, xltFIELD, FALSE, nil,
hCur),
DBIERR_NONE, ' Error - OpenTable.') <> DBIERR_NONE) then
begin
ChkRslt(DbiRelPersistTableLock(hDb, szLockName, pCHAR(szTblType)),
DBIERR_NONE, ' RelPersistTableLock.');
CloseDbAndExit(hDb);
Screen('*** End of Example ***');
exit;
end;
Screen(' Display the first ten records in the table...');
DisplayTable(hCur, 10);
Screen('');
Screen(' Close the '+szTblName+' table...');
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
' Error - CloseCursor.');
{ Release the read-only lock on the directory }
ChkRslt(DbiRelPersistTableLock(hDb, szLockName, pCHAR(szTblType)),
DBIERR_NONE, ' RelPersistTableLock.');
Screen(' Close the Database and exit IDAPI...');
CloseDbAndExit(hDb);
Screen('*** End of Example ***');
end.