Advantage Developer Zone

 
 
 

Use SQL to Return System Management Information

Tuesday, September 14, 2004

With the release of Advantage 7.1, developers can retrieve management information with simple SQL statements, instead of using the more complex management API functions. For example, executing the following system procedure via SQL returns a cursor with a row for each record that is locked in the table:

EXECUTE PROCEDURE sp_mgGetAllLocks('\\serverA\folder\orders.adt');

A developer could then execute the procedure, sp_mgGetLockOwner, to return the username of an owner of a lock. These procedures are built into the server, work with both ADT and DBF files, and do not require an Advantage Data Dictionary.

The following Management System Procedures are available with 7.1 (see the Advantage help file for specific parameter information):

sp_mgGetActivityInfo

sp_mgGetAllIndexes

sp_mgGetAllLocks

sp_mgGetAllTables

sp_mgGetCommStats

sp_mgGetConfigInfo

sp_mgGetConfigMemory

sp_mgGetConnectedUsers

sp_mgGetIndexUsers

sp_mgGetInstallInfo

sp_mgGetLockOwner

sp_mgGetServerType

sp_mgGetTableIndexes

sp_mgGetTableUsers

sp_mgGetUsageInfo

sp_mgGetUserIndexes

sp_mgGetUserLocks

sp_mgGetUserTables

sp_mgGetWorkerThreadActivity

sp_mgKillUser

sp_mgResetCommStats

The example below from the Advantage Data Architect Native SQL Utility demonstrates the large amount of data available from the procedure sp_mgGetConfigInfo.