- 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>
163 lines
5.6 KiB
ObjectPascal
163 lines
5.6 KiB
ObjectPascal
{ recupdat.pas }
|
|
program RecUpdat;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
|
|
SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
const
|
|
szTblName = 'contacts'; { Name of table to be opened }
|
|
szTblType = szPARADOX; { Type of the above table }
|
|
|
|
{=====================================================================
|
|
Function:
|
|
RecordUpdate();
|
|
|
|
Description:
|
|
This example shows how to update records in a table.
|
|
===================================================================== }
|
|
|
|
var
|
|
rslt: DBIResult; { Value returned from IDAPI functions }
|
|
hDb: hDBIDb; { Handle to the database }
|
|
hCur: hDBICur; { Handle to the table }
|
|
pRecBuf: pBYTE; { Pointer to the record buffer }
|
|
curProp: CURProps; { Properties of the table }
|
|
szLastName: array[0..20] of CHAR; { LastName }
|
|
szFirstName: array[0..20] of CHAR; { First Name }
|
|
szCompany: array[0..30] of CHAR; { Company Name }
|
|
szPhone: array[0..16] of CHAR; { Phone Number }
|
|
|
|
begin
|
|
Screen('*** Updating Records ***');
|
|
|
|
Screen(' Initializing IDAPI...');
|
|
if (InitAndConnect(hDb) <> DBIERR_NONE) then { Terminate example if }
|
|
begin { Initialization fails }
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Set the directory which is used by the database...');
|
|
ChkRslt(DbiSetDirectory(hDb, pCHAR(szTblDirectory)), DBIERR_NONE,
|
|
' Error - SetDirectory.');
|
|
|
|
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
|
|
CloseDbAndExit(hDb);
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
{ Add a record. }
|
|
Screen('');
|
|
Screen(' Determine the size of the record and allocate a'+
|
|
' buffer to hold records...');
|
|
ChkRslt(DbiGetCursorProps(hCur, curProp), DBIERR_NONE,
|
|
' Error - GetCursorProps.');
|
|
|
|
{ Allocate memory for the record buffer }
|
|
GetMem(pRecBuf, curProp.iRecBufSize);
|
|
if not Assigned (pRecBuf) then
|
|
begin
|
|
Screen(' Error - Out of Memory.');
|
|
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
CloseDbAndExit(hDb);
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
{ Set the data to add. }
|
|
StrCopy(szLastName, 'Smith');
|
|
StrCopy(szFirstName, 'John');
|
|
StrCopy(szCompany, 'Kauai Dive Shoppe');
|
|
StrCopy(szPhone, '(304) 113-2244');
|
|
|
|
Screen(' Initialize the record buffer...');
|
|
ChkRslt(DbiInitRecord(hCur, pRecBuf), DBIERR_NONE,
|
|
' Error - InitRecord.');
|
|
|
|
Screen(' Add the fields to the record buffer...');
|
|
ChkRslt(DbiPutField(hCur, 1, pRecBuf, @(szLastName)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiPutField(hCur, 2, pRecBuf, @(szFirstName)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiPutField(hCur, 3, pRecBuf, @(szCompany)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiPutField(hCur, 4, pRecBuf, @(szPhone)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
Screen(' Add the record to the table...');
|
|
Screen('');
|
|
rslt := ChkRslt(DbiInsertRecord(hCur, dbiNOLOCK, pRecBuf),
|
|
DBIERR_NONE, ' Error - InsertRecord.');
|
|
if (rslt <> DBIERR_NONE) then
|
|
begin
|
|
if (rslt = DBIERR_KEYVIOL) then
|
|
begin
|
|
Screen(' Expected error - Continue....');
|
|
end
|
|
else
|
|
begin
|
|
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
CloseDbAndExit(hDb);
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
Screen(' Search for the value in the table...');
|
|
Screen('');
|
|
ChkRslt(DbiSetToKey(hCur, keySEARCHEQ, FALSE, 0, 0, pRecBuf),
|
|
DBIERR_NONE, ' Error - SetToKey.');
|
|
|
|
Screen(' Change the Phone number of the just added record...');
|
|
Screen('');
|
|
|
|
Screen(' Get the record from the table...');
|
|
ChkRslt(DbiGetNextRecord(hCur, dbiWRITELOCK, pRecBuf, nil),
|
|
DBIERR_NONE, ' Error - GetNextRecord.');
|
|
|
|
Screen(' Change the value in the "Phone" field...');
|
|
StrCopy(szPhone, '(304) 222-9876');
|
|
ChkRslt(DbiPutField(hCur, 4, pRecBuf, @(szPhone)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
Screen(' Write the changes to the table...');
|
|
ChkRslt(DbiModifyRecord(hCur, pRecBuf, TRUE),
|
|
DBIERR_NONE, ' Error - ModifyRecord.');
|
|
|
|
Screen(' Delete the record which was added...');
|
|
Screen('');
|
|
ChkRslt(DbiDeleteRecord(hCur, nil),
|
|
DBIERR_NONE, ' Error - DeleteRecord.');
|
|
|
|
FreeMem(pRecBuf, curProp.iRecBufSize);
|
|
|
|
Screen(' Close the "'+szTblName+'" table...');
|
|
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
|
|
Screen('');
|
|
Screen(' Close the Database and exit IDAPI...');
|
|
CloseDbAndexit(hDb);
|
|
|
|
Screen('*** End of Example ***');
|
|
|
|
end.
|