Tables and buffers
- Last Updated: January 21, 2021
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Tables
A database table is a collection of logically related data treated as a unit. Tables contain rows and columns. All rows in a table comprise the same set of columns (fields). Tables often have indexes.
The OpenEdge database follows the relational model which organizes data into tables. Relationships between tables are defined by the data, that is, matching values in a field common to both tables. See Elements of a relational database for more detail.
In ABL, you use database access statements such as FIND statements, FOR EACH blocks, REPEAT FOR blocks, or DO
FOR blocks to access the records in a table. If a database table name is
specified in any of these statements, a record buffer for the table is automatically
created and is populated with the current record’s data.
When you retrieve a record from the database the AVM keeps track of the current record position using an index cursor—a pointer to the record.
Buffers
Whenever you reference database tables using a database access statement, Record buffers for the table are created automatically for your convenience. The record buffer is a temporary storage area in memory where the AVM manages records as they pass between the database and the statements in your code. This default record buffer has the same name as the database table. This lets you think in terms of accessing database records directly because the name of the buffer is the name of the table the record comes from.
You can create additional buffers for a table when you need to have two or more different records from the same table available to your code at the same time. For example, when looking for duplicate records, you can read a record into the default buffer and then use another buffer to go through the rest of the records for the table. If one matches then you know you have a duplicate.