Salesforce

Using Direct SQL Command (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

Using Direct SQL Command (Magic xpa 2.x)

Magic xpa lets you embed native SQL statements in your Magic xpa project with the SQL Command dialog box. If the SQL Command dialog box is used, the task’s Main Source is the SQL statement.

  1. From the Project menu, select Programs.

  2. Create a new line.

  3. Type demo for the program name.

  4. Zoom to the task tree.

  5. From the Task menu, select the SQL Command option (Ctrl+Q). The SQL Command dialog box appears.

Magic xpa executes the SQL command before it executes the Task Prefix logic unit. The task can use the returned data as an integral part of its data view.

Magic xpa does not attempt to analyze the command’s syntax and semantics. This gives the programmer flexibility, but requires that the programmer plan the programming carefully. Magic xpa does not protect the data from errors in the Direct SQL commands.

Direct SQL Behavior Considerations

Make sure to have a look at the Restrictions on Using Direct SQL topic.

Magic xpa’s Direct SQL feature is a tuning tool to improve performance. Use this feature selectively, and only when its use results in significant performance improvement. You should use this when you want to:

  • Calculate statistics on the database, such as how many records have a specific property, or the total sum of this month's salaries.

  • Make a vertical update to your data, such as to increase all salaries by 5 percent, delete all old records, and copy parts of one table to another table.

  • Utilize existing code that was developed and compiled using the SQL DBMS tools, such as stored procedures.

Related Topics

Reference
Attachment 
Attachment