Planeshift
psDatabase Class Reference

#include <psdatabase.h>

Public Member Functions

void Close ()
 Closes sql database connection. More...
 
const char * GetLastError ()
 Returns the last error that occured. More...
 
const char * GetLastQuery ()
 Returns the last query that was performed. More...
 
const char * GetLastSQLError ()
 Utility functions. More...
 
virtual bool Initialize (const char *host, unsigned int port, const char *user, const char *password, const char *database)
 Initialize the database manager. More...
 
 psDatabase (iObjectRegistry *objectreg)
 Initializing Constructor. More...
 
void SetLastError (const char *str)
 Sets the last error that occured. More...
 
virtual ~psDatabase ()
 Destructor. More...
 

Protected Member Functions

int InsertResponse (psAdminResponseList &responses)
 
int InsertResponse (csString &response)
 
int InsertResponseSet (stringList &responseSet)
 
int InsertTrigger (const char *trigger, const char *area, int maxAttitude, int minAttitude, int responseID, int priorID)
 

Protected Attributes

csString lasterror
 Contains a string that describes the last error that happened. More...
 
csRef< iDataConnection > mysql
 
iObjectRegistry * object_reg
 

Detailed Description

Definition at line 45 of file psdatabase.h.

Constructor & Destructor Documentation

psDatabase::psDatabase ( iObjectRegistry *  objectreg)

Initializing Constructor.

Parameters
objectregThe object registry for later use.
virtual psDatabase::~psDatabase ( )
virtual

Destructor.

Calls the Close() function upon destruction of the object.

See also
Close()

Member Function Documentation

void psDatabase::Close ( )

Closes sql database connection.

const char* psDatabase::GetLastError ( )

Returns the last error that occured.

This error is usually intended to be explanatory to a user, rather than the SQL error technical description of the problem.

Returns
Returns a string that describes the last error that occured.
See also
iConnection::GetLastError()
const char* psDatabase::GetLastQuery ( )

Returns the last query that was performed.

Used to help diagnose why a particular error occurred.

Returns
Returns a string that contains the last query performed.
See also
iConnection::GetLastQuery()
const char* psDatabase::GetLastSQLError ( )

Utility functions.

Returns the last error generated by SQL

Returns
Returns a string that describes the last sql error.
See also
iConnection::GetLastError()
virtual bool psDatabase::Initialize ( const char *  host,
unsigned int  port,
const char *  user,
const char *  password,
const char *  database 
)
virtual

Initialize the database manager.

This will connect to the database and log on using the given username, password and start using the given database.

Parameters
hostThe URL of the server that hosts the mysql database.
portThe port of the server that hosts the mysql database.
userThe username for the database.
passwordThe password used to access the database.
databaseThe name of the database to use for the current user.
Returns
Returns success in initializing or faliure.
See also
iConnection::Initialize()
int psDatabase::InsertResponse ( psAdminResponseList &  responses)
protected
int psDatabase::InsertResponse ( csString &  response)
protected
int psDatabase::InsertResponseSet ( stringList &  responseSet)
protected
int psDatabase::InsertTrigger ( const char *  trigger,
const char *  area,
int  maxAttitude,
int  minAttitude,
int  responseID,
int  priorID 
)
protected
void psDatabase::SetLastError ( const char *  str)
inline

Sets the last error that occured.

Definition at line 90 of file psdatabase.h.

Member Data Documentation

csString psDatabase::lasterror
protected

Contains a string that describes the last error that happened.

Definition at line 116 of file psdatabase.h.

csRef<iDataConnection> psDatabase::mysql
protected

Definition at line 113 of file psdatabase.h.

iObjectRegistry* psDatabase::object_reg
protected

Definition at line 112 of file psdatabase.h.


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