The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SQLite3Result Class Reference

Inheritance diagram for SQLite3Result:

Inheritance graph
[legend]
Collaboration diagram for SQLite3Result:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SQLite3Result (Module *self, Module *to, unsigned int rid)
 ~SQLite3Result ()
void AddRow (int colsnum, char **dat, char **colname)
void UpdateAffectedCount ()
virtual int Rows ()
 Return the number of rows in the result Note that if you have perfomed an INSERT or UPDATE query or other query which will not return rows, this will return the number of affected rows, and SQLresult::Cols() will contain 0.
virtual int Cols ()
 Return the number of columns in the result.
virtual std::string ColName (int column)
 Get a string name of the column by an index number.
virtual int ColNum (const std::string &column)
 Get an index number for a column from a string name.
virtual SQLfield GetValue (int row, int column)
 Get a string value in a given row and column This does not effect the internal cursor.
virtual SQLfieldListGetRow ()
 Return a list of values in a row, this should increment an internal counter so you can repeatedly call it until it returns an empty vector.
virtual SQLfieldMapGetRowMap ()
 As above, but return a map indexed by key name.
virtual SQLfieldListGetRowPtr ()
 Like GetRow(), but returns a pointer to a dynamically allocated object which must be explicitly freed.
virtual SQLfieldMapGetRowMapPtr ()
 As above, but return a map indexed by key name The internal cursor (row counter) is incremented by one.
virtual void Free (SQLfieldMap *fm)
 Overloaded function for freeing the lists and maps returned by GetRowPtr or GetRowMapPtr.
virtual void Free (SQLfieldList *fl)
 Overloaded function for freeing the lists and maps returned by GetRowPtr or GetRowMapPtr.

Private Attributes

int currentrow
int rows
int cols
std::vector< std::stringcolnames
std::vector< SQLfieldListfieldlists
SQLfieldList emptyfieldlist
SQLfieldListfieldlist
SQLfieldMapfieldmap

Detailed Description

Definition at line 94 of file m_sqlite3.cpp.


Constructor & Destructor Documentation

SQLite3Result::SQLite3Result Module self,
Module to,
unsigned int  rid
[inline]
 

Definition at line 109 of file m_sqlite3.cpp.

SQLite3Result::~SQLite3Result  )  [inline]
 

Definition at line 114 of file m_sqlite3.cpp.


Member Function Documentation

void SQLite3Result::AddRow int  colsnum,
char **  dat,
char **  colname
[inline]
 

Definition at line 118 of file m_sqlite3.cpp.

References colnames, cols, fieldlists, and rows.

Referenced by SQLConn::ResultReady().

virtual std::string SQLite3Result::ColName int  column  )  [inline, virtual]
 

Get a string name of the column by an index number.

Parameters:
column The id number of a column
Returns:
The column name associated with the given ID

Implements SQLresult.

Definition at line 147 of file m_sqlite3.cpp.

References colnames.

Referenced by GetRowMap().

virtual int SQLite3Result::ColNum const std::string column  )  [inline, virtual]
 

Get an index number for a column from a string name.

An exception of type SQLbadColName will be thrown if the name given is invalid.

Parameters:
column The column name to get the ID of
Returns:
The ID number of the column provided

Implements SQLresult.

Definition at line 160 of file m_sqlite3.cpp.

References colnames.

virtual int SQLite3Result::Cols  )  [inline, virtual]
 

Return the number of columns in the result.

If you performed an UPDATE or INSERT which does not return a dataset, this value will be 0.

Returns:
Number of columns in the result set.

Implements SQLresult.

Definition at line 142 of file m_sqlite3.cpp.

References cols.

Referenced by GetRowMap(), GetRowMapPtr(), and GetValue().

virtual void SQLite3Result::Free SQLfieldList fl  )  [inline, virtual]
 

Overloaded function for freeing the lists and maps returned by GetRowPtr or GetRowMapPtr.

Parameters:
fl The SQLfieldList to free

Implements SQLresult.

Definition at line 254 of file m_sqlite3.cpp.

virtual void SQLite3Result::Free SQLfieldMap fm  )  [inline, virtual]
 

Overloaded function for freeing the lists and maps returned by GetRowPtr or GetRowMapPtr.

Parameters:
fm The SQLfieldMap to free

Implements SQLresult.

Definition at line 249 of file m_sqlite3.cpp.

virtual SQLfieldList& SQLite3Result::GetRow  )  [inline, virtual]
 

Return a list of values in a row, this should increment an internal counter so you can repeatedly call it until it returns an empty vector.

This returns a reference to an internal object, the same object is used for all calls to this function and therefore the return value is only valid until you call this function again. It is also invalid if the SQLresult object is destroyed. The internal cursor (row counter) is incremented by one.

Returns:
A reference to the current row's SQLfieldList

Implements SQLresult.

Definition at line 184 of file m_sqlite3.cpp.

References currentrow, emptyfieldlist, fieldlists, and rows.

virtual SQLfieldMap& SQLite3Result::GetRowMap  )  [inline, virtual]
 

As above, but return a map indexed by key name.

The internal cursor (row counter) is incremented by one.

Returns:
A reference to the current row's SQLfieldMap

Implements SQLresult.

Definition at line 192 of file m_sqlite3.cpp.

References ColName(), Cols(), currentrow, fieldmap, GetValue(), and rows.

virtual SQLfieldMap* SQLite3Result::GetRowMapPtr  )  [inline, virtual]
 

As above, but return a map indexed by key name The internal cursor (row counter) is incremented by one.

Returns:
A newly-allocated SQLfieldMap

Implements SQLresult.

Definition at line 233 of file m_sqlite3.cpp.

References colnames, Cols(), currentrow, fieldmap, GetValue(), and rows.

virtual SQLfieldList* SQLite3Result::GetRowPtr  )  [inline, virtual]
 

Like GetRow(), but returns a pointer to a dynamically allocated object which must be explicitly freed.

For portability reasons this must be freed with SQLresult::Free() The internal cursor (row counter) is incremented by one.

Returns:
A newly-allocated SQLfieldList

Implements SQLresult.

Definition at line 218 of file m_sqlite3.cpp.

References currentrow, fieldlist, fieldlists, Rows(), and rows.

virtual SQLfield SQLite3Result::GetValue int  row,
int  column
[inline, virtual]
 

Get a string value in a given row and column This does not effect the internal cursor.

Returns:
The value stored at [row,column] in the table

Implements SQLresult.

Definition at line 171 of file m_sqlite3.cpp.

References Cols(), fieldlists, and rows.

Referenced by GetRowMap(), and GetRowMapPtr().

virtual int SQLite3Result::Rows  )  [inline, virtual]
 

Return the number of rows in the result Note that if you have perfomed an INSERT or UPDATE query or other query which will not return rows, this will return the number of affected rows, and SQLresult::Cols() will contain 0.

In this case you SHOULD NEVER access any of the result set rows, as there arent any!

Returns:
Number of rows in the result set.

Implements SQLresult.

Definition at line 137 of file m_sqlite3.cpp.

References rows.

Referenced by GetRowPtr().

void SQLite3Result::UpdateAffectedCount  )  [inline]
 

Definition at line 132 of file m_sqlite3.cpp.

References rows.

Referenced by SQLConn::AffectedReady().


Member Data Documentation

std::vector<std::string> SQLite3Result::colnames [private]
 

Definition at line 101 of file m_sqlite3.cpp.

Referenced by AddRow(), ColName(), ColNum(), and GetRowMapPtr().

int SQLite3Result::cols [private]
 

Definition at line 99 of file m_sqlite3.cpp.

Referenced by AddRow(), and Cols().

int SQLite3Result::currentrow [private]
 

Definition at line 97 of file m_sqlite3.cpp.

Referenced by GetRow(), GetRowMap(), GetRowMapPtr(), and GetRowPtr().

SQLfieldList SQLite3Result::emptyfieldlist [private]
 

Definition at line 103 of file m_sqlite3.cpp.

Referenced by GetRow().

SQLfieldList* SQLite3Result::fieldlist [private]
 

Definition at line 105 of file m_sqlite3.cpp.

Referenced by GetRowPtr().

std::vector<SQLfieldList> SQLite3Result::fieldlists [private]
 

Definition at line 102 of file m_sqlite3.cpp.

Referenced by AddRow(), GetRow(), GetRowPtr(), and GetValue().

SQLfieldMap* SQLite3Result::fieldmap [private]
 

Definition at line 106 of file m_sqlite3.cpp.

Referenced by GetRowMap(), and GetRowMapPtr().

int SQLite3Result::rows [private]
 

Definition at line 98 of file m_sqlite3.cpp.

Referenced by AddRow(), GetRow(), GetRowMap(), GetRowMapPtr(), GetRowPtr(), GetValue(), Rows(), and UpdateAffectedCount().


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