Release 10.1A: OpenEdge Development:
Progress 4GL Reference

> ## CREATE BUFFER statement

> Creates a dynamic buffer.

> #### Syntax

>     CREATE BUFFER handle FOR TABLE table-exp | table-handle-exp
>       [ BUFFER-NAME buffer-expression ]
>       [ IN WIDGET-POOL widget-pool-name ]

> ``handle``

> A variable of type HANDLE that represents the handle of the buffer object.

> `FOR TABLE `table-exp` | `table-handle-exp``

> A character expression that evaluates to a unique database table name or temp-table name or to the handle of a database table or a temp-table.

> Note: If the table name is ambiguous, you must qualify it with a database name.

> `BUFFER-NAME `buffer-expression``

> An expression of type CHARACTER that evaluates, at run time, to the name of the dynamic buffer you are creating. This option lets a dynamic query have multiple buffers for the same table.

> `IN WIDGET-POOL `widget-pool-name``

> An expression of type CHARACTER that evaluates, at run time, to the name of the widget pool that contains the dynamic buffer.

> Note: Widget pool names are not case-sensitive.

> Example

> The following example runs the query “for each customer” dynamically against the Sports database using a purely dynamic buffer with no compile time references at all:

> r-crtbuf.p
>     /* r-crtbuf.p */
>     /* requires a connection to the Sports database */

>     DEFINE VARIABLE i AS INTEGER.
>     DEFINE VARIABLE qh AS WIDGET-HANDLE.
>     DEFINE VARIABLE bh AS WIDGET-HANDLE.
>     DEFINE VARIABLE fh AS WIDGET-HANDLE EXTENT 10.

>     CREATE BUFFER bh FOR TABLE "customer".
>     CREATE QUERY qh.

>     qh:SET-BUFFERS(bh).
>     qh:QUERY-PREPARE("for each customer").
>     qh:QUERY-OPEN.
>     qh:GET-FIRST.

>     DISPLAY bh:NAME.

>     REPEAT i = 1 TO 10.
>       fh[i] = bh:BUFFER-FIELD(i).
>       DISPLAY fh[i]:NAME STRING(fh[i]:BUFFER-VALUE).
>     END.

>     DELETE WIDGET bh.

> #### Note

> For more information on dynamic buffers, see OpenEdge Development: Progress 4GL Handbook .

> #### See also

> CREATE QUERY statement, DEFINE BUFFER statement

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