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

SQLrequest Class Reference

SQLrequest is sent to the SQL API to command it to run a query and return the result. More...

#include <m_sqlv2.h>

Inheritance diagram for SQLrequest:

Inheritance graph
[legend]
Collaboration diagram for SQLrequest:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SQLrequest (Module *s, Module *d, const std::string &databaseid, const SQLquery &q)
 Initialize an SQLrequest.
void Priority (bool p=true)
 Set the priority of a request.
void SetSource (Module *mod)
 Set the source of a request.

Public Attributes

SQLquery query
 The fully parsed and expanded query string This is initialized from the SQLquery parameter given in the constructor.
std::string dbid
 The database ID to apply the request to.
bool pri
 True if this is a priority query.
unsigned long id
 The query ID, assigned by the SQL api.
SQLerror error
 If an error occured, error.id will be any other value than SQL_NO_ERROR.

Detailed Description

SQLrequest is sent to the SQL API to command it to run a query and return the result.

You must instantiate this object with a valid SQLquery object and its parameters, then send it using its Send() method to the module providing the 'SQL' feature. To find this module, use Server::FindFeature().

Definition at line 203 of file m_sqlv2.h.


Constructor & Destructor Documentation

SQLrequest::SQLrequest Module s,
Module d,
const std::string databaseid,
const SQLquery q
[inline]
 

Initialize an SQLrequest.

For example:

SQLrequest req = SQLrequest(MyMod, SQLModule, dbid, SQLquery("INSERT INTO ircd_log_actors VALUES('','?')" % nick));

Parameters:
s A pointer to the sending module, where the result should be routed
d A pointer to the receiving module, identified as implementing the 'SQL' feature
databaseid The database ID to perform the query on. This must match a valid database ID from the configuration of the SQL module.
q A properly initialized SQLquery object.

Definition at line 238 of file m_sqlv2.h.


Member Function Documentation

void SQLrequest::Priority bool  p = true  )  [inline]
 

Set the priority of a request.

Definition at line 245 of file m_sqlv2.h.

References pri.

void SQLrequest::SetSource Module mod  )  [inline]
 

Set the source of a request.

You should not need to use this method.

Definition at line 252 of file m_sqlv2.h.

References Request::source.


Member Data Documentation

std::string SQLrequest::dbid
 

The database ID to apply the request to.

Definition at line 212 of file m_sqlv2.h.

Referenced by ModuleSQLite3::OnRequest(), ModulePgSQL::OnRequest(), ModuleSQL::OnRequest(), and ModuleMsSQL::OnRequest().

SQLerror SQLrequest::error
 

If an error occured, error.id will be any other value than SQL_NO_ERROR.

Definition at line 225 of file m_sqlv2.h.

Referenced by ModuleSQLAuth::CheckCredentials(), SQLConn::DoLeadingQuery(), ModuleTestClient::OnBackgroundTimer(), ModuleSQLite3::OnRequest(), ModulePgSQL::OnRequest(), ModuleSQL::OnRequest(), and ModuleMsSQL::OnRequest().

unsigned long SQLrequest::id
 

The query ID, assigned by the SQL api.

After your request is processed, this will be initialized for you by the API to a valid request ID, except in the case of an error.

Reimplemented from Request.

Definition at line 222 of file m_sqlv2.h.

Referenced by ModuleSQLLog::AddLogEntry(), ModuleSQLAuth::CheckCredentials(), SQLConn::DoConnectedPoll(), SQLConnection::DoLeadingQuery(), QueryQueue::DoPurgeModule(), QueryInfo::Go(), ModuleSQLOper::LookupOper(), ModuleTestClient::OnBackgroundTimer(), ModuleSQLite3::OnRequest(), ModulePgSQL::OnRequest(), ModuleSQL::OnRequest(), ModuleMsSQL::OnRequest(), and SQLConn::Query().

bool SQLrequest::pri
 

True if this is a priority query.

Priority queries may 'queue jump' in the request queue.

Definition at line 216 of file m_sqlv2.h.

Referenced by Priority(), and QueryQueue::push().

SQLquery SQLrequest::query
 

The fully parsed and expanded query string This is initialized from the SQLquery parameter given in the constructor.

Definition at line 209 of file m_sqlv2.h.

Referenced by SQLConn::DoConnectedPoll(), SQLConnection::DoLeadingQuery(), SQLConn::DoQuery(), and SQLConn::Query().


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