mozIStorageStatementParams 编辑

This interface has no defined properties, but has properties based on the named parameters found in the SQL from the statement it was accessed off of.  For example, say you create a statement like so:

var statement = dbConn.createStatement("SELECT * FROM table_name WHERE id = :item_id");

This object would have one property, item_id, that you can use to bind a value to that named parameter like so:

statement.params.item_id = 2;

For more details on why you should bind parameters as opposed to hard-coding them into your statement, please see the overview document about binding parameters.

Enumeration of properties

You can also enumerate all the properties on this object with a for..in enumeration:

// valuesToBind is an object that contains key-value pairs
// to bind to the statement before executing it.
for (let param in statement.params)
  statement.params[param] = valuesToBind[param];

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:69 次

字数:1748

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文