diff options
-rw-r--r-- | framework/Data/Common/Mssql/TMssqlMetaData.php | 4 | ||||
-rw-r--r-- | framework/Data/TDbConnection.php | 5 | ||||
-rw-r--r-- | framework/Exceptions/messages/messages-fr.txt | 1 | ||||
-rw-r--r-- | framework/Exceptions/messages/messages-id.txt | 1 | ||||
-rw-r--r-- | framework/Exceptions/messages/messages-zh.txt | 1 | ||||
-rw-r--r-- | framework/Exceptions/messages/messages.txt | 1 | ||||
-rwxr-xr-x | framework/Testing/Data/Schema/mssql/TMssqlSchema.php | 3 | ||||
-rwxr-xr-x | framework/Testing/Data/TDbConnection.php | 4 |
8 files changed, 16 insertions, 4 deletions
diff --git a/framework/Data/Common/Mssql/TMssqlMetaData.php b/framework/Data/Common/Mssql/TMssqlMetaData.php index 8309e4ec..2751caf3 100644 --- a/framework/Data/Common/Mssql/TMssqlMetaData.php +++ b/framework/Data/Common/Mssql/TMssqlMetaData.php @@ -53,9 +53,9 @@ class TMssqlMetaData extends TDbMetaData AND t.table_name = :table EOD; if($schemaName!==null) - $sql .= ' AND t.schema_name = :schema'; + $sql .= ' AND t.table_schema = :schema'; if($catalogName!==null) - $sql .= ' AND t.catalog_name = :catalog'; + $sql .= ' AND t.table_catalog = :catalog'; $command = $this->getDbConnection()->createCommand($sql); $command->bindValue(':table', $tableName); diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php index 3709f4d4..4dccbad1 100644 --- a/framework/Data/TDbConnection.php +++ b/framework/Data/TDbConnection.php @@ -222,6 +222,11 @@ class TDbConnection extends TComponent case 'pgsql':
$stmt = $this->_pdo->prepare('SET client_encoding TO ?');
break;
+ case 'sqlite':
+ $stmt = $pdo->prepare ('SET NAMES ?');
+ break;
+ default:
+ throw new TDbException('dbconnection_unsupported_driver_charset', $driver);
}
$stmt->execute(array($this->_charset));
}
diff --git a/framework/Exceptions/messages/messages-fr.txt b/framework/Exceptions/messages/messages-fr.txt index d6785fdf..4e6a396b 100644 --- a/framework/Exceptions/messages/messages-fr.txt +++ b/framework/Exceptions/messages/messages-fr.txt @@ -366,6 +366,7 @@ tactivecustomvalidator_clientfunction_unsupported = {0} does not support client dbconnection_open_failed = TDbConnection failed to establish DB connection: {0} dbconnection_connection_inactive = TDbConnection is inactive. +dbconnection_unsupported_driver_charset = Le pilote de base de données '{0}' ne supporte pas la modification du jeu de caractères. dbcommand_prepare_failed = TDbCommand failed to prepare the SQL statement "{1}": {0} dbcommand_execute_failed = TDbCommand failed to execute the SQL statement "{1}": {0} diff --git a/framework/Exceptions/messages/messages-id.txt b/framework/Exceptions/messages/messages-id.txt index 61699ddd..687d4f30 100644 --- a/framework/Exceptions/messages/messages-id.txt +++ b/framework/Exceptions/messages/messages-id.txt @@ -367,6 +367,7 @@ tactivecustomvalidator_clientfunction_unsupported = {0} tidak mendukung fungsi v dbconnection_open_failed = TDbConnection gagal untuk menyelesaikan koneksi DB: {0}
dbconnection_connection_inactive = TDbConnection tidak aktif.
+dbconnection_unsupported_driver_charset = Database driver '{0}' doesn't support setting charset.
dbcommand_prepare_failed = TDbCommand gagal untuk menyiapkan pernyataan SQL "{1}": {0}
dbcommand_execute_failed = TDbCommand gagal untuk menjalankan pernyataan SQL "{1}": {0}
diff --git a/framework/Exceptions/messages/messages-zh.txt b/framework/Exceptions/messages/messages-zh.txt index 1859aa92..9dc14a8b 100644 --- a/framework/Exceptions/messages/messages-zh.txt +++ b/framework/Exceptions/messages/messages-zh.txt @@ -372,6 +372,7 @@ tactivecustomvalidator_clientfunction_unsupported = {0} does not support client dbconnection_open_failed = TDbConnection failed to establish DB connection: {0} dbconnection_connection_inactive = TDbConnection is inactive. +dbconnection_unsupported_driver_charset = Database driver '{0}' doesn't support setting charset. dbcommand_prepare_failed = TDbCommand failed to prepare the SQL statement "{1}": {0} dbcommand_execute_failed = TDbCommand failed to execute the SQL statement "{1}": {0} diff --git a/framework/Exceptions/messages/messages.txt b/framework/Exceptions/messages/messages.txt index b20c0f8b..fd85920c 100644 --- a/framework/Exceptions/messages/messages.txt +++ b/framework/Exceptions/messages/messages.txt @@ -376,6 +376,7 @@ tactivecustomvalidator_clientfunction_unsupported = {0} does not support client dbconnection_open_failed = TDbConnection failed to establish DB connection: {0} dbconnection_connection_inactive = TDbConnection is inactive. +dbconnection_unsupported_driver_charset = Database driver '{0}' doesn't support setting charset. dbcommand_prepare_failed = TDbCommand failed to prepare the SQL statement "{1}": {0} dbcommand_execute_failed = TDbCommand failed to execute the SQL statement "{1}": {0} diff --git a/framework/Testing/Data/Schema/mssql/TMssqlSchema.php b/framework/Testing/Data/Schema/mssql/TMssqlSchema.php index 1b3d815c..d728a6ce 100755 --- a/framework/Testing/Data/Schema/mssql/TMssqlSchema.php +++ b/framework/Testing/Data/Schema/mssql/TMssqlSchema.php @@ -10,6 +10,7 @@ */ prado::using('System.Testing.Data.Schema.TDbSchema'); +prado::using('System.Testing.Data.Schema.mssql.*'); /** * TMssqlSchema is the class for retrieving metadata information from a MS SQL Server database. @@ -286,7 +287,7 @@ SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES] WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA=:schema EOD; $command=$this->getDbConnection()->createCommand($sql); - $command->bindParam(":schema", $schema); + $command->bindParameter(":schema", $schema); $rows=$command->queryAll(); $names=array(); foreach ($rows as $row) 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)); } |