Skip to content

Commit

Permalink
Escape schema and table names
Browse files Browse the repository at this point in the history
  • Loading branch information
chanmix51 committed Apr 22, 2014
1 parent 1f90c45 commit 30e121a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Pomm/Tools/CreateBaseMapTool.php
Expand Up @@ -91,7 +91,7 @@ protected function generateMapFile()
$std_namespace = $this->getNamespace();
$namespace = $std_namespace.'\\Base';
$class_name = $this->options['class_name'];
$table_name = sprintf("%s.%s", $this->options['schema'], $this->options['table']);
$table_name = sprintf('%s.%s', $this->options['database']->getConnection()->escapeIdentifier($this->options['schema']), $this->options['database']->getConnection()->escapeIdentifier($this->options['table']));
$extends = $this->options['extends'];
$primary_key = join(', ', $this->inspector->getTablePrimaryKey($this->options['oid']));
$map_name = sprintf("%sMap", $class_name);
Expand Down
2 changes: 1 addition & 1 deletion tests/Pomm/Fixture/TestDb/PommTest/Base/PikaMap.php
Expand Up @@ -11,7 +11,7 @@ public function initialize()
{

$this->object_class = 'TestDb\PommTest\Pika';
$this->object_name = 'pomm_test.pika';
$this->object_name = '"pomm_test"."pika"';

$this->addField('id', 'int4');
$this->addField('some_char', 'bpchar');
Expand Down
4 changes: 2 additions & 2 deletions tests/Pomm/Fixture/TestDb/PommTestProd/Base/ChuMap.php
Expand Up @@ -5,14 +5,14 @@
use \Pomm\Object\BaseObjectMap;
use \Pomm\Exception\Exception;

abstract class ChuMap extends \\TestDb\PommTest\PikaMap
abstract class ChuMap extends \TestDb\PommTest\PikaMap
{
public function initialize()
{
parent::initialize();

$this->object_class = 'TestDb\PommTestProd\Chu';
$this->object_name = 'pomm_test.chu';
$this->object_name = '"pomm_test"."chu"';

$this->addField('some_some_type', 'pomm_test.some_type');

Expand Down
2 changes: 1 addition & 1 deletion tests/Pomm/Test/Tools/CreateBaseMapToolTest.php
Expand Up @@ -109,7 +109,7 @@ public function testGenerateBaseMapInherits()
$root_dir.'/ChuMap.php',
), array(
'namespace' => '%dbname%\%schema%Prod',
'parent_namespace' => '\%dbname%\%schema%',
'parent_namespace' => '%dbname%\%schema%',
));
}
}

0 comments on commit 30e121a

Please sign in to comment.