尝试使用 sqljocky 查询 mysql 数据库。此查询在 phpmyadmin 中运行良好,并返回 5 行包含良好数据的结果。在 Dart 中我遇到了异常:
Class '_ResultsImpl' has no instance method 'forEach'.
我在查询回调中设置了断点。结果对象公共(public)字段为空:
Ping 功能正常,已建立与基站的连接。
即使我查询简单的“显示表”查询,它也会返回没有数据的空结果实例。
查询代码如下:
var pool = new ConnectionPool(
host: '127.0.0.1', port: 8889,
user: 'root', password: 'root',
db: 'lulzvideo', max: 5);
pool.query('select id, title from users')
.then((results) {
results.forEach((row) {
print('Name: ${row[0]}, email: ${row[1]}');
});
});
最佳答案
result.listen((row) {
// Import into object
object.Import(row);
关于mysql - sqljocky 查询 - 未找到方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26385945/