Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » System procedures » Alphabetical list of system procedures

sa_user_defined_counter_add system procedure

Adjusts the value of a user-defined counter by a specified amount.

Syntax
sa_user_defined_counter_add( 
counter_name 
[, delta
[, apply_to_con
[, appy_to_db
[, apply_to_server ] ] ] ]
)
Parameters
  • counter_name

    Use this VARCHAR(128) parameter to specify the name of the user-defined counter whose value you want to change. Examples of user-defined counter names are UserDefinedCounterRate01 and UserDefinedCounterRaw01.

  • delta

    Use this BIGINT parameter to specify the amount that the user-defined counter is incremented or decremented by. The default is 1.

  • apply_to_con

    Use this INTEGER parameter to specify whether to adjust the counter value for the current connection. 0 means do not adjust the value, and 1 means adjust the value. The default is 1.

  • apply_to_db

    Use this INTEGER parameter to specify whether to adjust the counter value for the database. 0 means do not adjust the value, and 1 means adjust the value. The default is 1.

  • apply_to_server

    Use this INT parameter to specify whether to adjust the counter value for the database server. 0 means do not adjust the value, and 1 means adjust the value. The default is 1.

Returns

This function returns an INTEGER status code.

Remarks

This function returns 1 if delta is defined, 0 if delta is not defined, and an error code if an error occurs. Examples of errors include:

  • an invalid counter name
  • an invalid value for the apply_to_server, apply_to_db, or apply_to_con parameter.

Concurrent access to counters is applied atomically, so a counter value can be incremented from multiple, concurrent requests.

User-defined counters are implemented as 32-bit UNSIGNED INTEGER values.

Privileges

You must have EXECUTE privilege on the system procedure, as well as the SERVER OPERATOR system privilege.

Side effects

None

Example

The following statement increments the value of UserDefinedCounterRate01 by 2 for the current connection, database, and database server:

SELECT sa_user_defined_counter_add( 'UserDefinedCounterRate01', 2, 1, 1, 1 );