Skip to content
Permalink
Browse files

Refactoring possible common code to DboSource, now that PDO abstract …

…disconnection from source
  • Loading branch information...
lorenzo committed Oct 18, 2010
1 parent f3d3ee9 commit 159776fc002b2d67001d299c22c5985ce4c8df9c
Showing with 21 additions and 19 deletions.
  1. +0 −17 cake/libs/model/datasources/dbo/dbo_mysql.php
  2. +21 −2 cake/libs/model/datasources/dbo_source.php
@@ -165,10 +165,6 @@ function connect() {
return $this->connected;
}
public function getConnection() {
return $this->_connection;
}
/**
* Check whether the MySQL extension is installed/loaded
*
@@ -177,19 +173,6 @@ public function getConnection() {
function enabled() {
return in_array('mysql', PDO::getAvailableDrivers());
}
/**
* Disconnects from database.
*
* @return boolean True if the database could be disconnected, else false
*/
function disconnect() {
if (is_a($this->_result, 'PDOStatement')) {
$this->_result->closeCursor();
}
unset($this->_connection);
$this->connected = false;
return !$this->connected;
}
/**
* Returns an array of sources (tables) in the database.
@@ -160,9 +160,28 @@ function reconnect($config = array()) {
}
/**
* Prepares a value, or an array of values for database queries by quoting and escaping them.
* Disconnects from database.
*
* @param mixed $data A value or an array of values to prepare.
* @return boolean True if the database could be disconnected, else false
*/
function disconnect() {
if (is_a($this->_result, 'PDOStatement')) {
$this->_result->closeCursor();
}
unset($this->_connection);
$this->connected = false;
return !$this->connected;
}
public function getConnection() {
return $this->_connection;
}
/**
* Returns a quoted and escaped string of $data for use in an SQL statement.
*
* @param string $data String to be prepared for use in an SQL statement
* @param string $column The column into which this data will be inserted
* @param boolean $read Value to be used in READ or WRITE context
* @return mixed Prepared value or array of values.

0 comments on commit 159776f

Please sign in to comment.
You can’t perform that action at this time.