From 0d79d16d2c06e139513a785cc90b9ea776484bab Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 8 Jul 2009 12:10:32 +0000 Subject: [PATCH] - binary unescape doesn't throw exceptions more --- dibi/drivers/mssql.php | 3 +++ dibi/drivers/mssql2005.php | 3 +++ dibi/drivers/mysql.php | 3 +++ dibi/drivers/mysqli.php | 3 +++ dibi/drivers/odbc.php | 3 +++ dibi/drivers/oracle.php | 3 +++ dibi/drivers/pdo.php | 3 +++ dibi/drivers/postgre.php | 7 ++----- dibi/drivers/sqlite.php | 3 +++ 9 files changed, 26 insertions(+), 5 deletions(-) diff --git a/dibi/drivers/mssql.php b/dibi/drivers/mssql.php index a51c8dd6..9fad2b15 100644 --- a/dibi/drivers/mssql.php +++ b/dibi/drivers/mssql.php @@ -242,6 +242,9 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/mssql2005.php b/dibi/drivers/mssql2005.php index a65cb168..9ffff5c2 100644 --- a/dibi/drivers/mssql2005.php +++ b/dibi/drivers/mssql2005.php @@ -242,6 +242,9 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index eaf53025..23e8867b 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -320,6 +320,9 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/mysqli.php b/dibi/drivers/mysqli.php index 85f5825c..a764eaf8 100644 --- a/dibi/drivers/mysqli.php +++ b/dibi/drivers/mysqli.php @@ -303,6 +303,9 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/odbc.php b/dibi/drivers/odbc.php index 87641d25..e612132a 100644 --- a/dibi/drivers/odbc.php +++ b/dibi/drivers/odbc.php @@ -248,6 +248,9 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/oracle.php b/dibi/drivers/oracle.php index 33139344..76d93f65 100644 --- a/dibi/drivers/oracle.php +++ b/dibi/drivers/oracle.php @@ -249,6 +249,9 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/pdo.php b/dibi/drivers/pdo.php index f45f4d0e..a3b6ea04 100644 --- a/dibi/drivers/pdo.php +++ b/dibi/drivers/pdo.php @@ -291,6 +291,9 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index 73af5dbc..62a7b734 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -289,13 +289,10 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { - switch ($type) { - case dibi::BINARY: + if ($type === dibi::BINARY) { return pg_unescape_bytea($value); - - default: - throw new InvalidArgumentException('Unsupported type.'); } + throw new InvalidArgumentException('Unsupported type.'); } diff --git a/dibi/drivers/sqlite.php b/dibi/drivers/sqlite.php index 45d2e682..d8079966 100644 --- a/dibi/drivers/sqlite.php +++ b/dibi/drivers/sqlite.php @@ -262,6 +262,9 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver */ public function unescape($value, $type) { + if ($type === dibi::BINARY) { + return $value; + } throw new InvalidArgumentException('Unsupported type.'); }