Permalink
Browse files

[DBAL-243] Remove Connection#setCharset()

  • Loading branch information...
1 parent 7beb634 commit ab57a0105d107fd08936bff173345ff8aeb006e5 @beberlei beberlei committed Jul 5, 2012
Showing with 15 additions and 24 deletions.
  1. +15 −0 UPGRADE
  2. +0 −10 lib/Doctrine/DBAL/Connection.php
  3. +0 −14 lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View
15 UPGRADE
@@ -1,5 +1,20 @@
# Upgrade to 2.3
+## Doctrine\DBAL\Connection#setCharsetSQL() removed
+
+This method only worked on MySQL and it is considered unsafe on MySQL to use SET NAMES UTF-8 instead
+of setting the charset directly on connection already. Replace this behavior with the
+connection charset option:
+
+Before:
+
+ $conn = DriverManager::getConnection(array(..));
+ $conn->setCharset('UTF8');
+
+After:
+
+ $conn = DriverManager::getConnection(array('charset' => 'UTF8', ..));
+
## Doctrine\DBAL\Schema\Table#renameColumn() removed
Doctrine\DBAL\Schema\Table#renameColumn() was removed, because it drops and recreates
@@ -540,16 +540,6 @@ public function insert($tableName, array $data, array $types = array())
}
/**
- * Sets the given charset on the current connection.
- *
- * @param string $charset The charset to set.
- */
- public function setCharset($charset)
- {
- $this->executeUpdate($this->_platform->getSetCharsetSQL($charset));
- }
-
- /**
* Quote a string so it can be safely used as a table or column name, even if
* it is a reserved name.
*
@@ -2093,20 +2093,6 @@ public function convertBooleans($item)
}
/**
- * Gets the SQL statement specific for the platform to set the charset.
- *
- * This function is MySQL specific and required by
- * {@see \Doctrine\DBAL\Connection::setCharset($charset)}
- *
- * @param string $charset
- * @return string
- */
- public function getSetCharsetSQL($charset)
- {
- return "SET NAMES '".$charset."'";
- }
-
- /**
* Gets the SQL specific for the platform to get the current date.
*
* @return string

0 comments on commit ab57a01

Please sign in to comment.