Skip to main content
Roberty Studio
RPAMySQL

MySQL - Query

MySQL - Query

Runs a SQL statement on a MySQL database. It supports SELECT, INSERT, UPDATE, DELETE and other standard SQL statements. The results can be iterated with MySQL: For each result or read directly from the action returns.


Options​

Connection ID​

Reference to the MySQL: Connection action that will be used to run the query.

Query to be executed​

SQL statement to run, for example SELECT * FROM usuarios WHERE ativo = 1.

Advanced options​

Query timeout​

Maximum time, in seconds, this query may run. When empty, the Default query timeout set on the MySQL: Connection applies. A value of 0 means no limit. When the limit is reached, the action fails; the connection's Time limits section describes what happens to the query and the connection. Optional field.

Returns​

Javascript code​

js
actions["action-id"].resultsCount // number of records returned (Number)
actions["action-id"].query // query that was executed (Text)
actions["action-id"].results // query results (List)
actions["action-id"].insertedId // id of the inserted record, when applicable (Number)
actions["action-id"].affectedRows // number of affected rows (Number)
actions["action-id"].changedRows // number of changed rows (Number)

Field selection​

  • resultsCount — number of records returned by the query (Number)
  • query — query that was executed (Text)
  • results — query results (List)
  • insertedId — id of the inserted record, when applicable (Number)
  • affectedRows — number of affected rows (Number)
  • changedRows — number of changed rows (Number)

Rules and Conditions​

  • The Connection ID and Query fields are required.
  • insertedId, affectedRows and changedRows are relevant for INSERT, UPDATE or DELETE statements.
  • results and resultsCount are relevant for SELECT statements.
  • In Version 2.0, the Query timeout field is optional and its value is in seconds; 0 means no limit.
  • In Version 2.0, when Query timeout is empty, the connection's default query timeout applies.
  • In Version 1.0, the Timeout field is in seconds and its default value is 120.