1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-16 02:54:25 +02:00

quoted identifiers security fix

This commit is contained in:
David Grudl
2008-09-15 23:58:03 +00:00
parent 8c4211d5be
commit 9b84459f09
7 changed files with 13 additions and 2 deletions

View File

@@ -242,6 +242,7 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
case dibi::IDENTIFIER:
switch ($this->connection->getAttribute(PDO::ATTR_DRIVER_NAME)) {
case 'mysql':
$value = str_replace('`', '``', $value);
return '`' . str_replace('.', '`.`', $value) . '`';
case 'pgsql':
@@ -254,9 +255,11 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
case 'sqlite':
case 'sqlite2':
$value = strtr($value, '[]', ' ');
case 'odbc':
case 'oci': // TODO: not tested
case 'mssql':
$value = str_replace(array('[', ']'), array('[[', ']]'), $value);
return '[' . str_replace('.', '].[', $value) . ']';
default: