Databases & SQL

Parameterized SQL and transactions

Run the right scope, separate values from SQL and understand commit, rollback and grid edits.

In this guideChoose what to executeFill in query parametersWhen the grid writes to the database

Choose what to execute#

Ctrl+Enter runs a selection or the statement at the cursor; Ctrl+Shift+Enter runs the worksheet. Statements run in order and stop at the first error. SQL Block sends a complete procedural body without splitting on semicolons.

Database: schema, SQL worksheet and results in one workspace.Code Weaver · Windows beta

Fill in query parameters#

Use parameter fields to provide values without concatenating them into the SQL text. SQL strings and comments are not interpreted as parameter fields. Dialog values and credentials are not saved in history, while literals written into SQL remain in the query text.

  1. Write named parameters such as :id in the SQL worksheet.
  2. Run and complete the dialog with text, number, boolean or NULL.
  3. Check the connection and result before further operations.
SQL · Example
SELECT id, name
FROM products
WHERE id = :id;

When the grid writes to the database#

The editable grid requires a base table with a primary key. Changes are prepared, shown as SQL and confirmed; original values and keys are checked again before writing. If a row changed on the server, the operation is rejected instead of blindly overwriting it.

An explicit transaction retains control over COMMIT; grid changes use a savepoint where applicable. Oracle preserves the worksheet transaction; MySQL/MariaDB requires InnoDB tables. Views, non-comparable LOBs or truncated cells may require manual SQL.

Open original image ↗