f2s_max_cursors¶

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

set_attribute f2s_max_cursors of {DriverID} {server} to {variable}
get_attribute f2s_max_cursors of {DriverID} {server} to {variable}

Parameter

Description

DriverID

The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverID.

server

String, the name of the database server (optional) If this is not defined, the current active server will be used

variable

Integer, the number of maximum cursors

Description

Getting this attribute returns the maximum number of cursors the driver will use. Setting this attribute sets the maximum number of cursors the driver will use.

The driver will recycle the least used cursors if the limit is hit. The trade off is between increased resources on the server and re-preparing of cursors.

How to Use

Only change this setting if you are having preformance issues and the server is indicating you are using up too many cursors or too much memory. For a program that keeps 40+ files open at the same time, 255 is a good number for this attribute. For programs that open less than 40 files at the same time, any number between 100-255 should be enough.

Get the attribute f2s_cursor_current_count to get the number of currently open cursors. If this number is hitting the limit, it is worth increasing the number as long as the server has enough resources.

Examples

get_attribute

string sCurrentServer
integer iNumCursors

get f2s_server of _f2s_Active_DriverId to sCurrentServer
Get_Attribute f2s_max_cursors of _f2s_ActiveDriverId (f2s_ConstPointer(sCurrentServer)) to iMaxCursors
get_attribute f2s_cursor_current_count of _f2s_ActiveDriverId (f2s_ConstPointer(sCurrentServer)) to iNumCursors

Showln (SFormat("The current # of open cursors on %1 is %2.", sCurrentServer, iNumCursors))

set_attribute

string sCurrentServer

get f2s_server of _f2s_Active_DriverId to sCurrentServer

//this will set the maximum number of cursors to 200
set_attribute f2s_max_cursors of _f2s_ActiveDriverId (f2s_ConstPoint(sCurrentServer)) to 200

Related Attributes

f2s_cursor_current_count

Replaces: Commands SET_MAX_OPEN_CURSORS and GET_MAX_OPEN_CURSORS