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

101 lines
3.7 KiB
C++

// BDE - (C) Copyright 1995 by Borland International;
// rdolock.c
#include "snipit.h"
static const char szTblName[] = "customer";
static const char szTblType[] = szPARADOX;
//=====================================================================
// 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 path name 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.
//=====================================================================
void
RdoLock (void)
{
DBIResult rslt; // Value returned from IDAPI functions
hDBIDb hDb; // Handle to the database
hDBICur hCur; // Handle to the table
DBIPATH szLockName; // Contains the read-only lock
Screen("*** Making a directory read-only ***\r\n");
BREAK_IN_DEBUGGER();
Screen(" Initializing IDAPI...\r\n");
if (InitAndConnect(&hDb) != DBIERR_NONE)
{
Screen("\r\n*** End of Example ***");
return;
}
Screen(" Setting the database directory...");
rslt = DbiSetDirectory(hDb, (pCHAR) szTblDirectory);
ChkRslt(rslt, "SetDirectory");
// Specify the directory to lock.
strcpy(szLockName, szTblDirectory);
// Name of the directory lock.
strcat(szLockName, "\\paradox.dro");
// Mark the directory as read only. Note that the type of the
// lock has to be set to "PARADOX".
rslt = DbiAcqPersistTableLock(hDb, szLockName, (pCHAR) szTblType);
ChkRslt(rslt, "AcqPersistTableLock");
Screen(" Opening the %s table for Read/Write...", szTblName);
Screen(" Expect error - directory read only...");
rslt = DbiOpenTable(hDb, (pCHAR) szTblName, (pCHAR) szTblType,
NULL, NULL, NULL, dbiREADWRITE, dbiOPENSHARED,
xltFIELD, FALSE, NULL, &hCur);
if (ChkRslt(rslt, "OpenTable") == DBIERR_NONE)
{
Screen(" Table opened in Read/Write mode - make certain local"
" share is TRUE in IDAPI.CFG\r\n"
" in order to make a local directory read-only");
rslt = DbiCloseCursor(&hCur);
ChkRslt(rslt, "CloseCursor");
}
Screen("\r\n Opening the %s table for read-only...", szTblName);
rslt = DbiOpenTable(hDb, (pCHAR) szTblName, (pCHAR) szTblType,
NULL, NULL, NULL, dbiREADONLY, dbiOPENSHARED,
xltFIELD, FALSE, NULL, &hCur);
if (ChkRslt(rslt, "OpenTable") != DBIERR_NONE)
{
rslt = DbiRelPersistTableLock(hDb, szLockName, (pCHAR) szTblType);
ChkRslt(rslt, " RelPersistTableLock");
CloseDbAndExit(&hDb);
Screen("\r\n*** End of Example ***");
return;
}
Screen(" Display the first ten records in the table...");
DisplayTable(hCur, 10);
Screen("\r\n Close the %s table...", szTblName);
rslt = DbiCloseCursor(&hCur);
ChkRslt(rslt, "CloseCursor");
// Release the read-only lock on the directory.
rslt = DbiRelPersistTableLock(hDb, szLockName, (pCHAR) szTblType);
ChkRslt(rslt, "RelPersistTableLock");
Screen(" Close the database and exit IDAPI...");
CloseDbAndExit(&hDb);
Screen("\r\n*** End of Example ***");
}