# mysql.sql ## 功能 返回当前 SQL 的调试文本。 ## 语法 ```bt mysql(dsn).query(sql).sql(render_binds) ``` ## 参数 | 参数 | 类型 | 必填 | 默认值 | 说明 | | ------ | ------ | ------ | ------ | ------ | | render_binds | Bool | 否 | true | 是否把绑定参数渲染到 SQL 文本中。 | ## 返回值 | 类型 | 说明 | | ------ | ------ | | String | 返回 SQL 预览字符串。 | ## 示例 ```bt 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 ``` ## 注意事项 - sql(false) 返回原始 SQL。 - SQL 字符串字面量中的问号不会被替换。