我真的整天都在努力让 Firefox 服从我的意志......
我想 :
int c = SELECT COUNT(*) FROM ...
我试过executeAsync({...});
了,但我认为这是错误的范例,因为我想要立即得到结果。(并mozIStoragePendingStatement
导致错误)
var count = 0;
var conn = Services.storage.openDatabase(dbfile); // Will also create the file if it does not exist
let statement = conn.createStatement("SELECT COUNT(*) FROM edges LIMIT 42;");
console.log("columns: " + statement.columnCount); // prints "1";
console.log("col name:" + statement.getColumnName(0)); // is "COUNT(*)"
while (statement.executeStep())
count = statement.row.getResultByIndex(0); // "illegal value"
count = statement.row.getString(0); // "illegal value", too
count = statement.row.COUNT(*); // hahaha. still not working
count = statement.row[0]; // hahaha. "undefinded"
count = statement.row[1]; // hahaha. "undefinded"
}
statement.reset();
它基本上可以工作,但我没有得到价值。所有语句(循环内的语句)有什么问题。
感谢您的任何提示...