Skip to content

Commit

Permalink
Implemented FR #47802, support for character sets in DSN strings for …
Browse files Browse the repository at this point in the history
…PDO_MYSQL
  • Loading branch information
KalleZ committed Jan 7, 2011
1 parent 5549e06 commit e4c36b0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ PHP NEWS
. 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.
Expand Down
2 changes: 2 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ UPGRADE NOTES - PHP X.Y
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.


===================================
Expand Down
7 changes: 7 additions & 0 deletions ext/pdo_mysql/mysql_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,13 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
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);
}
Expand Down
4 changes: 4 additions & 0 deletions ext/pdo_mysql/php_pdo_mysql_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e4c36b0

Please sign in to comment.