Progress
Language Reference


CREATE BUFFER Statement

Interfaces
OS
SpeedScript
All
All
Yes

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 dynamc 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 the Progress Programming Handbook .

SEE ALSO

CREATE QUERY Statement, DEFINE BUFFER Statement


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