SQLite::Statement Class Reference

Wrapper class for actual SQLite statement objects. More...

#include <SQLiteDB.h>

Collaboration diagram for SQLite::Statement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Statement ()
 Default constructor.
 Statement (const Statement &statement)
 Copy constructor.
virtual ~Statement ()
 Destructor.
DB GetDB () const
 Retrieve the DB wrapper object that this statement belongs to.
bool IsValid () const
 Tests if this statement object is valid (points to an actual statement object).
bool Execute ()
 Runs an execution (non-SELECT) statement.
Recordset Query ()
 Runs a SELECT statement.
bool HasParameter (const TCHAR *pParam) const
 Checks if the statement has a parameter with this name.
bool HasParameter (const std::tstring &sParam) const
 Checks if the statement has a parameter with this name.
void clear ()
 Disconnects the statement wrapper from the real statment object.
bool BindParameter (const TCHAR *pParam, const TCHAR *pValue)
 Sets the value of a parameter in the statement.
bool BindParameter (const std::tstring &sParam, const std::tstring &sValue)
 Sets the value of a parameter in the statement.
bool BindParameter (const std::tstring &sParam, const TCHAR *pValue)
 Sets the value of a parameter in the statement.
bool BindParameter (const TCHAR *pParam, const std::tstring &sValue)
 Sets the value of a parameter in the statement.
bool BindParameter (const TCHAR *pParam, int nValue)
 Set the value of a paramenter in the statement.
bool BindParameter (const std::tstring &sParam, int nValue)
 Sets the value of a parameter in the statement.
bool BindParameter (int nParam, const TCHAR *pValue)
 Sets the value of a parameter in the statement (by order).
bool BindParameter (int nParam, const std::tstring &sValue)
 Sets the value of a parameter in the statement (by order).
bool BindParameter (int nParam, int nValue)
 Sets the value of a parameter in the statement (by order).
sqlite_int64 GetLastInsertRowid () const
 Retrieve the ID of the last row inserted by the wrapped statement.
std::tstring GetLastError ()
 Retrieve the description of the last error that occured while running the statement.
virtual const Statementoperator= (const Statement &other)
 Assignment operator.

Protected Member Functions

 Statement (RealStatement *pReal)
 Constructor from an actual statement object.
void AddRef () const
 Adds a reference to the actual statement object.
void DecRef () const
 Deletes a reference to the actual statement object (can delete the object).

Protected Attributes

RealStatementm_pReal
 Pointer to the wrapped statement object.

Detailed Description

Wrapper class for actual SQLite statement objects.

Definition at line 229 of file SQLiteDB.h.


Constructor & Destructor Documentation

SQLite::Statement::Statement ( const Statement statement  )  [inline]

Copy constructor.

Parameters:
statement The statement wrapper object to copy

Definition at line 241 of file SQLiteDB.h.

References AddRef().

SQLite::Statement::Statement ( RealStatement pReal  )  [inline, protected]

Constructor from an actual statement object.

Parameters:
pReal The actual statement object to wrap

Definition at line 251 of file SQLiteDB.h.

References AddRef().


Member Function Documentation

bool SQLite::Statement::BindParameter ( int  nParam,
int  nValue 
)

Sets the value of a parameter in the statement (by order).

Parameters:
nParam Index of the parameter to set the value of
nValue The value to set
Returns:
true if value was set successfully, false if failed

Definition at line 904 of file SQLiteDB.cpp.

References SQLite::RealStatement::BindParameter(), IsValid(), and m_pReal.

bool SQLite::Statement::BindParameter ( int  nParam,
const std::tstring &  sValue 
) [inline]

Sets the value of a parameter in the statement (by order).

Parameters:
nParam The parameter to set (by order)
sValue The value to set it to
Returns:
true if set successfully, false if failed

Definition at line 330 of file SQLiteDB.h.

References BindParameter().

Referenced by BindParameter().

bool SQLite::Statement::BindParameter ( const std::tstring &  sParam,
int  nValue 
) [inline]

Sets the value of a parameter in the statement.

Parameters:
sParam The parameter to set
nValue The value to set it to
Returns:
true if set successfully, false if failed

Definition at line 319 of file SQLiteDB.h.

References BindParameter().

Referenced by BindParameter().

bool SQLite::Statement::BindParameter ( const TCHAR *  pParam,
const std::tstring &  sValue 
) [inline]

Sets the value of a parameter in the statement.

Parameters:
pParam The parameter to set
sValue The value to set it to
Returns:
true if set successfully, false if failed

Definition at line 308 of file SQLiteDB.h.

References BindParameter().

Referenced by BindParameter().

bool SQLite::Statement::BindParameter ( const std::tstring &  sParam,
const TCHAR *  pValue 
) [inline]

Sets the value of a parameter in the statement.

Parameters:
sParam The parameter to set
pValue The value to set it to
Returns:
true if set successfully, false if failed

Definition at line 301 of file SQLiteDB.h.

References BindParameter().

Referenced by BindParameter().

bool SQLite::Statement::BindParameter ( const std::tstring &  sParam,
const std::tstring &  sValue 
) [inline]

Sets the value of a parameter in the statement.

Parameters:
sParam The parameter to set
sValue The value to set it to
Returns:
true if set successfully, false if failed

Definition at line 294 of file SQLiteDB.h.

References BindParameter().

Referenced by BindParameter().

bool SQLite::Statement::Execute (  ) 

Runs an execution (non-SELECT) statement.

Returns:
true if the statement was executed successfully, false if failed

Definition at line 835 of file SQLiteDB.cpp.

References SQLite::RealStatement::Execute(), IsValid(), and m_pReal.

Referenced by SQLite::RealTransaction::Execute().

DB SQLite::Statement::GetDB (  )  const

Retrieve the DB wrapper object that this statement belongs to.

Returns:
The database wrapper object for the database this statement was perpared for

Definition at line 964 of file SQLiteDB.cpp.

References SQLite::RealStatement::GetDB(), and m_pReal.

Referenced by SQLite::RealTransaction::Execute(), and SQLite::RealTransaction::Query().

std::tstring SQLite::Statement::GetLastError (  ) 

Retrieve the description of the last error that occured while running the statement.

Returns:
The description of the last error that occured while performing the statement

Definition at line 914 of file SQLiteDB.cpp.

References SQLite::RealStatement::GetLastError(), and m_pReal.

sqlite_int64 SQLite::Statement::GetLastInsertRowid (  )  const

Retrieve the ID of the last row inserted by the wrapped statement.

Returns:
The SQLite internal ID of the last row inserted by the statement (0 if none)

Definition at line 954 of file SQLiteDB.cpp.

References SQLite::RealStatement::GetLastInsertRowid(), and m_pReal.

bool SQLite::Statement::HasParameter ( const std::tstring &  sParam  )  const [inline]

Checks if the statement has a parameter with this name.

Parameters:
sParam The name to test
Returns:
true if the query has this parameter, false otherwise

Definition at line 278 of file SQLiteDB.h.

References HasParameter().

Referenced by HasParameter().

bool SQLite::Statement::IsValid (  )  const

Tests if this statement object is valid (points to an actual statement object).

Returns:
true if the statement is valid, false if not

Definition at line 825 of file SQLiteDB.cpp.

References SQLite::RealStatement::IsValid(), and m_pReal.

Referenced by BindParameter(), Execute(), and Query().

virtual const Statement& SQLite::Statement::operator= ( const Statement other  )  [inline, virtual]

Assignment operator.

Parameters:
other The statement wrapper object to copy
Returns:
A reference to this object

Definition at line 356 of file SQLiteDB.h.

References AddRef(), DecRef(), and m_pReal.

Recordset SQLite::Statement::Query (  ) 

Runs a SELECT statement.

Returns:
The result of the query (empty record set if failed or invalid)

Definition at line 845 of file SQLiteDB.cpp.

References IsValid(), m_pReal, and SQLite::RealStatement::Query().

Referenced by SQLite::RealTransaction::Query().


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

Generated on Mon Jun 18 12:40:51 2012 for CC PDF Converter by doxygen 1.6.1