Data.SqlExpr.TSQLConnection.ActiveStatements

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property ActiveStatements: LongWord read FActiveStatements;

C++

__property unsigned ActiveStatements = {read=FActiveStatements, nodefault};

Properties

Type Visibility Source Unit Parent
property public
Data.SqlExpr.pas
Data.SqlExpr.hpp
Data.SqlExpr TSQLConnection

Description

Indicates the number of statements currently active with the database server.

Read ActiveStatements to determine how many statements are currently executing using the database connection. While a dataset is prepared, it creates an active statement that lasts until the dataset is unprepared. When you set a dataset's Prepared property to true, the statement remains active until you change the Prepared property to false. When the Prepared property is false, the dataset implicitly prepares its statement when you open the dataset, and the statement remains active until you close the dataset. In addition, executing an SQL statement (for example, using the Execute method) creates an active statement temporarily, until the statement finishes executing.

Use ActiveStatements to check whether an application has reached the server-imposed limit on the number of active statements allowed to a connection (the MaxStmtsPerConn property). This is especially important if AutoClone is false, because if you exceed MaxStmtsPerConn when AutoClone is false, the SQL connection raises an exception. To avoid exceeding the server-imposed limit, do not open any datasets or execute SQL statements when ActiveStatements is the same as MaxStmtsPerConn (unless MaxStmtsPerConn is 0).

See Also