6,9 → 6,6 |
/** |
* 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()}. |
135,22 → 132,11 |
{ |
$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 |
* |
159,7 → 145,7 |
*/ |
public function beginTransaction() |
{ |
return $this->connection->beginTransaction(); |
return $this->_connection->beginTransaction(); |
} |
|
/** |
170,7 → 156,7 |
*/ |
public function rollBack() |
{ |
return $this->connection->rollBack(); |
return $this->_connection->rollBack(); |
} |
|
/** |
181,7 → 167,7 |
*/ |
public function commit() |
{ |
return $this->connection->commit(); |
return $this->_connection->commit(); |
} |
|
/** |
190,7 → 176,7 |
*/ |
public function prepare($query, array $driver_options = array()) |
{ |
return $this->connection->prepare($query, $driver_options); |
return $this->_connection->prepare($query, $driver_options); |
} |
|
/** |
502,7 → 488,7 |
*/ |
protected function _setLastInsertId($name = null) |
{ |
return ($this->_lastInsertId = $this->connection->lastInsertId($name)); |
return ($this->_lastInsertId = $this->_connection->lastInsertId($name)); |
} |
|
/** |