From c5c397a55dd9d9026247377c3a0daa7517393d06 Mon Sep 17 00:00:00 2001 From: "christophe.boulain" <> Date: Wed, 19 Jan 2011 14:02:27 +0000 Subject: Raise an exception when DB driver doesn't support changing charset. Also some minor MSSQL fixes --- framework/Testing/Data/TDbConnection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'framework/Testing/Data/TDbConnection.php') diff --git a/framework/Testing/Data/TDbConnection.php b/framework/Testing/Data/TDbConnection.php index 99484454..c34a07cb 100755 --- a/framework/Testing/Data/TDbConnection.php +++ b/framework/Testing/Data/TDbConnection.php @@ -289,7 +289,7 @@ class TDbConnection extends TComponent $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES,true); if($this->charset!==null) { - switch ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) + switch (($driver=$pdo->getAttribute(PDO::ATTR_DRIVER_NAME))) { case 'mysql': $stmt = $pdo->prepare('SET CHARACTER SET ?'); @@ -300,6 +300,8 @@ class TDbConnection extends TComponent case 'sqlite': $stmt = $pdo->prepare ('SET NAMES ?'); break; + default: + throw new TDbException('dbconnection_unsupported_driver_charset', $driver); } $stmt->execute(array($this->charset)); } -- cgit v1.2.3