1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-31 09:41:43 +02:00

improved DibiPdoDriver identifier escaping

This commit is contained in:
David Grudl
2008-06-18 23:34:35 +00:00
parent d12895102f
commit 2a4f5ec456
2 changed files with 28 additions and 4 deletions

View File

@@ -250,9 +250,12 @@ class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
case dibi::IDENTIFIER:
$a = strrpos($value, '.');
if ($a === FALSE) return '"' . str_replace('"', '""', $value) . '"';
// table.col delimite as table."col"
return substr($value, 0, $a) . '."' . str_replace('"', '""', substr($value, $a + 1)) . '"';
if ($a === FALSE) {
return '"' . str_replace('"', '""', $value) . '"';
} else {
// table.col delimite as table."col"
return substr($value, 0, $a) . '."' . str_replace('"', '""', substr($value, $a + 1)) . '"';
}
case dibi::FIELD_BOOL:
return $value ? 'TRUE' : 'FALSE';