返回当前 SQL 的调试文本。
mysql(dsn).query(sql).sql(render_binds)
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| render_binds | Bool | 否 | true | 是否把绑定参数渲染到 SQL 文本中。 |
| 类型 | 说明 |
|---|---|
| String | 返回 SQL 预览字符串。 |
db = mysql('mysql://user:pass@127.0.0.1/test') result = db.query('select * from user where id=?').bind(1).sql() // 输出:select * from user where id=1 print result