DF_FILE_MAX_ROWS_FETCHED

The maximum size of the result set.

Level

Table

Supported by

The DataFlex SQL Drivers (SQL Server, DB2 and ODBC)

Type

Numeric, permanent

Access

Read / Write

Values

0 ..

Syntax

Use cli.pkg

 

Get_Attribute DF_FILE_MAX_ROWS_FETCHED of {tableNumber} to {IntegerVariable}

Set_Attribute DF_FILE_MAX_ROWS_FETCHED of {tableNumber} to {IntegerVariable}

Remarks

The number of records, result sets of find operations on this table should be limited to. The default value is 0 (zero), which means that result sets will not be limited. All other positive integer values will limit the result set to that value.

Database servers use the SQL language to manipulate data. SQL is a set oriented language. Every statement works on set(s) and results in a set. A DataFlex find command will be translated into its SQL counterpart, which is sent to the database server. The SQL statement will result in a set of rows that satisfy the condition of the statement for the find command. This result set can have no, one or more rows. In some cases, a result set will contain all rows of a table.

 

The default setting is used when creating tables, the value is included in each [table.]INT file.

So, the value of the DEFAULT_MAX_ROWS keyword set in the [database.]INT will be used as the initial value for the keyword MAX_ROWS_FETCHED in the [table.]INT when each table is created. The value of the MAX_ROWS_FETCH keyword in the INT file will be used in SELECTs that are generated for FINDs performed against the tables.

 

This attribute can be set both inside and outside a Structure_Start ... Structure_End operation. The value of this attribute is stored in the intermediate file using the Max_Rows_Fetched keyword.

Procedure ShowRecord Handle hTable

    Integer iNumColumns

    Integer iColumn

    String sValue

 

    Get_Attribute DF_FILE_NUMBER_FIELDS Of hTable To iNumColumns

    For iColumn From 1 To iNumColumns

        Get_Field_value hTable iColumn To sValue

        If (iColumn > 1) ;

            Show ", "

        Show sValue

    Loop

    Showln

End_Procedure // ShowRecord

 

Procedure ChangeMaxRowsFetchedTemporary Handle hTable Integer iIndex Integer iTempSetting

    Integer iOldSetting

    Boolean bFound

    Integer iSetSize

 

    Get_Attribute DF_FILE_MAX_ROWS_FETCHED Of hTable To iOldSetting

    Set_Attribute DF_FILE_MAX_ROWS_FETCHED Of hTable To iTempSetting

 

    Move True To bFound

    Clear hTable

    While (bFound)

        Showln

        Showln "*** New Set ***"

        Showln

        Move 0 To iSetSize

        Repeat

            vFind hTable iIndex Gt

            Move (Found) to bFound

            If (bFound) Increment iSetSize

            If (bFound And iSetSize <= iTempSetting) ;

                Send ShowRecord hTable

        Until (Not(bFound) Or iSetSize = iTempSetting)

    End

    Set_Attribute DF_FILE_MAX_ROWS_FETCHED Of hTable To iOldSetting

End_Procedure // ChangeMaxRowsFetchedTemporary

The sample procedure above temporarily changes the max rows fetched setting of a table to output all its records.

Procedure ChangeMaxRowsFetchedPermanent Handle hTable Integer iNewSetting

    Open hTable Mode DF_EXCLUSIVE

    Structure_Start hTable

    Set_Attribute DF_FILE_MAX_ROWS_FETCHED Of hTable To iNewSetting

    Structure_End hTable

End_Procedure // ChangeMaxRowsFetchedPermanent

The sample procedure above changed the max rows fetched setting of a table permanently.