PG_CONNECT action


Function
The function establishes the connection to a table.
Declaration
 PG_CONNECT dbObjIdent, accessIdent_Int, handleIdent_Int, pgSizeIdent_Int, whereIdent_Str, orderByIdent_Str, rowsCountIdent_Int, retCodeIdent_Int [TRANS transHandle_Int] [MODE mode_Int] [ORAHINT hintIdent_Str]
Parameters
dbObjIdentin Reference to an object of the Database table type.
accessIdent_IntinValue identifier: required access to the table (_DB_READ, _DB_MODIFY).
handleIdent_IntoutIdentifier for an unique number (handle) of the connection to the table.
pgSizeIdent_IntinIdentifier to determine maximal page size.
whereIdent_StrinIdentifier of the Text type. Condition to select from the table.
orderByIdent_Str

in

Identifier of the Text type. Sorting in the final selection.
rowsCountIdent_IntoutIdentifier of the Int type. The number of rows in the selection.
retCodeIdent_IntoutReturn code identifier.
transHandle_IntinIdentifier for a unique number (handle) for the connection to the database.
mode_IntinIdentifier of Int type - 0/1.
hintIdent_StrinExpression of the String type that defines Oracle SQL hint. It is used as an instruction for the performance optimizer of SQL command. The value is used without the opening and terminating characters /*+ <orahint> */.
The example is mentioned here.

Note: In this situation, Oracle SQL hint is used for ESL action PG_READ, because in ESL action SQL_CONNECT SELECT expression is compounded for next called ESL action PG_READ.
Return code
The value of the parameter transHandle_Int. See the table of error codes. It is possible to get extended error information.
Description
Page access is initialized by the action PG_CONNECT. It performs the table opening, during which it is possible to specify conditions for the final selection (reduction of visible rows in the table). Selection is limited by the condition with the value whereIdent_Str. This text (a value of the identifier whereIdent_Str) is used in the clause WHERE in the SQL command.

The action allows to define a way to sort rows in the final selection by means of a value of the identifier orderByIdent_Str. The value of the identifier is used in the clause ORDER BY in the SQL command.

The required page size is defined by a value of the identifier pgSizeIdent_Int. This page size is to be used during reading from the table (whole page is read at the same time). A larger page may cause the big memory block allocation, and thereby to cause the malfunction of the operating system.
Maximum number of returned rows is limited by a Database configuration parameter Maximum returned rows.

After the successful opening of a table (retCodeIdent_Int = _ERR_NO_ERROR), the identifier rowsCountIdent_Int contains the number of rows in the final selection and the identifier handleIdent_Int contains the number of the connection (handle).

If the parameter mode_Int = 1, the pages can be read only sequentially from 1 to maximal page. Moving back is disabled. In this case, DbManager will use optimal way of reading from database. If parameter is not usde, the value is = 0.

Having finished a work with a table, it is necessary to close it using the action PG_DISCONNECT.

Related pages:

Napíšte komentár