Fixing case-sensitivity of AS in fields. Tests added. Fixes #1474

This commit is contained in:
mark_story 2011-01-26 20:58:16 -05:00
parent d192ed32f0
commit 71d8e744f1
2 changed files with 6 additions and 2 deletions

View file

@ -562,7 +562,7 @@ class DboSource extends DataSource {
);
}
if (
preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/', $data, $matches
preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches
)) {
return $this->cacheMethod(
__FUNCTION__, $cacheKey,

View file

@ -4077,10 +4077,14 @@ class DboSourceTest extends CakeTestCase {
$result = $this->testDb->name(array('my-name', 'Foo-Model.*'));
$expected = array('`my-name`', '`Foo-Model`.*');
$this->assertEqual($result, $expected);
$result = $this->testDb->name(array('Team.P%', 'Team.G/G'));
$expected = array('`Team`.`P%`', '`Team`.`G/G`');
$this->assertEqual($result, $expected);
$result = $this->testDb->name('Model.name as y');
$expected = '`Model`.`name` AS `y`';
$this->assertEqual($result, $expected);
}
/**