# mysql.one ## 功能 执行查询并返回单行结果。 ## 语法 ```bt mysql(dsn).query(sql).one() ``` ## 参数 无参数。 ## 返回值 | 类型 | 说明 | | ------ | ------ | | Object/Empty | 查询到行时返回对象;无结果返回 Empty。 | ## 示例 ```bt db = mysql('mysql://user:pass@127.0.0.1/test') row = db.query('select id, name from user where id=?').bind(1).one() // 输出:Object echo(type(row)) ``` ## 注意事项 - 执行前必须先设置 SQL。 - 不支持 binds、batch、workers 批量配置。 - 默认复用按 DSN 分组的 MySQL 全局连接池;可通过 `BT.stats().mysql` 查看池状态。 - 无查询结果时返回 `empty`,不会用 `null` 表示未找到。 - 单次调用受 `BT_MYSQL_QUERY_TIMEOUT_MS` 限制。