Interface mozIStorageStatementType

A SQL statement that can be used for both synchronous and asynchronous purposes.

Hierarchy

Properties

columnCount: number

Number of columns returned

numEntries: number

The number of entries in the array (each corresponding to a column in the database row)

parameterCount: number

Number of parameters

state: number

Find out whether the statement is usable (has not been finalized).

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Binds aValue to the parameter with the index aIndex.

    Parameters

    • aIndex: number

      The zero-based index of the parameter to bind aValue to.

    • aValue: nsIVariant

      The value to bind.

    Returns void

  • Binds aValue to the parameter with the name aName.

    Parameters

    • aName: string

      The name of the parameter to bind aValue to.

    • aValue: nsIVariant

      The value to bind.

    Returns void

  • Binds the array of parameters to the statement. When executeAsync is called, all the parameters in aParameters are bound and then executed.

    Note

    This is only works on statements being used asynchronously.

    Parameters

    • aParameters: mozIStorageBindingParamsArray

      The array of parameters to bind to the statement upon execution.

    Returns void

  • Create a clone of this statement, by initializing a new statement with the same connection and same SQL statement as this one. It does not preserve statement state; that is, if a statement is being executed when it is cloned, the new statement will not be executing.

    Returns mozIStorageStatement

  • Escape a string for SQL LIKE search.

    Note

    Consumers will have to use same escape char when doing statements such as: ...LIKE '?1' ESCAPE '/'...

    Returns

    an AString of an escaped version of aValue (%, _ and the escape char are escaped with the escape char) For example, we will convert "foo/bar_baz%20cheese" into "foo//bar/_baz/%20cheese" (if the escape char is '/').

    Parameters

    • aValue: string

      The string to escape for SQL LIKE.

    • aEscapeChar: string

      The escape character.

    Returns string

  • Execute the query, ignoring any results. This is accomplished by calling executeStep() once, and then calling reset().

    Error and last insert info, etc. are available from the mozStorageConnection.

    Returns void

  • Execute a query asynchronously using any currently bound parameters. This statement can be reused immediately, and reset does not need to be called.

    Note

    If you have any custom defined functions, they must be re-entrant since they can be called on multiple threads.

    Returns

    an object that can be used to cancel the statements execution.

    Parameters

    • aCallback: mozIStorageStatementCallback

      [optional] The callback object that will be notified of progress, errors, and completion.

    Returns mozIStoragePendingStatement

  • Execute a query, using any currently-bound parameters. Reset must be called on the statement after the last call of executeStep.

    Returns

    a boolean indicating whether there are more rows or not; row data may be accessed using mozIStorageValueArray methods on the statement.

    Returns boolean

  • Finalizes a statement so you can successfully close a database connection. Once a statement has been finalized it can no longer be used for any purpose.

    Statements are implicitly finalized when their reference counts hits zero. If you are a native (C++) caller this is accomplished by setting all of your nsCOMPtr instances to be NULL. If you are operating from JavaScript code then you cannot rely on this behavior because of the involvement of garbage collection.

    When finalizing an asynchronous statement you do not need to worry about whether the statement has actually been executed by the asynchronous thread; you just need to call finalize after your last call to executeAsync involving the statement. However, you do need to use asyncClose instead of close on the connection if any statements have been used asynchronously.

    Returns void

  • @}

    Retrieve the contents of a column from the current result row as a blob.

    Parameters

    • aIndex: number

      0-based colummn index. @param[out] aDataSize The number of bytes in the blob. @param[out] aData The contents of the BLOB. This will be NULL if aDataSize == 0.

    • aDataSize: number
    • aData: number

    Returns void

  • Retrieve the contents of a Blob column from the current result row as a string.

    Returns

    The value for the result Blob column interpreted as a String. No encoding conversion is performed.

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns string

  • Retrieve the contents of a Blob column from the current result row as a UTF8 string.

    Returns

    The value for the result Blob column interpreted as a UTF8 String. No encoding conversion is performed.

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns string

  • Obtains the index of the column with the specified name.

    Returns

    The index of the column with the specified name.

    Parameters

    • aName: string

      The name of the column.

    Returns number

  • Name of nth column

    Parameters

    • aColumnIndex: number

    Returns string

  • @}

    Retrieve the contents of a column from the current result row as a floating point double.

    Returns

    Column value interpreted as a double per type conversion rules.

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns number

  • Retrieve the contents of a column from the current result row as an integer.

    Returns

    Column value interpreted as an integer per type conversion rules. @{

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns number

  • Parameters

    • aIndex: number

    Returns number

  • Check whether the given column in the current result row is NULL.

    Returns

    true if the value for the result column is null.

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns boolean

  • Returns the index of the named parameter.

    Returns

    the index of the named parameter.

    Parameters

    • aName: string

      The name of the parameter you want the index for. This does not include the leading ':'.

    Returns number

  • Name of nth parameter, if given

    Parameters

    • aParamIndex: number

    Returns string

  • Parameters

    • aIndex: number
    • aByteLength: number
    • aResult: octetPtr

    Returns void

  • Parameters

    • aIndex: number
    • aByteLength: number
    • aResult: wstring

    Returns void

  • Returns a shared string pointer.

    Parameters

    • aIndex: number

      0-based colummn index.

    • aByteLength: number

      The number of bytes in the string or blob. This is the same as the number of characters for UTF-8 strings, and twice the number of characters for UTF-16 strings.

    • aResult: string

      A pointer to the string or blob.

    Returns void

  • Parameters

    • aIndex: number

    Returns string

  • Indicate the data type of the current result row for the the given column. SQLite will perform type conversion if you ask for a value as a different type than it is stored as.

    Returns

    The type of the value at the given column index; one of VALUE_TYPE_NULL, VALUE_TYPE_INTEGER, VALUE_TYPE_FLOAT, VALUE_TYPE_TEXT, VALUE_TYPE_BLOB.

    Parameters

    • aIndex: number

      0-based column index.

    Returns number

  • Retrieve the contents of a column from the current result row as a string.

    Returns

    The value for the result column interpreted as a string. If the stored value was NULL, you will get an empty string with IsVoid set to distinguish it from an explicitly set empty string. @{

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns string

  • Retrieve the contents of a column from the current result row as a variant.

    Returns

    A variant with the type of the column value.

    Parameters

    • aIndex: number

      0-based colummn index.

    Returns nsIVariant

  • Creates a new mozIStorageBindingParamsArray that can be used to bind multiple sets of data to a statement with bindParameters.

    Returns

    a mozIStorageBindingParamsArray that multiple sets of parameters can be bound to.

    Note

    This is only useful for statements being used asynchronously.

    Returns mozIStorageBindingParamsArray

  • Reset parameters/statement execution

    Returns void

Generated using TypeDoc