The INSERT command was the native xBase language predecessor of the INSERT - SQL command and has one major advantage - it allows you to insert a new record anywhere in a table.
Modern processors largely overcome the performance problem associated with such a feature, but even so the use of the command needs careful consideration by the developer.
No longer documented but still available, the syntax of the [color blue]INSERT[/color] command is:-
[color blue]
INSERT [BEFORE] [BLANK]
[/color]
Description:
[color blue]
INSERT[/color] places a new record into the current table immediately after the current record and displays the new record for editing.
If [color blue]CARRY[/color] is [color blue]SET ON[/color] and [color blue]BLANK[/color] isn't included, data in the previous record is automatically copied into the new record.
Note - if the file is indexed, [color blue]INSERT[/color] works like [color blue]APPEND[/color].
Clause [color blue]BEFORE[/color]
[tab]Issuing [color blue]INSERT BEFORE[/color] inserts a new record into the current table immediately before the current record. The record is then displayed for editing. Data can only be entered into the new record.
Clause [color blue]BLANK[/color]
[tab]Issuing [color blue]INSERT BLANK[/color] inserts a new record into the current table immediately after the current record. An editing window is not displayed.
[tab]Issuing [color blue]INSERT BLANK BEFORE[/color] inserts a new record into the current table immediately before the current record. An editing window is not displayed.
Note - [color blue]INSERT[/color] is not recommended for use with large tables because an insertion near the front of the table forces the rewriting of nearly every record.
It' s also important to note that the [color blue]RECNO()[/color] order changes after each record insertion.
So if you [color blue]GO TOP[/color] and [color blue]INSERT BLANK BEFORE[/color], the [color blue]RECN()[/color] of that new record becomes 1, and what was previously 1 now becomes 2, etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.