storage/public/mozIStorageAsyncStatement.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/storage/public/mozIStorageAsyncStatement.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: sw=2 ts=2 sts=2 expandtab
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "mozIStorageBaseStatement.idl"
    1.11 +
    1.12 +/**
    1.13 + * An asynchronous SQL statement.  This differs from mozIStorageStatement by
    1.14 + * only being usable for asynchronous execution.  (mozIStorageStatement can
    1.15 + * be used for both synchronous and asynchronous purposes.)  This specialization
    1.16 + * for asynchronous operation allows us to avoid needing to acquire
    1.17 + * synchronization primitives also used by the asynchronous execution thread.
    1.18 + * In contrast, mozIStorageStatement may need to acquire the primitives and
    1.19 + * consequently can cause the main thread to lock for extended intervals while
    1.20 + * the asynchronous thread performs some long-running operation.
    1.21 + */
    1.22 +[scriptable, uuid(52e49370-3b2e-4a27-a3fc-79e20ad4056b)]
    1.23 +interface mozIStorageAsyncStatement : mozIStorageBaseStatement {
    1.24 +  /*
    1.25 +   * 'params' provides a magic JS helper that lets you assign parameters by
    1.26 +   * name.  Unlike the helper on mozIStorageStatement, you cannot enumerate
    1.27 +   * in order to find out what parameters are legal.
    1.28 +   *
    1.29 +   * This does not work for BLOBs.  You must use an explicit binding API for
    1.30 +   * that.
    1.31 +   *
    1.32 +   * example:
    1.33 +   *  stmt.params.foo = 1;
    1.34 +   *  stmt.params["bar"] = 2;
    1.35 +   *  let argName = "baz";
    1.36 +   *  stmt.params[argName] = 3;
    1.37 +   *
    1.38 +   * readonly attribute nsIMagic params;
    1.39 +   */
    1.40 +};

mercurial