Public Member Functions | Public Attributes

mozIStorageStatement Interface Reference

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

import "mozIStorageStatement.idl";

Inheritance diagram for mozIStorageStatement:
Collaboration diagram for mozIStorageStatement:

List of all members.

Public Member Functions

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 execute ()
 Execute the query, ignoring any results.
boolean executeStep ()
 Execute a query, using any currently-bound parameters.
long getTypeOfIndex (in unsigned long aIndex)
 Indicate the data type of the current result row for the the given column.
double getDouble (in unsigned long aIndex)
 Retrieve the contents of a column from the current result row as a floating point double.
void getBlob (in unsigned long aIndex, out unsigned long aDataSize,[array, size_is(aDataSize)] out octet aData)
 Retrieve the contents of a column from the current result row as a blob.
boolean getIsNull (in unsigned long aIndex)
 Check whether the given column in the current result row is NULL.
void getSharedUTF8String (in unsigned long aIndex, out unsigned long aLength,[shared, retval] out string aResult)
 Returns a shared string pointer.
void getSharedString (in unsigned long aIndex, out unsigned long aLength,[shared, retval] out wstring aResult)
void getSharedBlob (in unsigned long aIndex, out unsigned long aLength,[shared, retval] out octetPtr aResult)
PRInt32 AsInt32 (PRUint32 idx)
 Getters for native code that return their values as the return type, for convenience and sanity.
PRInt64 AsInt64 (PRUint32 idx)
double AsDouble (PRUint32 idx)
const char * AsSharedUTF8String (PRUint32 idx, PRUint32 *len)
const PRUnicharAsSharedWString (PRUint32 idx, PRUint32 *len)
const PRUint8 * AsSharedBlob (PRUint32 idx, PRUint32 *len)
PRBool IsNull (PRUint32 idx)

long getInt32 (in unsigned long aIndex)
 Retrieve the contents of a column from the current result row as an integer.
long long getInt64 (in unsigned long aIndex)
 Retrieve the contents of a column from the current result row as an integer.

AUTF8String getUTF8String (in unsigned long aIndex)
 Retrieve the contents of a column from the current result row as a string.
AString getString (in unsigned long aIndex)
 Retrieve the contents of a column from the current result row as a string.

Public Attributes

readonly attribute unsigned long parameterCount
readonly attribute unsigned long columnCount
 Number of columns returned.
const long VALUE_TYPE_NULL = 0
 Execute a query, using any currently-bound parameters.
const long VALUE_TYPE_INTEGER = 1
const long VALUE_TYPE_FLOAT = 2
const long VALUE_TYPE_TEXT = 3
const long VALUE_TYPE_BLOB = 4
readonly attribute unsigned long numEntries
 The number of entries in the array (each corresponding to a column in the database row).

Detailed Description

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


Member Function Documentation

double mozIStorageStatement::AsDouble ( PRUint32  idx  )  [inline]
PRInt32 mozIStorageStatement::AsInt32 ( PRUint32  idx  )  [inline]

Getters for native code that return their values as the return type, for convenience and sanity.

Not virtual; no vtable bloat.

PRInt64 mozIStorageStatement::AsInt64 ( PRUint32  idx  )  [inline]
const PRUint8* mozIStorageStatement::AsSharedBlob ( PRUint32  idx,
PRUint32 *  len 
) [inline]
const char* mozIStorageStatement::AsSharedUTF8String ( PRUint32  idx,
PRUint32 *  len 
) [inline]
const PRUnichar* mozIStorageStatement::AsSharedWString ( PRUint32  idx,
PRUint32 *  len 
) [inline]
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.

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.

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::getBlob ( in unsigned long  aIndex,
out unsigned long  aDataSize,
[array, size_is(aDataSize)] out octet  aData 
)

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

Parameters:
aIndex 0-based colummn index.
[out] aDataSize The number of bytes in the blob.
[out] aData The contents of the BLOB. This will be NULL if aDataSize == 0.
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.

double mozIStorageStatement::getDouble ( in unsigned long  aIndex  ) 

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

Parameters:
aIndex 0-based colummn index.
Returns:
Column value interpreted as a double per type conversion rules.
long mozIStorageStatement::getInt32 ( in unsigned long  aIndex  ) 

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

Parameters:
aIndex 0-based colummn index.
Returns:
Column value interpreted as an integer per type conversion rules.
long long mozIStorageStatement::getInt64 ( in unsigned long  aIndex  ) 

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

Parameters:
aIndex 0-based colummn index.
Returns:
Column value interpreted as an integer per type conversion rules.
boolean mozIStorageStatement::getIsNull ( in unsigned long  aIndex  ) 

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

Parameters:
aIndex 0-based colummn index.
Returns:
true if the value for the result column is null.
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.

void mozIStorageStatement::getSharedBlob ( in unsigned long  aIndex,
out unsigned long  aLength,
[shared, retval] out octetPtr  aResult 
)
void mozIStorageStatement::getSharedString ( in unsigned long  aIndex,
out unsigned long  aLength,
[shared, retval] out wstring  aResult 
)
void mozIStorageStatement::getSharedUTF8String ( in unsigned long  aIndex,
out unsigned long  aLength,
[shared, retval] out string  aResult 
)

Returns a shared string pointer.

AString mozIStorageStatement::getString ( in unsigned long  aIndex  ) 

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

Parameters:
aIndex 0-based colummn index.
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.
long mozIStorageStatement::getTypeOfIndex ( in unsigned long  aIndex  ) 

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.

Parameters:
aIndex 0-based column index.
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.
AUTF8String mozIStorageStatement::getUTF8String ( in unsigned long  aIndex  ) 

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

Parameters:
aIndex 0-based colummn index.
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.
PRBool mozIStorageStatement::IsNull ( PRUint32  idx  )  [inline]
void mozIStorageStatement::reset (  ) 

Reset parameters/statement execution.


Member Data Documentation

readonly attribute unsigned long mozIStorageStatement::columnCount

Number of columns returned.

readonly attribute unsigned long mozIStorageStatement::numEntries

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

readonly attribute unsigned long mozIStorageStatement::parameterCount

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; These type values are returned by getTypeOfIndex to indicate what type of value is present at a given column.


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