Skip to content

DF_DRIVER_MAX_ACTIVE_STATEMENTS

The maximum number of concurrently active statements allowed per connection.

Level

Driver

Supported by

ODBC only, revision 5 and higher

Type

Integer, temporary

Access

Read/Write

Values

0..

Syntax

Use cli.pkg
Get_Attribute DF_DRIVER_MAX_ACTIVE_STATEMENTS of {driverNumber} to {IntegerVariable}
Set_Attribute DF_DRIVER_MAX_ACTIVE_STATEMENTS of {driverNumber} to {IntegerVariable}

Driver Configuration Keyword

Max_Active_Statements

Remarks

The maximum number of concurrently active statements allowed per connection. A value of 0 (zero) means there is no limit.

This attribute can be queried through ODBC, but some drivers may not return a reliable value. The value of the attribute is used by the driver to determine the size of the statement pool. The driver keeps track of the statements that are used per connection in a 'Most Recently Used' sorted list. If the maximum number of statements is in use, the least recently used statement will be freed whenever an additional statement is required.

Some ODBC drivers return a value of 1 for this attribute, which causes the driver to free and re-allocate statements frequently. For some drivers, the value is accurate (e.g., MS Jet Engine ODBC Driver), but for others, it is not (e.g., Oracle ODBC Driver).

This default value is copied to the database level when logging in to the database. The actual value in use for an active connection is that on the database level. This attribute merely reflects a default.

Sample Code

The following sample code shows the current setting for a given driver:

Function DriverIndex String sDriver Returns Integer
    String sCurrentDriver
    Integer iNumberOfDrivers iDriver iCount
    Move 0 to iDriver
    Get_Attribute DF_NUMBER_DRIVERS to iNumberOfDrivers
    For iCount From 1 To iNumberOfDrivers
        Get_Attribute DF_DRIVER_NAME of iCount To sCurrentDriver
        If (Uppercase(sCurrentDriver) = Uppercase(sDriver)) Begin
            Move iCount to iDriver
        End
    Loop
    Function_Return iDriver
End_Function

Procedure ShowDriverAttribute
    Integer iAttribValue iDriver
    Get DriverIndex "MSSQLDRV" to iDriver
    Get_Attribute DF_DATABASE_MAX_ACTIVE_STATEMENTS of iDriver to iAttribValue
    Showln "Max active statements per connection: " ;
        (If(iAttribValue = 0, " unlimited", String(iAttribValue)))
End_Procedure