Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By default, SQL statements executed with conn:execute{} are only run when the component is executed outside the Translator’s editing mode. To override this behavior and execute the statement during script editing , use the you can use:

  • The Live Flag to set live=true. However, use this cautiously – each script change or use of sample data will trigger the SQL execution, potentially leading to multiple unintended INSERTs or UPDATEs.

  • The component.live() API to control code execution in test and live.

Expand
titleGreater Control over Handling Transactions

Unlike conn:merge{}, which automatically handles transactions, conn:execute{} does not manage transactions automatically. This gives you greater flexibility for more complex operations, allowing you to manually start, commit, or rollback transactions, which is useful when grouping multiple SQL operations that should succeed or fail together.

Code Block
languagelua
conn:execute{sql='BEGIN TRANSACTION'}
conn:execute{sql=sqlInsert}
conn:execute{sql='COMMIT'}

...