Release 10.1A: OpenEdge Development:
Progress 4GL Handbook

> ## SET-BUFFERS method

> This method takes a buffer handle or a comma-separated list of buffer handles and sets the query’s buffer list to those buffers. It returns true if the operation succeeded and false otherwise.

> You can pass a buffer reference in one of several ways:

> - Using the `BUFFER` `buffer-name`:`HANDLE` syntax, which provides a handle for a static buffer on a known table.

> - Using a handle variable or field that you associate with a static buffer in a separate statement, such as `hBuffer = BUFFER` `buffer-name`:`HANDLE`.

> - Using the handle for a dynamic buffer, where you name the table only at run time. You’ll learn about how to do this in the "Extending the test window to use a buffer handle" section.

> For example, this sequence of statements creates a query and sets its buffer list to the Order and Customer buffers:

>     DEFINE VARIABLE hQuery AS HANDLE      NO-UNDO.
>     CREATE QUERY hQuery.
>     hQuery:SET-BUFFERS(BUFFER Order:HANDLE, BUFFER Customer:HANDLE).

> This is the equivalent of defining a static query for those buffers, as you could do with this statement:

>     DEFINE QUERY OrderCust FOR Order, Customer.

> You could then assign a handle to the static query in the same way, for example:

>     DEFINE VARIABLE hQuery AS HANDLE      NO-UNDO.
>     DEFINE QUERY OrderCust FOR Order, Customer.
>     hQuery = QUERY OrderCust:HANDLE.

> This raises the basic question of when to use static and when to use dynamic queries. Typically, unless your procedure is of such general use that you do not know the tables or buffers it will use until run time, you can define a static query and then use its handle to modify it as needed at run time. This is the case if, for example, you need to modify the `WHERE` clause or sort order of the query in a variety of ways at run time. If you start with a static query, you can use any combination of the static statements you’re familiar with to manipulate it, such as `GET FIRST`, `OPEN QUERY`, and so forth, or their dynamic equivalents, which are introduced in the following section. If you start with a dynamic query, you can use only dynamic methods to manipulate it.

> The one aspect of a static query you cannot modify at run time is its buffer list, so the `SET-BUFFERS` method applies only to dynamic queries.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095