Creating a buffer with the same name as the database table

I skipped this code in several places:

DEFINE BUFFER Customer FOR Customer. 

I have two questions:

  • What is the purpose of this? Why is it useful to create a buffer with the same name as the table?

  • When writing code to access this table / buffer, how does Progress know whether it is necessary to directly access the database or through the buffer?

+5
source share
1 answer

1: This is usually done to control the amount of buffers.

If you have, for example, a procedure with several internal procedures that all access the same table, then the default buffer for this table will be bound to the top-level block of procedures. For instance -

procedure p1:
    find first customer no-lock.
end.

procedure p2:
    find last customer no-lock.
end.

. , . , .

Obv , , , , .

2: . , ,

find first <buffername>.

buffername, . , .

+8

All Articles