mysql.exec

mysql.exec

mysql.exec

Function

Execute SQL that does not require a result set to be returned. Ordinary binding is executed once; binds batch configuration will be executed by batch/workers.

Syntax

Parameters

No parameters.

Return value

TypeDescription
ObjectReturns the SQL execution statistics object.

Execution result field

FieldTypeMust existDescription
totalIntYesThe number of bound rows processed in this execution. When ordinary bind() is executed, it is 1; when batch binds() is executed, it is the number of bound array rows; when there is no bound row, it is 0.
rows_affectedIntYesThe number of affected rows reported by the database. When batch execution is performed, the value is accumulated for each batch.
last_insert_idIntYesThe last insert ID reported by the database. When executing in batches, the maximum value returned in each batch is taken.
batch_countIntYesThe actual number of batches split executed. This is usually 1 for normal execution; 0 without a bound line.
batch_sizeIntYesThe batch size for the current query builder configuration. Default value used when batch() is not called.
workersIntYesThe number of concurrent workers configured and normalized by the current query builder.

Example

Notes

  • Normal bind() performs default reuse of the MySQL global connection pool grouped by DSN.
  • binds() Batch execution still creates a temporary connection pool according to this workers() to avoid the global pool changing the batch concurrency boundary.
  • Simple INSERT ... VALUES (?, ?) are automatically merged into multi-value inserts.
  • UPDATE and DELETE will not automatically splice SQL, but will be executed one by one in batches.
  • Single call subject to BT_MYSQL_QUERY_TIMEOUT_MS limit.