svn: /php/php-src/trunk/ NEWS UPGRADING ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/php_pdo_mysql_int.h
| From: | Kalle Sommer Nielsen | Date: | Fri, 07 Jan 2011 14:39:56 +0000 |
| Subject: | svn: /php/php-src/trunk/ NEWS UPGRADING ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/php_pdo_mysql_int.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-64295@lists.php.net to get a copy of this message | ||
kalle Fri, 07 Jan 2011 14:39:56 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=307224
Log:
Implemented FR #47802, support for character sets in DSN strings for PDO_MYSQL
Bug: http://bugs.php.net/47802 (Open) PDO_MYSQL doesn't
use the charset parameter
Changed paths:
U php/php-src/trunk/NEWS
U php/php-src/trunk/UPGRADING
U php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
U php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h
Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS 2011-01-07 14:22:30 UTC (rev 307223)
+++ php/php-src/trunk/NEWS 2011-01-07 14:39:56 UTC (rev 307224)
@@ -170,6 +170,10 @@
. Added nextRowset support.
. Fixed bug #50755 (PDO DBLIB Fails with OOM).
+- Improved PDO MySQL:
+ . Implemented FR #47802 (Support for setting character sets in DSN strings).
+ (Kalle)
+
- Improved Reflection extension: (Johannes)
. Added ReflectionExtension::isTemporary() and
ReflectionExtension::isPersistent() methods.
Modified: php/php-src/trunk/UPGRADING
===================================================================
--- php/php-src/trunk/UPGRADING 2011-01-07 14:22:30 UTC (rev 307223)
+++ php/php-src/trunk/UPGRADING 2011-01-07 14:39:56 UTC (rev 307224)
@@ -161,6 +161,8 @@
strings. This breaks code that iterated the resulting stream array using a
numeric index, but makes easier to identify which of the passed streams are
present in the result.
+- pdo_mysql now supports setting character sets when connecting in the DSN
+ string.
===================================
Modified: php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/mysql_driver.c 2011-01-07 14:22:30 UTC (rev 307223)
+++ php/php-src/trunk/ext/pdo_mysql/mysql_driver.c 2011-01-07 14:39:56 UTC (rev 307224)
@@ -711,6 +711,13 @@
goto cleanup;
}
+#ifdef PDO_MYSQL_HAS_CHARSET
+ if (vars[0].optval && mysql_set_character_set(H->server, vars[0].optval)) {
+ pdo_mysql_error(dbh);
+ goto cleanup;
+ }
+#endif
+
if (!dbh->auto_commit) {
mysql_handle_autocommit(dbh TSRMLS_CC);
}
Modified: php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h 2011-01-07 14:22:30 UTC (rev 307223)
+++ php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h 2011-01-07 14:39:56 UTC (rev 307224)
@@ -33,6 +33,10 @@
# define PDO_MYSQL_PARAM_BIND MYSQL_BIND
#endif
+#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >=
50007 || defined(MYSQL_USE_MYSQLND)
+# define PDO_MYSQL_HAS_CHARSET
+#endif
+
#if defined(PDO_USE_MYSQLND) && PHP_DEBUG && !defined(PHP_WIN32)
#define PDO_DBG_ENABLED 1