EGL adds the information based on the values in the key fields of the record variable.
EGL creates an SQL INSERT statement in your generated code based on the values and properties of the SQL record variable in your EGL add statement. For more information about this implicit SQL code, see SQL data access. Alternatively, you can use an #sql directive to write your own embedded SQL INSERT statement (see #sql directive).
If the add statement specifies a single SQL record variable, the statement creates a single row in the database. You can also specify a dynamic array of SQL record variables, in which case the statement creates a row for each member of the array.
INSERT INTO tableName (column01, ... columnNN) values (:recordItem01, ... :recordItemNN)
The key values in the record determine the logical position of the data in the table. The database management system handles records that do not have keys in accordance with the SQL table definition and the rules of the database. The Record part on which you base your record variable associates record fields with columns in the database table. EGL uses these associations to determine the value assignments in the INSERT statement. The use of host variables (variables defined in the language hosting SQL, in this case, EGL), is indicated by an initial colon character. For more information, see Host variables.
If you declared a record field to be read only, the generated SQL INSERT statement does not include that field, and the database management system sets the value of the related SQL table column to the default value that was specified when the column was defined.
The following example shows the add statement:
if (userRequest == "A") try add record1; onException(sqlEx SQLException) myErrorHandler(12); end end
try add employees; onException(sqlEx SQLException) sysLib.rollback(); end