CDatabaseQuery Class Reference

#include <DatabaseQuery.h>

Inheritance diagram for CDatabaseQuery:
Collaboration diagram for CDatabaseQuery:

Public Member Functions

 CDatabaseQuery ()
virtual ~CDatabaseQuery ()
Init ()
nsresult GetDatabaseLocation (nsACString &aURISpec)
- Public Member Functions inherited from sbIDatabaseQuery
void setAsyncQuery (in PRBool bAsyncQuery)
 Set the query to run asynchronously (ie: execute() does not block) More...
PRBool isAyncQuery ()
 Return whether or not the query will run asynchronously. More...
void addSimpleQueryCallback (in sbIDatabaseSimpleQueryCallback dbPersistCB)
 Add a sbIDatabaseSimpleQueryCallback instance to the query. More...
void removeSimpleQueryCallback (in sbIDatabaseSimpleQueryCallback dbPersistCB)
 Remove a sbIDatabaseSimpleQueryCallback instance from the query. More...
void setDatabaseGUID (in AString dbGUID)
 Set the database to be queried. More...
AString getDatabaseGUID ()
 Get the database identifier string. More...
void addQuery (in AString strQuery)
 Add a SQL query string to the queue. More...
sbIDatabasePreparedStatement prepareQuery (in AString strQuery)
 Create a prepared statement object to reduce overhead for repeated queries. More...
void addPreparedStatement (in sbIDatabasePreparedStatement PreparedStatement)
 Add a prepared query to the queue. More...
unsigned long getQueryCount ()
 Return the number of query strings enqueued for execution. More...
sbIDatabasePreparedStatement getQuery (in unsigned long nIndex)
 Get the query at the Nth index. More...
void resetQuery ()
 Clear out the query and make it all sparkly new. More...
sbIDatabaseResult getResultObject ()
 Get the results object for the query that has executed. More...
long getLastError ()
 Get the last error on the query that has executed. More...
void setLastError (in long dbError)
 Set the last error on the query. More...
long execute ()
 Execute the queries enqueued in the object. More...
long waitForCompletion ()
 Wait until the query has finished executing asynchronously. More...
boolean isExecuting ()
 Return whether or not the query is currently executing. More...
unsigned long currentQuery ()
 Return the current index in the queue being indexed. More...
boolean abort ()
 Abort a currently executing query. More...
void bindUTF8StringParameter (in unsigned long aParamIndex, in AUTF8String aValue)
 Binds a UTF8String to the last added query. More...
void bindStringParameter (in unsigned long aParamIndex, in AString aValue)
 Binds a String to the last added query. More...
void bindDoubleParameter (in unsigned long aParamIndex, in double aValue)
 Binds a double to the last added query. More...
void bindInt32Parameter (in unsigned long aParamIndex, in long aValue)
 Binds an int32 to the last added query. More...
void bindInt64Parameter (in unsigned long aParamIndex, in long long aValue)
 Binds an int64 to the last added query. More...
void bindNullParameter (in unsigned long aParamIndex)
 Binds a null to the last added query. More...

Protected Member Functions

CDatabaseResultGetResultObject ()
void SetResultObject (CDatabaseResult *aResultObject)
nsresult PopQuery (sbIDatabasePreparedStatement **_retval)
bindParameterArray_tGetQueryParameters (PRUint32 aQueryIndex)
bindParameterArray_tPopQueryParameters ()

Protected Attributes

PRLock * m_pLock
nsCString m_LocationURIString
PRBool m_IsAborting
PRBool m_IsExecuting
PRBool m_AsyncQuery
PRUint32 m_CurrentQuery
PRInt32 m_LastError
nsRefPtr< CDatabaseResultm_QueryResult
nsString m_DatabaseGUID
std::deque< nsCOMPtr
< sbIDatabasePreparedStatement > > 
PRMonitor * m_pQueryRunningMonitor
PRBool m_QueryHasCompleted
< nsISupportsHashKey,
std::deque< bindParameterArray_tm_BindParameters
PRUint64 m_RollingLimit
PRUint32 m_RollingLimitColumnIndex
PRUint32 m_RollingLimitResult
nsCOMPtr< sbIDatabaseEnginemDatabaseEngine


class CDatabaseEngine
class QueryProcessorThread

Additional Inherited Members

- Public Attributes inherited from sbIDatabaseQuery
attribute nsIURI databaseLocation
 Set a specific folder/directory URI for the database. More...
attribute unsigned long long rollingLimit
 Set the rolling limit for this query. More...
attribute unsigned long rollingLimitColumnIndex
 The index of the column used to add to the limit total. More...
attribute unsigned long rollingLimitResult
 The number of the row (1 is the first row) that met or exceeded the limit. More...

Detailed Description

Definition at line 121 of file DatabaseQuery.h.

Constructor & Destructor Documentation

CDatabaseQuery::CDatabaseQuery ( )
CDatabaseQuery::~CDatabaseQuery ( )

Definition at line 114 of file DatabaseQuery.cpp.

Member Function Documentation

nsresult CDatabaseQuery::GetDatabaseLocation ( nsACString &  aURISpec)

Additional accessor to get the database location as a string spec. This is used when an nsIURI isn't needed and/or the caller is off of the main thread.

Definition at line 135 of file DatabaseQuery.cpp.

bindParameterArray_t * CDatabaseQuery::GetQueryParameters ( PRUint32  aQueryIndex)

Definition at line 662 of file DatabaseQuery.cpp.

CDatabaseResult * CDatabaseQuery::GetResultObject ( )

Definition at line 377 of file DatabaseQuery.cpp.

nsresult CDatabaseQuery::Init ( )

Definition at line 124 of file DatabaseQuery.cpp.

nsresult CDatabaseQuery::PopQuery ( sbIDatabasePreparedStatement **  _retval)

Definition at line 326 of file DatabaseQuery.cpp.

Here is the caller graph for this function:

bindParameterArray_t * CDatabaseQuery::PopQueryParameters ( )

Definition at line 676 of file DatabaseQuery.cpp.

Here is the caller graph for this function:

void CDatabaseQuery::SetResultObject ( CDatabaseResult aResultObject)

Definition at line 656 of file DatabaseQuery.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class CDatabaseEngine

Definition at line 124 of file DatabaseQuery.h.

friend class QueryProcessorThread

Definition at line 125 of file DatabaseQuery.h.

Member Data Documentation

PRBool CDatabaseQuery::m_AsyncQuery

Definition at line 159 of file DatabaseQuery.h.

std::deque< bindParameterArray_t > CDatabaseQuery::m_BindParameters

Definition at line 172 of file DatabaseQuery.h.

nsInterfaceHashtableMT<nsISupportsHashKey, sbIDatabaseSimpleQueryCallback> CDatabaseQuery::m_CallbackList

Definition at line 171 of file DatabaseQuery.h.

PRUint32 CDatabaseQuery::m_CurrentQuery

Definition at line 161 of file DatabaseQuery.h.

nsString CDatabaseQuery::m_DatabaseGUID

Definition at line 165 of file DatabaseQuery.h.

std::deque< nsCOMPtr<sbIDatabasePreparedStatement> > CDatabaseQuery::m_DatabaseQueryList

Definition at line 166 of file DatabaseQuery.h.

PRBool CDatabaseQuery::m_IsAborting

Definition at line 157 of file DatabaseQuery.h.

PRBool CDatabaseQuery::m_IsExecuting

Definition at line 158 of file DatabaseQuery.h.

PRInt32 CDatabaseQuery::m_LastError

Definition at line 162 of file DatabaseQuery.h.

nsCString CDatabaseQuery::m_LocationURIString

Definition at line 155 of file DatabaseQuery.h.

PRLock* CDatabaseQuery::m_pLock

Definition at line 153 of file DatabaseQuery.h.

PRMonitor* CDatabaseQuery::m_pQueryRunningMonitor

Definition at line 168 of file DatabaseQuery.h.

PRBool CDatabaseQuery::m_QueryHasCompleted

Definition at line 169 of file DatabaseQuery.h.

nsRefPtr<CDatabaseResult> CDatabaseQuery::m_QueryResult

Definition at line 164 of file DatabaseQuery.h.

PRUint64 CDatabaseQuery::m_RollingLimit

Definition at line 174 of file DatabaseQuery.h.

PRUint32 CDatabaseQuery::m_RollingLimitColumnIndex

Definition at line 175 of file DatabaseQuery.h.

PRUint32 CDatabaseQuery::m_RollingLimitResult

Definition at line 176 of file DatabaseQuery.h.

nsCOMPtr<sbIDatabaseEngine> CDatabaseQuery::mDatabaseEngine

Definition at line 178 of file DatabaseQuery.h.

The documentation for this class was generated from the following files: