<< Click to Display Table of Contents >> Navigation: Apollo API Listing > sx_Flock |
Declare Function sx_Flock Lib "Apollo9.dll" () As Integer
BOOL FAR PASCAL sx_Flock (VOID);
Locks the current table.
True if the lock was successful and False if not. In Windows, SHARE.EXE should be loaded at the work station in order to achieve consistent file lock results.
Locks will be retried according to the time-out value set via sx_SetLockTimeout before returning a lock failure.
' reindex
iArea = sx_Use("\vb\sxlog.dbf", "sxlog", READWRITE, SDENTX)
Log1Ntx = sx_IndexOpen("C:\vb\sxlog1.ntx")
Log2Ntx = sx_IndexOpen("C:\vb\sxlog2.ntx")
If sx_Flock() Then
sx_SetGaugeHook GaugeBox.hWnd
GaugeFiles = 2 ' global to set gauge proportion
sx_Reindex
sx_SetGaugeHook 0
sx_Unlock 0
Else
MsgBox "Lock failed. Try again later."
End If
void CNamesForm::OnButtonAppendBatch()
{
// save master before append
if (sx_Flock())
{
sx_CopyFile("c:\\back\\sqmback.dbf");
if (!sx_AppendFrom("c:\\vb\\sxqueue.dbf", SDENTX, NULL))
{
// on failure, restore master
AfxMessageBox((LPCSTR) "Batch append failed.");
sx_Close();
sx_Use("c:\\back\\sqmback.dbf", "qback", READONLY, SDENTX);
sx_CopyFile("c:\\vb\\SDE2\\sqmast.dbf");
sx_Use("c:\\vb\\sqmast.dbf", "qmaster", READWRITE, SDENTX);
}
else
{
sx_GoTop();
sx_Unlock(0);
}
}
else
AfxMessageBox((LPCSTR) "File lock failed.");
}