Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_abandon( [ <lall> ] ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_ABANDON( [ <lAll> ] )


Parameters

<lAll>
If set to logical true, voids uncommitted updates in all work areas. If 
false or omitted, only the current work area is affected.


Returns

NIL.


Description

N_ABANDON() makes it possible to edit database fields directly, even in 
a multiuser environment, by enabling you to void the most recent 
uncommitted update.

An uncommitted update is one where a field has been the target of a 
REPLACE, GET, DELETE, or RECALL but Clipper's internal buffers have
not yet been written to disk. Normally, Clipper will not write modified
data to disk until you issue a COMMIT or UNLOCK command, or you move the
record pointer with, for example, SKIP or GOTO.

Clipper provides no way to back out of an update that has not yet been
committed to disk. That is where N_ABANDON() can help. Calling N_ABANDON()
with no arguments voids the most recent uncommitted update in the current
work area. Calling N_ABANDON(.T.) voids the most recent uncommitted update
in all work areas.

Note: N_ABANDON() will not void updates to memo fields.


Example

// Update without using N_ABANDON()
USE Customer SHARED
CLEAR
DO WHILE !RLOCK()
ENDDO
MEMVAR->Customer = Customer->Customer
MEMVAR->Address = Customer->Address

@ 1, 1 SAY 'Name: ' GET MEMVAR->Customer
@ 2, 1 SAY 'Address: ' GET MEMVAR->Address
READ
IF LASTKEY() != 27 .AND. UPDATED()
   REPLACE Customer->Customer WITH MEMVAR->Customer, ;
           Customer->Address WITH MEMVAR->Address

ENDIF
COMMIT
UNLOCK


// Same thing using N_ABANDON()
USE Customer SHARED
CLEAR
DO WHILE !RLOCK()
ENDDO
@ 1, 1 SAY 'Name: ' GET Customer->Customer
@ 2, 1 SAY 'Address: ' GET Customer->Address
READ
IF LASTKEY() = 27
   N_ABANDON()
ENDIF
COMMIT
UNLOCK



See Also: N_TROLLBACK()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson