6,6 → 6,9 |
/** |
* Generic database model class using PDO (PHP Data Objects) |
* |
* @property-read PDO $connection |
* Database connection. Established on read access to this |
* property if not yet established. |
* @property-read array $lastError |
* Last error information of the database operation. |
* See {@link PDOStatement::errorInfo()}. |
132,11 → 135,22 |
{ |
$this->_options = $options; |
} |
} |
|
/** |
* @return PDO |
*/ |
public function getConnection () |
{ |
if ($this->_connection === null) |
{ |
$this->_connection = |
new PDO($this->_dsn, $this->_username, $this->_password, $this->_options); |
} |
|
return $this->_connection; |
} |
|
/** |
* Initiates a transaction |
* |
145,7 → 159,7 |
*/ |
public function beginTransaction() |
{ |
return $this->_connection->beginTransaction(); |
return $this->connection->beginTransaction(); |
} |
|
/** |
156,7 → 170,7 |
*/ |
public function rollBack() |
{ |
return $this->_connection->rollBack(); |
return $this->connection->rollBack(); |
} |
|
/** |
167,7 → 181,7 |
*/ |
public function commit() |
{ |
return $this->_connection->commit(); |
return $this->connection->commit(); |
} |
|
/** |
176,7 → 190,7 |
*/ |
public function prepare($query, array $driver_options = array()) |
{ |
return $this->_connection->prepare($query, $driver_options); |
return $this->connection->prepare($query, $driver_options); |
} |
|
/** |
488,7 → 502,7 |
*/ |
protected function _setLastInsertId($name = null) |
{ |
return ($this->_lastInsertId = $this->_connection->lastInsertId($name)); |
return ($this->_lastInsertId = $this->connection->lastInsertId($name)); |
} |
|
/** |