Salesforce

ClientSQLExecute (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

ClientSQLExecute (Magic xpa 4.x)

Executes an SQL statement on a local database. This function lets you dynamically execute SQL statements without having a dedicated task.

Syntax:

ClientSQLExecute (database name, SQL statement, [variable], …)

Parameters:

database name – An Alpha string containing the database name

SQL statement – An Alpha string

variable – Variable reference. This is optional and an unlimited number of variables can be used. For example: ‘A‘VAR.

Returns:

Logical.

The function returns False if the SQL execution fails or if there is an error in executing the statement.

The function returns True if the execution succeeds. The SQL statement result is stored in the optional parameters.

For example:

  • An SQL statement that does not return a value: ClientSQLExecute(‘my db',drop table ABC’).

  • An SQL statement that returns a single value: ClientSQLExecute(‘my db',‘select count(*) from ABC’,'A'Var).

  • An SQL statement that returns multiple values (multiple columns): ClientSQLExecute(‘my db',‘select var1,var2 from ABC’,'A'Var,'B'Var).

Note:

If the SQL statement returns a value, the value will be stored in the variable's optional parameters that were defined.

The values set by the function are based on the SQL statement's returned value. For example, a ‘Select count(*)’ statement will return a Numeric value.

If there is an error in the syntax, the function is ignored.

If the result contains multiple rows, only the values from the first row are returned.

If additional parameters were provided (more than the result columns), the redundant variables will be cleared (updated with NULL or the default value, according to the variable).

This is a client-side function that is only available for Rich Client tasks. To use the server-side version of this function in Rich Client tasks, see SQLExecute.

Exceptions:

This function is not supported in Web Client tasks.

See also:

The Online and Rich Client Samples projects (program SQ17 and RSQ17)

Since version: 3.1

Reference
Attachment 
Attachment