Aubit4GL allow us to link a record to a table and record it’s primary key. The statement:
DEFINE r LINKED TO tab PRIMARY KEY(col1)
effectively DEFINEs r as a RECORD LIKE tab and tells the compiler that col1 is its primary key. Having done that we can set the values of the record’s primary key field to a value and use the following Aubit4GL statements:
INSERT USING r
SELECT USING r
UPDATE USING r
DELETE USING r
An example program:
DATABASE test1
DEFINE lv_systables LINKED TO systables primary key (tabid)
MAIN
LET lv_systables.tabid=1
SELECT USING lv_systables
DISPLAY "Hello World : ",lv_systables.tabname
END MAIN
The compiler generates the appropriate WHERE x=y automatically. e.g.:
SELECT USING lv_systables
becomes under the bonnet:
SELECT * INTO lv_systables.* FROM systables
WHERE systables.tabid=lv_systables.tabid
You have saved yourself a lot of typing!