This page describes how to execute SQL statements in RadRails.
Contents |
Introduction
RadRails provides you with two ways to execute SQL statements. You can use the Data Perspective and write statements in the Query View, or you can execute SQL statements in files with a .sql file extension from the Rails Navigator View in the RadRails perspective. The instructions below explain how to execute SQL statements using either method.
Instructions
Executing SQL statements from the Data Perspective
After you have set up your database (see Browsing a database in RadRails), you can execute SQL statements against your database in the Data Perspective.
To execute SQL statements from the Data Perspective:
- In the upper right corner of your workbench, click the button to switch to the Data Perspective.
- In the text box in the Query View, type your SQL statement (e.g. a SELECT statement).
- Click the Execute button.
RadRails executes your SQL statement and displays the results in the Result View.
Executing SQL statements from the Rails Navigator View
To execute SQL statements form the Rails Navigator View:
- If you are not in the Rails Perspective, click the button in the upper right corner of your workbench to switch.
- In the Rails Navigator View, expand the folder containing your Rails project.
- Navigate to and right-click the .sql file that you want to execute, then select Execute SQL and a database from the context menu.
RadRails executes the entire contents of the .sql file and displays the success or failure of the action, including corresponding error messages, if any.