# mysql.query ## 功能 设置当前 MySQL 对象的 SQL 文本。 ## 语法 ```bt mysql(dsn).query(sql) ``` ## 参数 | 参数 | 类型 | 必填 | 默认值 | 说明 | | ------ | ------ | ------ | ------ | ------ | | sql | Any | 否 | '' | SQL 文本,调用时会先转为字符串。 | ## 返回值 | 类型 | 说明 | | ------ | ------ | | Mysql | 返回新的 MySQL 查询构建器。 | ## 示例 ```bt db = mysql('mysql://user:pass@127.0.0.1/test') result = db.query('select * from user where id=?').sql(false) // 输出:select * from user where id=? print result ``` ## 注意事项 - query 不连接数据库,只保存 SQL。