Commit 437fac4c authored by zYne's avatar zYne

added getDataDict() for connection class

parent ecd2612e
...@@ -44,6 +44,10 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun ...@@ -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 * keys representing Doctrine_Table component names and values as Doctrine_Table objects
*/ */
protected $tables = array(); protected $tables = array();
/**
* @var Doctrine_DataDict $dataDict
*/
private $dataDict;
/** /**
* the constructor * the constructor
* *
...@@ -105,8 +109,33 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun ...@@ -105,8 +109,33 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
* @return Doctrine_DataDict * @return Doctrine_DataDict
*/ */
public function getDataDict() { 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 * returns the regular expression operator
* (implemented by the connection drivers) * (implemented by the connection drivers)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment