WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

mozIStorageStatement

IID:42fad13e-c67d-4b2c-bd61-2c5b17186772
Inherits From:mozIStorageValueArray

Constants

The current state. Row getters are only valid while the statement is in the "executing" state.
PRInt32 MOZ_STORAGE_STATEMENT_INVALID = 0
PRInt32 MOZ_STORAGE_STATEMENT_READY = 1
PRInt32 MOZ_STORAGE_STATEMENT_EXECUTING = 2

Properties

readonly PRUint32 columnCount

Number of columns returned

readonly PRUint32 parameterCount

readonly PRInt32 state


Methods

void bindBlobParameter ( PRUint32 paramIndex , arrayof PRUint8 value , PRUint32 valueSize ) void bindDoubleParameter ( PRUint32 paramIndex , double value ) void bindInt32Parameter ( PRUint32 paramIndex , PRInt32 value ) void bindInt64Parameter ( PRUint32 paramIndex , PRInt64 value ) void bindNullParameter ( PRUint32 paramIndex ) void bindStringParameter ( PRUint32 paramIndex , AString value ) void bindUTF8StringParameter ( PRUint32 paramIndex , AUTF8String value ) mozIStorageStatement clone ( ) AString escapeStringForLIKE ( AString value , PRUnichar escapeChar ) void execute ( ) PRBool executeStep ( ) void finalize ( ) AUTF8String getColumnDecltype ( PRUint32 paramIndex ) PRUint32 getColumnIndex ( AUTF8String name ) AUTF8String getColumnName ( PRUint32 columnIndex ) [noscript][notxpcom] sqlite3stmtptr* getNativeStatementPointer ( ) PRUint32 getParameterIndex ( AUTF8String name ) AUTF8String getParameterName ( PRUint32 paramIndex ) void initialize ( mozIStorageConnection DBConnection , AUTF8String SQLStatement ) void reset ( )

void bindBlobParameter ( PRUint32 paramIndex , arrayof PRUint8 value , PRUint32 valueSize )

Arguments:
paramIndex
value
valueSize

void bindDoubleParameter ( PRUint32 paramIndex , double value )

Arguments:
paramIndex
value

void bindInt32Parameter ( PRUint32 paramIndex , PRInt32 value )

Arguments:
paramIndex
value

void bindInt64Parameter ( PRUint32 paramIndex , PRInt64 value )

Arguments:
paramIndex
value

void bindNullParameter ( PRUint32 paramIndex )

Arguments:
paramIndex

void bindStringParameter ( PRUint32 paramIndex , AString value )

Arguments:
paramIndex
value

void bindUTF8StringParameter ( PRUint32 paramIndex , AUTF8String value )

Bind the given value to the parameter at paramIndex. Index 0 denotes the first numbered argument or ?1.

Arguments:
paramIndex
value

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 escapeStringForLIKE ( AString value , PRUnichar escapeChar )

Escape a string for SQL LIKE search.

Arguments:
value: the string to escape for SQL LIKE
escapeChar: the escape character

void execute ( )

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

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


PRBool executeStep ( )

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


void 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 getColumnDecltype ( PRUint32 paramIndex )

Obtains the declared column type of a prepared statement.

Arguments:
paramIndex: The zero-based index of the column who's declared type we are interested in.

PRUint32 getColumnIndex ( AUTF8String name )

Obtains the index of the column with the specified name.

Arguments:
name: The name of the column.
Returns:
The index of the column with the specified name.

AUTF8String getColumnName ( PRUint32 columnIndex )

Name of nth column

Arguments:
columnIndex

[notxpcom] sqlite3stmtptr* getNativeStatementPointer ( )


PRUint32 getParameterIndex ( AUTF8String name )

Returns the index of the named parameter.

Arguments:
name: The name of the parameter you want the index for.
Returns:
The index of the named parameter.

AUTF8String getParameterName ( PRUint32 paramIndex )

Name of nth parameter, if given

Arguments:
paramIndex

void initialize ( mozIStorageConnection DBConnection , AUTF8String SQLStatement )

Initialize this query with the given SQL statement.

Arguments:
DBConnection
SQLStatement

void reset ( )

Reset parameters/statement execution


References

This interface is the type of the following properties:

mozIStorageStatementWrapper.statement

This interface is passed as an argument to the following methods:

mozIStorageStatementWrapper.initialize

This interface is returned from the following methods:

mozIStorageConnection.createStatement, mozIStorageStatement.clone

Reference documentation is generated from Mozilla's source.