mysql.sql
mysql.sql
Function
Returns the debug text of the current SQL.
Syntax
mysql(dsn).query(sql).sql(render_binds)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| render_binds | Bool | No | true | Whether to render bind parameters into SQL text. |
Return value
| Type | Description |
|---|---|
| String | Returns the SQL preview string. |
Example
db = mysql('mysql://user:pass@127.0.0.1/test') result = db.query('select * from user where id=?').bind(1).sql() // Output: select * from user where id=1 print result
Notes
- sql(false) returns raw SQL.
- Question marks in SQL string literals are not replaced.