CallDBFunction

The CommitTransaction function is a local transactions function that is used in SQL operations.

You can use CallDBFunction with SQL database data types. You cannot use this function with internal, LDAP, or Mediator data types.

To call the function, call CallDBFunction and pass the name of a data type, a filter string, and the function expression as input parameters. The data type identifies the underlying SQL database where the function is to be run. The function expression is the function call that is to be run by the database. CallDBFunction returns the value that results from the function.

Using CallDBFunction is equivalent to running the following SQL statement against the database:

SELECT function FROM table WHERE filter
		

where function is the specified function expression, table is the data type name, and filter is the filter string.

Syntax

CallDBFunction has the following syntax:

Integer | Float | String | Boolean = CallDBFunction(DataType, Filter, Metric)

Parameters

The CallDBFunction function has the following parameters.

Table 1. CallDBFunction function parameters

Parameter

Type

Description

DataType

String

Name of a data type associated with the underlying SQL database.

Filter

String

Filter string that specifies which data items in the data type to run the function against. Not required for all types of database functions. To run the function without consideration for specific rows of data in the associated database table, enter a filter string such as 0=0 that always evaluates to true.

Metric

String

Database function expression.

Return value

CallDBFunction returns the value that resulted from the database function.

Examples

The following example shows how to call a database function named NOW() and return the results of the function for use in a policy.

// Call CallDBFunction and pass the name of a data type, a filter
// string and the function expression
					
DataType = "Server";
Filter = "0 = 0";
Metric = "NOW()";
					
DBTime = CallDBFunction(DataType, Filter, Metric);