mysql.all
mysql.all
Function
Execute a query and return multiple rows of results.
Syntax
mysql(dsn).query(sql).all()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| Array | Returns an array of row objects. |
Example
db = mysql('mysql://user:pass@127.0.0.1/test') rows = db.query('select id, name from user where status=?').bind(1).all() // Output: Array echo(type(rows))
Notes
- SQL must be set before execution.
- Batch configuration of binds, batch, and workers is not supported.
- The MySQL global connection pool grouped by DSN is reused by default; the pool status can be viewed through
BT.stats().mysql. - Single call subject to
BT_MYSQL_QUERY_TIMEOUT_MSlimit.