TuxGetBuffer Function

Action

Allocates a typed buffer. Depending on the buffer type, a subtype has to be specified. The TUXEDO System provides a variety of typed buffers, and applications are free to add their own buffer types. Silk Performer's buffer handling and manipulating functions automatically detect any of the buffer types listed below and handles them appropriately. Custom buffer types are handled like binary buffers (CARRAY).

STRING, FML, FML32, VIEW, VIEW32, CARRAY

Include file

TUXEDO.bdh

Syntax

TuxGetBuffer( inout hBuffer  : number,
              in    sType    : string,
              in    sSubType : string optional,
              in    nSize    : number optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hBuffer Variable receiving the handle to the typed buffer
sType

Buffer type. Predefined typed buffers are:

  • "STRING". String buffer.

  • "FML". Fielded buffer. Buffer containing any number of arrays of various data types.

  • "FML32". 32-bit fielded buffer.

  • "VIEW". View. Buffer containing any number of fields, each of which may hold a different data type.

  • "CARRAY". Binary data buffer.

sSubType Buffer subtype identifying a set of characteristics (optional).
nSize

Buffer size (optional). Default buffer size is 1024 bytes for fielded buffers, and 512 bytes for any other buffer types.

注: The default buffer size values also represent the minimum size, allocating smaller buffers is impossible.

Example

const
  ID_ELEM1 := 16;
  ID_ELEM2 := 32;

dcltrans
  transaction TMain
  var
    hBuffer, olen: number;
  begin
    Tux_tpbegin(30, 0);

    // allocate buffer
    TuxGetBuffer(hBuffer, "FML", NULL, 1024);

    // store two integer values in buffer
    TuxSetInt(hBuffer, ID_ELEM1, 640);
    TuxSetInt(hBuffer, ID_ELEM2, 480);

    // create database table of the appropriate size
    Tux_tpcall("CREATETABLE", hBuffer, 0, hBuffer, olen, TPNOFLAGS);
    Tux_tpcommit(0);
  end TMain;

Sample scripts

bankappn.bdf