Tuesday, June 29, 2010

ADS 10 Tip #22 – New TAdsConnection Properties and Methods

Version 10 of the TAdsConnection component includes two new properties; ApplicationID and SQLTimeout and two new methods; CreateFromHandle and GetApplicationID.

The ApplicationID sets the application id to the specified string value. This information can be seen in the Management Utility in Advantage Data Architect (ARC). It is also returned with the sp_mgGetConnectedUsers system procedure. If the property is not set then the application id will be the name of the executable file.

The SQLTimeout property is the amount of time in seconds an SQL query should run before being canceled. This setting applies to all TAdsQuery components that are associated with the connection. Any query that exceeds the SQL Timeout value will be canceled and return a 7209 error.

The CreateFromHandle method creates a new connection to Advantage using the same properties as the connection associated with the handle. This is different than the CreateWithHandle which is used primarily for triggers.

The GetApplicationID method retrieves the application id for the current connection from the server. This is the value specified in the ApplicationID property or set using the sp_SetApplicationID. The application id can also be retrieved using the sp_GetApplicationID system procedure.

No comments: