Skip to content
Permalink
Browse files

Freeing up some memory in dbos after the result set has been completl…

…y fetched.

Adding dbo_mysql and dbo_postgres to the AllDAtabase testsuite
  • Loading branch information...
lorenzo committed Nov 17, 2010
1 parent c0f1043 commit 40418de21814d9bd66da1d7add11977457df8857
@@ -187,13 +187,16 @@ function listSources($data = null) {
$result = $this->_execute('SHOW TABLES FROM ' . $this->config['database']);
if (!$result) {
$result->closeCursor();
return array();
} else {
$tables = array();
while ($line = $result->fetch()) {
$tables[] = $line[0];
}
$result->closeCursor();
parent::listSources($tables);
return $tables;
}
@@ -245,6 +248,7 @@ function fetchResult() {
}
return $resultRow;
} else {
$this->_result->closeCursor();
return false;
}
}
@@ -322,6 +326,7 @@ function describe($model) {
}
}
$this->__cacheDescription($this->fullTableName($model, false), $fields);
$cols->closeCursor();
return $fields;
}
@@ -437,6 +442,7 @@ function index($model) {
$index[$idx->Key_name]['column'] = $col;
}
}
$indices->closeCursor();
}
return $index;
}
@@ -596,6 +602,7 @@ function listDetailedSources($name = null) {
$result = $this->_execute('SHOW TABLE STATUS ' . $condition, $params);
if (!$result) {
$result->closeCursor();
return array();
} else {
$tables = array();
@@ -609,6 +616,7 @@ function listDetailedSources($name = null) {
}
}
}
$result->closeCursor();
if (is_string($name)) {
return $tables[$name];
}
@@ -164,6 +164,7 @@ function listSources() {
$result = $this->_execute($sql, array($schema));
if (!$result) {
$result->closeCursor();
return array();
} else {
$tables = array();
@@ -172,6 +173,7 @@ function listSources() {
$tables[] = $item->name;
}
$result->closeCursor();
parent::listSources($tables);
return $tables;
}
@@ -247,6 +249,8 @@ function &describe(&$model) {
if (isset($model->sequence)) {
$this->_sequenceMap[$table][$model->primaryKey] = $model->sequence;
}
$cols->closeCursor();
return $fields;
}
@@ -717,6 +721,7 @@ function fetchResult() {
}
return $resultRow;
} else {
$this->_result->closeCursor();
return false;
}
}
@@ -333,9 +333,11 @@ protected function _execute($sql, $params = array()) {
if (!$query->execute($params)) {
$this->_results = $query;
$this->error = $this->lastError($query);
$query->closeCursor();
return false;
}
if (!$query->columnCount()) {
$query->closeCursor();
return true;
}
return $query;
@@ -38,7 +38,14 @@ public static function suite() {
$path = CORE_TEST_CASES . DS . 'libs' . DS . 'model' . DS;
$tasks = array('db_acl', 'cake_schema', 'connection_manager', 'datasources' . DS . 'dbo_source');
$tasks = array(
'db_acl',
'cake_schema',
'connection_manager',
'datasources' . DS . 'dbo_source',
'datasources' . DS . 'dbo' . DS . 'dbo_mysql',
'datasources' . DS . 'dbo' . DS . 'dbo_postgres'
);
foreach ($tasks as $task) {
$suite->addTestFile($path . $task . '.test.php');
}
@@ -62,6 +62,7 @@ class DboMysqlTest extends CakeTestCase {
*/
public function setUp() {
$this->Dbo = ConnectionManager::getDataSource('test');
$this->skipIf(!($this->Dbo instanceof DboMysql));
if ($this->Dbo->config['driver'] !== 'mysql') {
$this->markTestSkipped('The MySQL extension is not available.');
}
@@ -244,6 +244,7 @@ class DboPostgresTest extends CakeTestCase {
public function setUp() {
Configure::write('Cache.disable', true);
$this->Dbo = ConnectionManager::getDataSource('test');
$this->skipIf(!($this->Dbo instanceof DboPostgres));
$this->Dbo2 = new DboPostgresTestDb($this->Dbo->config, false);
$this->skipUnless($this->Dbo->config['driver'] == 'postgres', 'PostgreSQL connection not available');
$this->model = new PostgresTestModel();

0 comments on commit 40418de

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