Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

psDatabase Class Reference

#include <psdatabase.h>

List of all members.

Public Member Functions

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

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.
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:
objectreg,:The 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:
host,:The URL of the server that hosts the mysql database.
port,:The port of the server that hosts the mysql database.
user,:The username for the database.
password,:The password used to access the database.
database,:The name of the database to use for the current user.
Returns:
Returns success in initializing or faliure.
See also:
iConnection::Initialize()
int psDatabase::InsertResponse ( csString &  response) [protected]
int psDatabase::InsertResponse ( psAdminResponseList &  responses) [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: