1
0
mirror of synced 2025-01-17 22:11:41 +03:00

added getDataDict() for connection class

This commit is contained in:
zYne 2006-09-26 17:20:22 +00:00
parent ecd2612e7f
commit 437fac4c9e

View File

@ -44,6 +44,10 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* keys representing Doctrine_Table component names and values as Doctrine_Table objects
*/
protected $tables = array();
/**
* @var Doctrine_DataDict $dataDict
*/
private $dataDict;
/**
* the constructor
*
@ -105,8 +109,33 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* @return Doctrine_DataDict
*/
public function getDataDict() {
}
if(isset($this->dataDict))
return $this->dataDict;
$driver = $this->dbh->getAttribute(PDO::ATTR_DRIVER_NAME);
switch($driver) {
case "mysql":
$this->dataDict = new Doctrine_DataDict_Mysql($this);
break;
case "sqlite":
case "sqlite2":
$this->dataDict = new Doctrine_DataDict_Sqlite($this);
break;
case "pgsql":
$this->dataDict = new Doctrine_DataDict_Pgsql($this);
break;
case "oci":
case "oci8":
$this->dataDict = new Doctrine_DataDict_Oracle($this);
break;
case "mssql":
$this->dataDict = new Doctrine_DataDict_Mssql($this);
break;
default:
throw new Doctrine_Connection_Exception("No datadict driver availible for ".$driver);
}
return $this->dataDict;
}
/**
* returns the regular expression operator
* (implemented by the connection drivers)