OpenSim::Data::MySQL::MySQLManager Class Reference

A MySQL Database manager. More...

List of all members.

Public Member Functions

 MySQLManager (string hostname, string database, string username, string password, string cpooling, string port)
 Initialises and creates a new MySQL connection and maintains it.
 MySQLManager (String connect)
 Initialises and creates a new MySQL connection and maintains it.
void Initialise (String connect)
 Initialises and creates a new MySQL connection and maintains it.
void CheckConnection ()
 Should be called before any db operation. This checks to see if the connection has not timed out.
void Close ()
 Shuts down the database connection.
void Reconnect ()
 Reconnects to the database.
string getVersion ()
 Returns the version of this DB provider.
void ExecuteResourceSql (string name)
 Execute a SQL statement stored in a resource, as a string.
void ExecuteSql (string sql)
 Execute a MySqlCommand.
void ExecuteParameterizedSql (string sql, Dictionary< string, string > parameters)
void GetTableVersion (Dictionary< string, string > tableList)
 Given a list of tables, return the version of the tables, as seen in the database.
IDbCommand Query (string sql, Dictionary< string, string > parameters)
 Runs a query with protection against SQL Injection by using parameterised input.
RegionProfileData readSimRow (IDataReader reader)
 Reads a region row from a database reader.
ReservationData readReservationRow (IDataReader reader)
 Reads a reservation row from a database reader.
UserAgentData readAgentRow (IDataReader reader)
 Reads an agent row from a database reader.
UserProfileData readUserRow (IDataReader reader)
 Reads a user profile from an active data reader.
AvatarAppearance readAppearanceRow (IDataReader reader)
 Reads an avatar appearence from an active data reader.
Hashtable readAttachments (IDataReader r)
bool insertLogRow (string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
 Inserts a new row into the log database.
bool insertUserRow (UUID uuid, string username, string lastname, string email, string passwordHash, string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ, float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner)
 Creates a new user and inserts it into the database.
bool updateUserRow (UUID uuid, string username, string lastname, string email, string passwordHash, string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ, float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner)
 Update user data into the database where User ID = uuid.
bool insertRegion (RegionProfileData regiondata)
 Inserts a new region into the database.
bool deleteRegion (string uuid)
 Delete a region from the database.
bool insertAgentRow (UserAgentData agentdata)
 Creates a new agent and inserts it into the database.
bool insertAppearanceRow (AvatarAppearance appearance)
 Create (or replace if existing) an avatar appearence.
void writeAttachments (UUID agentID, Hashtable data)

Protected Member Functions

void GetWaitTimeout ()
 Get the wait_timeout value for our connection.

Properties

MySqlConnection Connection [get]
 Get the connection being used.


Detailed Description

A MySQL Database manager.


Constructor & Destructor Documentation

OpenSim::Data::MySQL::MySQLManager::MySQLManager ( string  hostname,
string  database,
string  username,
string  password,
string  cpooling,
string  port 
) [inline]

Initialises and creates a new MySQL connection and maintains it.

Parameters:
hostname The MySQL server being connected to
database The name of the MySQL database being used
username The username logging into the database
password The password for the user logging in
cpooling Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.
port The MySQL server port

OpenSim::Data::MySQL::MySQLManager::MySQLManager ( String  connect  )  [inline]

Initialises and creates a new MySQL connection and maintains it.

Parameters:
connect connectionString


Member Function Documentation

void OpenSim::Data::MySQL::MySQLManager::Initialise ( String  connect  )  [inline]

Initialises and creates a new MySQL connection and maintains it.

Parameters:
connect connectionString

void OpenSim::Data::MySQL::MySQLManager::GetWaitTimeout (  )  [inline, protected]

Get the wait_timeout value for our connection.

void OpenSim::Data::MySQL::MySQLManager::CheckConnection (  )  [inline]

Should be called before any db operation. This checks to see if the connection has not timed out.

void OpenSim::Data::MySQL::MySQLManager::Close (  )  [inline]

Shuts down the database connection.

void OpenSim::Data::MySQL::MySQLManager::Reconnect (  )  [inline]

Reconnects to the database.

string OpenSim::Data::MySQL::MySQLManager::getVersion (  )  [inline]

Returns the version of this DB provider.

Returns:
A string containing the DB provider

void OpenSim::Data::MySQL::MySQLManager::ExecuteResourceSql ( string  name  )  [inline]

Execute a SQL statement stored in a resource, as a string.

Parameters:
name name of embedded resource

void OpenSim::Data::MySQL::MySQLManager::ExecuteSql ( string  sql  )  [inline]

Execute a MySqlCommand.

Parameters:
sql sql string to execute

void OpenSim::Data::MySQL::MySQLManager::ExecuteParameterizedSql ( string  sql,
Dictionary< string, string >  parameters 
) [inline]

void OpenSim::Data::MySQL::MySQLManager::GetTableVersion ( Dictionary< string, string >  tableList  )  [inline]

Given a list of tables, return the version of the tables, as seen in the database.

Parameters:
tableList 

IDbCommand OpenSim::Data::MySQL::MySQLManager::Query ( string  sql,
Dictionary< string, string >  parameters 
) [inline]

Runs a query with protection against SQL Injection by using parameterised input.

Parameters:
sql The SQL string - replace any variables such as WHERE x = "y" with WHERE x =
parameters The parameters - index so that is indexed as 'y'
Returns:
A MySQL DB Command

RegionProfileData OpenSim::Data::MySQL::MySQLManager::readSimRow ( IDataReader  reader  )  [inline]

Reads a region row from a database reader.

Parameters:
reader An active database reader
Returns:
A region profile

ReservationData OpenSim::Data::MySQL::MySQLManager::readReservationRow ( IDataReader  reader  )  [inline]

Reads a reservation row from a database reader.

Parameters:
reader An active database reader
Returns:
A reservation data object

UserAgentData OpenSim::Data::MySQL::MySQLManager::readAgentRow ( IDataReader  reader  )  [inline]

Reads an agent row from a database reader.

Parameters:
reader An active database reader
Returns:
A user session agent

UserProfileData OpenSim::Data::MySQL::MySQLManager::readUserRow ( IDataReader  reader  )  [inline]

Reads a user profile from an active data reader.

Parameters:
reader An active database reader
Returns:
A user profile

AvatarAppearance OpenSim::Data::MySQL::MySQLManager::readAppearanceRow ( IDataReader  reader  )  [inline]

Reads an avatar appearence from an active data reader.

Parameters:
reader An active database reader
Returns:
An avatar appearence

Hashtable OpenSim::Data::MySQL::MySQLManager::readAttachments ( IDataReader  r  )  [inline]

bool OpenSim::Data::MySQL::MySQLManager::insertLogRow ( string  serverDaemon,
string  target,
string  methodCall,
string  arguments,
int  priority,
string  logMessage 
) [inline]

Inserts a new row into the log database.

Parameters:
serverDaemon The daemon which triggered this event
target Who were we operating on when this occured (region UUID, user UUID, etc)
methodCall The method call where the problem occured
arguments The arguments passed to the method
priority How critical is this?
logMessage Extra message info
Returns:
Saved successfully?

bool OpenSim::Data::MySQL::MySQLManager::insertUserRow ( UUID  uuid,
string  username,
string  lastname,
string  email,
string  passwordHash,
string  passwordSalt,
UInt64  homeRegion,
UUID  homeRegionID,
float  homeLocX,
float  homeLocY,
float  homeLocZ,
float  homeLookAtX,
float  homeLookAtY,
float  homeLookAtZ,
int  created,
int  lastlogin,
string  inventoryURI,
string  assetURI,
uint  canDoMask,
uint  wantDoMask,
string  aboutText,
string  firstText,
UUID  profileImage,
UUID  firstImage,
UUID  webLoginKey,
int  userFlags,
int  godLevel,
string  customType,
UUID  partner 
) [inline]

Creates a new user and inserts it into the database.

Parameters:
uuid User ID
username First part of the login
lastname Second part of the login
passwordHash A salted hash of the users password
passwordSalt The salt used for the password hash
homeRegion A regionHandle of the users home region
homeRegionID The UUID of the user's home region
homeLocX Home region position vector
homeLocY Home region position vector
homeLocZ Home region position vector
homeLookAtX Home region 'look at' vector
homeLookAtY Home region 'look at' vector
homeLookAtZ Home region 'look at' vector
created Account created (unix timestamp)
lastlogin Last login (unix timestamp)
inventoryURI Users inventory URI
assetURI Users asset URI
canDoMask I can do mask
wantDoMask I want to do mask
aboutText Profile text
firstText Firstlife text
profileImage UUID for profile image
firstImage UUID for firstlife image
webLoginKey Ignored
Returns:
Success?

bool OpenSim::Data::MySQL::MySQLManager::updateUserRow ( UUID  uuid,
string  username,
string  lastname,
string  email,
string  passwordHash,
string  passwordSalt,
UInt64  homeRegion,
UUID  homeRegionID,
float  homeLocX,
float  homeLocY,
float  homeLocZ,
float  homeLookAtX,
float  homeLookAtY,
float  homeLookAtZ,
int  created,
int  lastlogin,
string  inventoryURI,
string  assetURI,
uint  canDoMask,
uint  wantDoMask,
string  aboutText,
string  firstText,
UUID  profileImage,
UUID  firstImage,
UUID  webLoginKey,
int  userFlags,
int  godLevel,
string  customType,
UUID  partner 
) [inline]

Update user data into the database where User ID = uuid.

Parameters:
uuid User ID
username First part of the login
lastname Second part of the login
passwordHash A salted hash of the users password
passwordSalt The salt used for the password hash
homeRegion A regionHandle of the users home region
homeLocX Home region position vector
homeLocY Home region position vector
homeLocZ Home region position vector
homeLookAtX Home region 'look at' vector
homeLookAtY Home region 'look at' vector
homeLookAtZ Home region 'look at' vector
created Account created (unix timestamp)
lastlogin Last login (unix timestamp)
inventoryURI Users inventory URI
assetURI Users asset URI
canDoMask I can do mask
wantDoMask I want to do mask
aboutText Profile text
firstText Firstlife text
profileImage UUID for profile image
firstImage UUID for firstlife image
webLoginKey UUID for weblogin Key
Returns:
Success?

bool OpenSim::Data::MySQL::MySQLManager::insertRegion ( RegionProfileData  regiondata  )  [inline]

Inserts a new region into the database.

Parameters:
regiondata The region to insert
Returns:
Success?

bool OpenSim::Data::MySQL::MySQLManager::deleteRegion ( string  uuid  )  [inline]

Delete a region from the database.

Parameters:
uuid The region to delete
Returns:
Success?

bool OpenSim::Data::MySQL::MySQLManager::insertAgentRow ( UserAgentData  agentdata  )  [inline]

Creates a new agent and inserts it into the database.

Parameters:
agentdata The agent data to be inserted
Returns:
Success?

bool OpenSim::Data::MySQL::MySQLManager::insertAppearanceRow ( AvatarAppearance  appearance  )  [inline]

Create (or replace if existing) an avatar appearence.

Parameters:
appearance 
Returns:
Succes?

void OpenSim::Data::MySQL::MySQLManager::writeAttachments ( UUID  agentID,
Hashtable  data 
) [inline]


Property Documentation

MySqlConnection OpenSim::Data::MySQL::MySQLManager::Connection [get]

Get the connection being used.

Returns:
MySqlConnection Object


The documentation for this class was generated from the following file:
Generated on Mon Jan 5 01:00:39 2009 for OpenSim by  doxygen 1.5.1