1 This is damn ugly patch if you need to update it, see PHP_5_2 branch version to
2 understand what this patch is supposed to do as in 5.3 the ini section is
3 enabled only if mysqlnd driver is enabled which makes the contexts really
6 --- php-5.3.1/ext/pdo_mysql/mysql_driver.c~ 2010-02-20 01:08:04.000000000 +0200
7 +++ php-5.3.1/ext/pdo_mysql/mysql_driver.c 2010-02-20 01:08:52.982186037 +0200
9 pdo_mysql_db_handle *H;
11 char *host = NULL, *unix_socket = NULL;
12 + char *connect_charset = NULL;
13 unsigned int port = 3306;
15 struct pdo_data_src_parser vars[] = {
17 password_len = strlen(dbh->password);
20 + connect_charset = PDO_MYSQL_G(connect_charset);
22 + if (connect_charset != NULL) {
23 + mysql_options(H->server, MYSQL_SET_CHARSET_NAME, connect_charset);
26 if (mysqlnd_connect(H->server, host, dbh->username, dbh->password, password_len, dbname, dbname_len,
27 port, unix_socket, connect_opts, PDO_MYSQL_G(mysqlnd_thd_zval_cache) TSRMLS_CC) == NULL) {
29 --- php-5.3.3/ext/pdo_mysql/pdo_mysql.c~ 2010-07-24 19:23:14.000000000 +0300
30 +++ php-5.3.3/ext/pdo_mysql/pdo_mysql.c 2010-07-24 19:24:48.363581841 +0300
33 STD_PHP_INI_ENTRY("pdo_mysql.debug", NULL, PHP_INI_SYSTEM, OnUpdateString, debug, zend_pdo_mysql_globals, pdo_mysql_globals)
35 + STD_PHP_INI_ENTRY("pdo_mysql.connect_charset", NULL, PHP_INI_ALL, OnUpdateString, connect_charset, zend_pdo_mysql_globals, pdo_mysql_globals)
40 static PHP_MSHUTDOWN_FUNCTION(pdo_mysql)
42 php_pdo_unregister_driver(&pdo_mysql_driver);
44 UNREGISTER_INI_ENTRIES();
50 pdo_mysql_globals->debug = NULL; /* The actual string */
51 pdo_mysql_globals->dbg = NULL; /* The DBG object*/
53 + pdo_mysql_globals->connect_charset = NULL;
57 --- php-5.3.2RC3/ext/pdo_mysql/php_pdo_mysql_int.h~ 2010-02-04 11:37:38.000000000 +0200
58 +++ php-5.3.2RC3/ext/pdo_mysql/php_pdo_mysql_int.h 2010-02-26 19:11:47.484055898 +0200
60 char *debug; /* The actual string */
61 MYSQLND_DEBUG *dbg; /* The DBG object */
63 + char *connect_charset;
64 #if defined(PHP_WIN32) && !PDO_DBG_ENABLED
65 /* dummy member so we get at least one member in the struct
66 * and avoids build errors.