Tutorial Chapter 6: Append, Update, Delete
This program allows the user to create, modify and remove rows in
the customer database table. Embedded SQL statements
(UPDATE
/INSERT
/DELETE
) are used to modify the SQL
table, based on the values stored in the program record.
Modules organization The customer management program is build from different modules with specific roles.Importing modules Genero BDL support the IMPORT FGL
instruction to simplify programming.Example: custmain.4gl The MENU
statement in the module custmain.4gl is modified to call functions for appending, updating, and deleting the rows in the customer table.Example: custquery.4gl The custquery module implements the SQL cursor to browser the customer record set produced from a QBE CONSTRUCT
query. In this section we describe the changes done from the custquery.4gl version of the previous chapter.Example: comutils.4gl The comutils.4gl module implements a set of utility functions used by other modules.The custdata.4gl module The custdata.4gl module implements customer table modification and utility functions.The INPUT statement The INPUT
statement allows the user to enter or change the values in a program record, which can then be used as the data for new rows in a database table, or to update existing rows.Updating Database Tables The values of the program variables that have been input through the form can be used in SQL statements that update tables in a database.Appending/Updating a row The INPUT
statement provides control blocks to allow your program to initialize field contents and validate user input when adding or updating a row.Deleting a Row The SQL DELETE
statement can be used to delete rows from the database table.