Public Member Functions | Public Attributes

mozIStorageStatement Interface Reference

import "mozIStorageStatement.idl";

Inheritance diagram for mozIStorageStatement:
Collaboration diagram for mozIStorageStatement:

List of all members.

Public Member Functions

void finalize ()
 Finalizes a statement so you can successfully close a database connection.
mozIStorageStatement clone ()
 Create a clone of this statement, by initializing a new statement with the same connection and same SQL statement as this one.
AUTF8String getParameterName (in unsigned long aParamIndex)
 Name of nth parameter, if given.
unsigned long getParameterIndex (in AUTF8String aName)
 Returns the index of the named parameter.
AUTF8String getColumnName (in unsigned long aColumnIndex)
 Name of nth column.
unsigned long getColumnIndex (in AUTF8String aName)
 Obtains the index of the column with the specified name.
AUTF8String getColumnDecltype (in unsigned long aParamIndex)
 Obtains the declared column type of a prepared statement.
void reset ()
 Reset parameters/statement execution.
void bindUTF8StringParameter (in unsigned long aParamIndex, in AUTF8String aValue)
 Bind the given value to the parameter at aParamIndex.
void bindStringParameter (in unsigned long aParamIndex, in AString aValue)
void bindDoubleParameter (in unsigned long aParamIndex, in double aValue)
void bindInt32Parameter (in unsigned long aParamIndex, in long aValue)
void bindInt64Parameter (in unsigned long aParamIndex, in long long aValue)
void bindNullParameter (in unsigned long aParamIndex)
void bindBlobParameter (in unsigned long aParamIndex,[array, const, size_is(aValueSize)] in octet aValue, in unsigned long aValueSize)
void bindParameters (in mozIStorageBindingParamsArray aParameters)
 Binds the array of parameters to the statement.
mozIStorageBindingParamsArray newBindingParamsArray ()
 Creates a new mozIStorageBindingParamsArray that can be used to bind multiple sets of data to a statement.
void execute ()
 Execute the query, ignoring any results.
boolean executeStep ()
 Execute a query, using any currently-bound parameters.
mozIStoragePendingStatement executeAsync ([optional] in mozIStorageStatementCallback aCallback)
 Execute a query, using any currently-bound parameters.
AString escapeStringForLIKE (in AString aValue, in wchar aEscapeChar)
 Escape a string for SQL LIKE search.

Public Attributes

readonly attribute unsigned long parameterCount
readonly attribute unsigned long columnCount
 Number of columns returned.
const long MOZ_STORAGE_STATEMENT_INVALID = 0
 The current state.
const long MOZ_STORAGE_STATEMENT_READY = 1
const long MOZ_STORAGE_STATEMENT_EXECUTING = 2
readonly attribute long state

Member Function Documentation

void mozIStorageStatement::bindBlobParameter ( in unsigned long  aParamIndex,
[array, const, size_is(aValueSize)] in octet  aValue,
in unsigned long  aValueSize 
)
void mozIStorageStatement::bindDoubleParameter ( in unsigned long  aParamIndex,
in double  aValue 
)
void mozIStorageStatement::bindInt32Parameter ( in unsigned long  aParamIndex,
in long  aValue 
)
void mozIStorageStatement::bindInt64Parameter ( in unsigned long  aParamIndex,
in long long  aValue 
)
void mozIStorageStatement::bindNullParameter ( in unsigned long  aParamIndex  ) 
void mozIStorageStatement::bindParameters ( in mozIStorageBindingParamsArray  aParameters  ) 

Binds the array of parameters to the statement.

When executeAsync is called, all the parameters in aParameters are bound and then executed.

Parameters:
aParameters The array of parameters to bind to the statement upon execution.
void mozIStorageStatement::bindStringParameter ( in unsigned long  aParamIndex,
in AString  aValue 
)
void mozIStorageStatement::bindUTF8StringParameter ( in unsigned long  aParamIndex,
in AUTF8String  aValue 
)

Bind the given value to the parameter at aParamIndex.

Index 0 denotes the first numbered argument or ?1.

mozIStorageStatement mozIStorageStatement::clone (  ) 

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.

AString mozIStorageStatement::escapeStringForLIKE ( in AString  aValue,
in wchar  aEscapeChar 
)

Escape a string for SQL LIKE search.

Parameters:
aValue the string to escape for SQL LIKE
aEscapeChar the escape character
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 '/').
Note:
consumers will have to use same escape char when doing statements such as: ...LIKE '?1' ESCAPE '/'...
void mozIStorageStatement::execute (  ) 

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.

mozIStoragePendingStatement mozIStorageStatement::executeAsync ( [optional] in mozIStorageStatementCallback  aCallback  ) 

Execute a query, using any currently-bound parameters.

Reset is called when no more data is returned. This method is only available to JavaScript consumers.

Deprecated:
As of Mozilla 1.9.2 in favor of executeStep().
Returns:
a boolean indicating whether there are more rows or not.

[deprecated] boolean step(); Obtains the current list of named parameters, which are settable. This property is only available to JavaScript consumers.

readonly attribute mozIStorageStatementParams params; Obtains the current row, with access to all the data members by name. This property is only available to JavaScript consumers.

readonly attribute mozIStorageStatementRow row; 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.

Parameters:
aCallback [optional] The callback object that will be notified of progress, errors, and completion.
Returns:
an object that can be used to cancel the statements execution.
boolean mozIStorageStatement::executeStep (  ) 

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.
void mozIStorageStatement::finalize (  ) 

Finalizes a statement so you can successfully close a database connection.

This method does not need to be used from native callers since you can just set the statement to null, but is extremely useful to JS callers.

AUTF8String mozIStorageStatement::getColumnDecltype ( in unsigned long  aParamIndex  ) 

Obtains the declared column type of a prepared statement.

Parameters:
aParamIndex The zero-based index of the column who's declared type we are interested in.
Returns:
the declared index type.
unsigned long mozIStorageStatement::getColumnIndex ( in AUTF8String  aName  ) 

Obtains the index of the column with the specified name.

Parameters:
aName The name of the column.
Returns:
The index of the column with the specified name.
AUTF8String mozIStorageStatement::getColumnName ( in unsigned long  aColumnIndex  ) 

Name of nth column.

unsigned long mozIStorageStatement::getParameterIndex ( in AUTF8String  aName  ) 

Returns the index of the named parameter.

Parameters:
aName The name of the parameter you want the index for. This does not include the leading ':'.
Returns:
the index of the named parameter.
AUTF8String mozIStorageStatement::getParameterName ( in unsigned long  aParamIndex  ) 

Name of nth parameter, if given.

mozIStorageBindingParamsArray mozIStorageStatement::newBindingParamsArray (  ) 

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

Returns:
a mozIStorageBindingParamsArray that multiple sets of parameters can be bound to.
void mozIStorageStatement::reset (  ) 

Reset parameters/statement execution.


Member Data Documentation

readonly attribute unsigned long mozIStorageStatement::columnCount

Number of columns returned.

The current state.

Row getters are only valid while the statement is in the "executing" state.

readonly attribute unsigned long mozIStorageStatement::parameterCount
readonly attribute long mozIStorageStatement::state

The documentation for this interface was generated from the following file: