RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TSQLConnection.ActiveStatements Property

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

Pascal
property ActiveStatements: LongWord;
C++
__property LongWord ActiveStatements;

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). 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!