提供具有多个参数的语句的“最佳”方法是什么?我想在 SQLite 数据库中插入一行。
适应https://developer.mozilla.org/en/Storage#Binding_Parameters我认为以下方法可行:
var conn = Services.storage.openDatabase(dbfile); // Will also create the file if it does not exist
let statement = conn.createStatement("INSERT INTO persons (name, email, city) VALUES (:name, :email, :city)");
statement.params.name = myName;
statement.params.email = myEmail;
statement.params.city = myCity;
但显然我什至无法创建语句本身:
组件返回失败代码:0x80004005 (NS_ERROR_FAILURE) [mozIStorageConnection.createStatement]
之后我想异步执行它......