Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

mozIStorageStatementParams

このインターフェースは定義済みのプロパティを1つも持ちませんが、与えられたステートメントのSQL内で見つかった名前付きパラメータに基づいたプロパティを持ちます。例えば、次のようにステートメントを構築します:

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

このオブジェクトは item_id という1つのプロパティを持つことになり、次のようにして値を名前付きパラメータに束縛することができる:

statement.params.item_id = 2;

なぜ値をハードコーディングせずに、パラメータへの束縛を行うべきかについてのより詳しい情報は、overview document about binding parametersをご覧ください。

プロパティの列挙

このオブジェクトの全てのプロパティは for..in により列挙することが出来ます:

// valuesToBind は ステートメントの実行前にバインドすべき
// key-value ペアを持つオブジェクト
for (let param in statement.params)
  statement.params[param] = valuesToBind[param];

参照

ドキュメントのタグと貢献者

 このページの貢献者: teoli, yiwasaki
 最終更新者: teoli,