f2s_table_max_query_rows¶
Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers
Syntax
set_attribute f2s_table_max_query_rows of {FileNumber} to {variable}
get_attribute f2s_table_max_query_rows of {FileNumber} to {variable}
Parameter |
Description |
---|---|
FileNumber |
Number of the file (filename.File_Number) |
variable |
The maximum number of rows to be retrieved with a single qualifying find operation. This cannot be 0. |
Description
This attribute determines the maximum number of rows that will be returned from the database server in a set oriented search. In the .INT file for the table, this value cooresponds to the Keyword MAX_ROWS_TO_QUERY.
This attribute only has meaning if f2s_table_fetch_mode is set to 1 for the table.
Consider the following function:
Function CalculateTotalPurchases Returns Number
Number nTotalPurchase
Send Clear to oCustomer_DD
Send Find to oCustomer_DD GE Index.1
While (Found)
Move (nTotalPurchase+Customer.Purchases) to nTotalPurchase
Send Find to oCustomer_DD GT Index.1
Loop
Send Clear to oCustomer_DD
Function_Return nTotalPurchase
End_Function
If fs2_table_max_query_rows is 10, when
Send Find to oCustomer_DD GE Index.1
is called a single row of Customer Records will be returned (see f2s_table_fetch_mode, the mode GE matters). However, when
Send Find to oCustomer_DD GT Index.1
is called, up to 10 rows of data will be queried from the server. The requested value will be put into the buffer and the rest cached. The next time the find GT procedure is called, the cached value will be copied to the buffer (and so on) until the record requested is not in the cache. Only when the cache is exhausted will a call to the server be made to reset it.
Default Value: 10
Normally, this attribute should be left alone. Consider carefully before modifying.
When to use
When looping through sequential records, setting this to a value will speed up the operation because fewer calls to the database server will be made. However, the larger the number, the more network bandwidth will be used.
When not to use
When the rows begin requested are not sequential records, the rows cached will not be used. Therefore, it will be better to turn caching off (see f2s_table_fetch_mode) since every find request will require a call to the database server regarless of cacheing.
Caution: If some of the records are sequential (i.e. would be cached) turning caching off can have significant detrimental effects on performance.
Example
//request that the maximum number of rows to be retrived in a single find operation is 15
Open Orderhea
Set_Attribute f2s_table_max_query_rows of Orderhea.File_Number to 15
//get the maximum number of rows to be retrived in a single find operation
integer intVal
Get_Attribute f2s_table_max_query_rows of Orderhea.File_Number to intVal
Keyword in INT file
MAX_ROWS_TO_QUERY
Related Attributes
Replaces: DF_FILE_MAX_ROWS