Db Class Reference
[Db]

Include files. More...

List of all members.

Public Member Functions

 Db (Config $config_)
 executeQuery ($sql_)
 Execute a database query.
 getConnection ()
 Get a creole database Connection.
 setConfigName ($configName_)
 Set database config name.
 getConfigName ()
 Get current config name that is used.
 pushConfigName ($configName_)
 Set a new datbase config name, and save the old one on a stack.
 popConfigName ()
 Set the last pushed config name.

Private Attributes

 $_configName = 'foMaster'
 The current used database config name.
 $_configNameStack = array()
 An array used as a stack with config names.


Detailed Description

Include files.

Functions to communicate with the database server.

Author:
Daniel Lindh <[email protected]>

Definition at line 15 of file Db.class.php.


Member Function Documentation

Db::Db ( Config config_  ) 

Definition at line 20 of file Db.class.php.

00021   {
00022     $this->_config = $config_;
00023   }

Db::executeQuery ( sql_  ) 

Execute a database query.

Parameters:
$sql_ - string - The sql query.
Returns:
ResultSet

Definition at line 33 of file Db.class.php.

References getConnection().

00034   {
00035     $conn = $this->getConnection();
00036     return $conn->executeQuery($sql_);
00037   }

Db::getConfigName (  ) 

Get current config name that is used.

Returns:
string

Definition at line 67 of file Db.class.php.

Referenced by getConnection().

00068   {
00069     return $this->_configName;
00070   }

Db::getConnection (  ) 

Get a creole database Connection.

Returns:
Connection

Definition at line 44 of file Db.class.php.

References getConfigName().

Referenced by executeQuery().

00045   {
00046     $dsn = $this->_config->getDBDSN($this->getConfigName());
00047 
00048     return  Creole::getConnection($dsn);
00049   }

Db::popConfigName (  ) 

Set the last pushed config name.

Definition at line 88 of file Db.class.php.

00089   {
00090     $this->_configName = array_pop($this->_configNameStack);
00091   }

Db::pushConfigName ( configName_  ) 

Set a new datbase config name, and save the old one on a stack.

Parameters:
$configName_ - string - A config name. Ie foMaster

Definition at line 78 of file Db.class.php.

References setConfigName().

00079   {
00080     array_push($this->_configNameStack, $this->_configName);
00081     $this->setConfigName($configName_);
00082   }

Db::setConfigName ( configName_  ) 

Set database config name.

Parameters:
$configName_ - string - A config name. Ie foMaster

Definition at line 57 of file Db.class.php.

Referenced by pushConfigName().

00058   {
00059     $this->_configName = $configName_;
00060   }


Member Data Documentation

Db::$_configName = 'foMaster' [private]

The current used database config name.

Definition at line 96 of file Db.class.php.

Db::$_configNameStack = array() [private]

An array used as a stack with config names.

See also:
Db::pushConfigName()

Definition at line 103 of file Db.class.php.


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

Generated on Wed May 6 23:28:24 2009 for fareofficelib by  doxygen 1.5.8