Progress
Programming
Handbook
The Buffer Object
The buffer object corresponds to an underlying Progress buffer, which can be static or dynamic. A static buffer is one you define at compile time by using the DEFINE BUFFER statement, or by implicitly referencing a table in a 4GL construct such as
customer.cust-num
. A dynamic buffer is one you create at run time using the BUFFER option of the CREATE Widget statement.The buffer object, like the query object and other Progress objects, is represented by a variable of type HANDLE. You can use a HANDLE variable to acquire a new buffer object as the following code fragment demonstrates:
You can also use a HANDLE variable to acquire a buffer object for an existing statically-created buffer, as the following code fragment demonstrates:
With the buffer object you can:
- Create a dynamic buffer for a dynamic query
- Manipulate an existing static buffer
- Write generic 4GL code without knowing at compile time the precise names of the databases, buffers, and fields
- Determine schema properties, such as the names and values of individual buffer-fields, by using dynamic buffer-fields and their methods
The following program example demonstrates the use of buffer objects in a dynamic query. Note the use of the dynamic predicate (WHERE and BY clauses) in the query:
When the program pauses, press the GO key (usually F2) to continue.
Notes on Dynamic Buffers
- Since the dynamic buffer lets you manipulate database records at run time without the benefit of the compiler’s security checking, Progress ensures that when you use a dynamic buffer, you have the necessary read, write, create, and delete permissions. In addition, if the table corresponding to a dynamic buffer specifies delete validation, Progress does not let you delete instances of the table dynamically.
- When you have finished using the buffer object, it is important to apply the BUFFER–RELEASE method, since Progress does not automatically release the object until the underlying buffer object is deleted.
- A dynamic buffer has the same scope as the widget–pool in which it was created. This means that Progress automatically deletes a dynamic buffer object only when it deletes its widget–pool. To delete a dynamic buffer object manually, you must use the DELETE OBJECT statement.
- If you place the phrase BUFFER name anywhere in a procedure file, where name represents the name of a table, not necessarily the name of a buffer you defined using the DEFINE statement, Progress scopes name as it would a free reference.
- For a list of the attributes and methods of the buffer object, see the Buffer Object Handle reference entry in the Progress Language Reference . For a complete description of the attributes and methods, see the “Attributes and Methods Reference” chapter of the same book.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |