Fixing issue where table names with spaces would not be quoted by name(). Fixes #1121

This commit is contained in:
mark_story 2010-09-21 20:34:27 -04:00
parent b648b61422
commit 729a45703b
2 changed files with 8 additions and 0 deletions

View file

@ -571,6 +571,9 @@ class DboSource extends DataSource {
)
);
}
if (preg_match('/^[\w-_\s]*[\w-_]+/', $data)) {
return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . $data . $this->endQuote);
}
return $this->cacheMethod(__FUNCTION__, $cacheKey, $data);
}

View file

@ -4556,6 +4556,11 @@ class DboSourceTest extends CakeTestCase {
$Article->tablePrefix = 'tbl_';
$result = $this->testDb->fullTableName($Article, false);
$this->assertEqual($result, 'tbl_articles');
$Article->useTable = $Article->table = 'with spaces';
$Article->tablePrefix = '';
$result = $this->testDb->fullTableName($Article);
$this->assertEqual($result, '`with spaces`');
}
/**