sx_Commit

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_Commit

VB Declaration

Declare Sub sx_Commit Lib "Apollo9.dll" ()

C Declaration

VOID FAR PASCAL sx_Commit (VOID);

Description

Writes the contents of the record buffer to the current file position. The sx_Replace, sx_PutVariant, and sx_PutRecord functions do not physically write a changed record buffer to disk until a record movement function is called (either explicitly or implicitly via a relational move) or the file is closed with a hot record buffer. Use sx_Commit to force an immediate physical write.

A record is written by sx_Commit only if the record buffer has changed since being read.

Note: In Windows, and on most networks, some sort of disk caching mechanism is usually active. sx_Commit does a low level write to disk which may be intercepted by the buffering subsystem. Apollo has no control over when or how often the disk buffers are flushed so there will not necessarily be any disk activity observed when sx_Commit is called.

When Optimistic Buffering is active, you can force an immediate flush of the buffers by calling sx_SysProp( SDE_SP_PUTOBUFFER, 0 ).

VB Example

If sx_Rlock(sx_RecNo()) Then

sx_Replace "name", R_CHAR, ByVal RTrim$((BoxName.Text))

sx_Commit

sx_Unlock sx_RecNo()

Else

MsgBox "Record lock failed"

End If

C Example

// save the record

void CNamesForm::OnButtonSave()

{

// explicitly save the record and then unlock

sx_Commit();

sx_Unlock(sx_RecNo());

 

// if editing, refresh line

if (!bAddMode)

m_sdebrowse->SetNumProperty("Action", BRW_ACT_REFRESHLINE);

// else refresh display on add  

else

{

// reset add switch

bAddMode = FALSE;

 

// if scroll bar present, refresh all

if (m_sdebrowse->GetNumProperty("VBarDim"))

m_sdebrowse->SetNumProperty("Action", BRW_ACT_REFRESHALL);

 

// otherwise, gotop

else

m_sdebrowse->SetNumProperty("Action", BRW_ACT_GOTOP);

}

 

// set focus to browse control

m_sdebrowse->SetFocus();

return;

}

See Also

sx_Append, sx_AppendBlank, sx_PutRecord, sx_PutVariant, sx_Replace