Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RaSQL/B 6.1a for Clipper - <b>n_xinsert()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_XINSERT()
Insert new record into current table

Syntax
N_XINSERT()

RDD
Use APPEND BLANK or DBAPPEND()

Returns
True if successful. False on failure. Use N_XERROR() to get an error code.

Remarks
RaSQL writes data from the current record buffer, which is affected by 
N_XREPLACE(), N_XGATHER() or N_XCLRBUF().

After N_XINSERT(), the newly added record becomes current. RaSQL does not 
automatically lock the record.

You can add multiple copies of a new record by issuing N_XINSERT() 
repeatedly, unless a key field has been defined as UNIQUE.

Appending new records to a Clipper DBF requires two writes to disk: first to 
add a blank record, then to replace it with a populated record. In contrast, 
N_XINSERT() adds a new, populated  record with a single disk write. The 
result is more efficient I/O and fewer blank  records in the file.

Although Btrieve avoids Clipper's two disk-writes, inserting a record still 
requires two operations, first to write the record and then to read it back. 
You can avoid the readback by passing the optional argument, N_XINSERT(.T.). 
This will increase speed and is useful at the end of a transaction when you 
do not expect to access the record again. To access the record for another 
transaction, you will need to retrieve the record using N_XSEEK(), 
N_XGOTO(), or N_XSKIP().

Example
N_XCLRBUF()       && Clear record buffer
N_XREPLACE('last_name', 'Byrne', ;
  'first_name', 'David')
N_XINSERT()       && Add record to table


See Also: N_XHARDWRITE() N_XUPDATE()

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