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

MsSQLResult Class Reference

Inheritance diagram for MsSQLResult:

Inheritance graph
[legend]
Collaboration diagram for MsSQLResult:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MsSQLResult (Module *self, Module *to, unsigned int rid)
 ~MsSQLResult ()
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 116 of file m_mssql.cpp.


Constructor & Destructor Documentation

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

Definition at line 131 of file m_mssql.cpp.

MsSQLResult::~MsSQLResult  )  [inline]
 

Definition at line 136 of file m_mssql.cpp.


Member Function Documentation

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

Definition at line 140 of file m_mssql.cpp.

References colnames, cols, fieldlists, and rows.

Referenced by SQLConn::ResultReady().

virtual std::string MsSQLResult::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 169 of file m_mssql.cpp.

References colnames.

Referenced by GetRowMap().

virtual int MsSQLResult::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 182 of file m_mssql.cpp.

References colnames.

virtual int MsSQLResult::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 164 of file m_mssql.cpp.

References cols.

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

virtual void MsSQLResult::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 276 of file m_mssql.cpp.

virtual void MsSQLResult::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 271 of file m_mssql.cpp.

virtual SQLfieldList& MsSQLResult::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 206 of file m_mssql.cpp.

References currentrow, emptyfieldlist, fieldlists, and rows.

virtual SQLfieldMap& MsSQLResult::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 214 of file m_mssql.cpp.

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

virtual SQLfieldMap* MsSQLResult::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 255 of file m_mssql.cpp.

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

virtual SQLfieldList* MsSQLResult::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 240 of file m_mssql.cpp.

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

virtual SQLfield MsSQLResult::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 193 of file m_mssql.cpp.

References Cols(), fieldlists, and rows.

Referenced by GetRowMap(), and GetRowMapPtr().

virtual int MsSQLResult::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 159 of file m_mssql.cpp.

References rows.

Referenced by GetRowPtr().

void MsSQLResult::UpdateAffectedCount  )  [inline]
 

Definition at line 154 of file m_mssql.cpp.

References rows.

Referenced by SQLConn::AffectedReady(), and SQLConn::Query().


Member Data Documentation

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

Definition at line 123 of file m_mssql.cpp.

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

int MsSQLResult::cols [private]
 

Definition at line 121 of file m_mssql.cpp.

Referenced by AddRow(), and Cols().

int MsSQLResult::currentrow [private]
 

Definition at line 119 of file m_mssql.cpp.

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

SQLfieldList MsSQLResult::emptyfieldlist [private]
 

Definition at line 125 of file m_mssql.cpp.

Referenced by GetRow().

SQLfieldList* MsSQLResult::fieldlist [private]
 

Definition at line 127 of file m_mssql.cpp.

Referenced by GetRowPtr().

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

Definition at line 124 of file m_mssql.cpp.

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

SQLfieldMap* MsSQLResult::fieldmap [private]
 

Definition at line 128 of file m_mssql.cpp.

Referenced by GetRowMap(), and GetRowMapPtr().

int MsSQLResult::rows [private]
 

Definition at line 120 of file m_mssql.cpp.

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


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