]> git.pld-linux.org Git - packages/php.git/blob - php-pdo_mysql-charsetphpini.patch
- rediff
[packages/php.git] / php-pdo_mysql-charsetphpini.patch
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
4 small.
5
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
8 @@ -436,6 +436,7 @@
9         pdo_mysql_db_handle *H;
10         int i, ret = 0;
11         char *host = NULL, *unix_socket = NULL;
12 +       char *connect_charset = NULL;
13         unsigned int port = 3306;
14         char *dbname;
15         struct pdo_data_src_parser vars[] = {
16 @@ -731,6 +731,12 @@
17                 password_len = strlen(dbh->password);
18         }
19  
20 +       connect_charset = PDO_MYSQL_G(connect_charset);
21 +
22 +       if (connect_charset != NULL) {
23 +               mysql_options(H->server, MYSQL_SET_CHARSET_NAME, connect_charset);
24 +       }
25 +
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) {
28  #else
29 --- php-5.3.1/ext/pdo_mysql/pdo_mysql.c 2010-02-20 02:06:52.781846977 +0200
30 +++ php-5.3.1/ext/pdo_mysql/pdo_mysql.c 2010-02-20 02:06:52.781846977 +0200
31 @@ -44,10 +44,13 @@
32  # endif
33  #endif
34  
35 +#endif /* PDO_USE_MYSQLND */
36 +
37  
38  /* {{{ PHP_INI_BEGIN
39  */
40  PHP_INI_BEGIN()
41 +#if PDO_USE_MYSQLND
42  #ifndef PHP_WIN32
43         STD_PHP_INI_ENTRY("pdo_mysql.default_socket", PDO_MYSQL_UNIX_ADDR, PHP_INI_SYSTEM, OnUpdateString, default_socket, zend_pdo_mysql_globals, pdo_mysql_globals)
44  #endif
45 @@ -55,9 +58,10 @@
46         STD_PHP_INI_ENTRY("pdo_mysql.debug",    NULL, PHP_INI_SYSTEM, OnUpdateString, debug, zend_pdo_mysql_globals, pdo_mysql_globals)
47  #endif
48         STD_PHP_INI_ENTRY("pdo_mysql.cache_size",                       "2000", PHP_INI_SYSTEM,         OnUpdateLong,           cache_size,                     zend_pdo_mysql_globals,         pdo_mysql_globals)
49 +#endif
50 +       STD_PHP_INI_ENTRY("pdo_mysql.connect_charset",  NULL,   PHP_INI_ALL,    OnUpdateString, connect_charset,        zend_pdo_mysql_globals, pdo_mysql_globals)
51  PHP_INI_END()
52  /* }}} */
53 -#endif
54  
55  /* true global environment */
56  #ifdef PDO_USE_MYSQLND
57 @@ -69,9 +73,7 @@
58   */
59  static PHP_MINIT_FUNCTION(pdo_mysql)
60  {
61 -#if PDO_USE_MYSQLND
62         REGISTER_INI_ENTRIES();
63 -#endif
64  
65         REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_USE_BUFFERED_QUERY", (long)PDO_MYSQL_ATTR_USE_BUFFERED_QUERY);
66         REGISTER_PDO_CLASS_CONST_LONG("MYSQL_ATTR_LOCAL_INFILE", (long)PDO_MYSQL_ATTR_LOCAL_INFILE);    
67 @@ -101,8 +103,8 @@
68         php_pdo_unregister_driver(&pdo_mysql_driver);
69  #if PDO_USE_MYSQLND
70         mysqlnd_palloc_free_cache(pdo_mysqlnd_zval_cache);
71 -       UNREGISTER_INI_ENTRIES();
72  #endif
73 +       UNREGISTER_INI_ENTRIES();
74  
75         return SUCCESS;
76  }
77 @@ -133,9 +135,7 @@
78  #endif
79         php_info_print_table_end();
80  
81 -#ifdef PDO_USE_MYSQLND
82         DISPLAY_INI_ENTRIES();
83 -#endif
84  }
85  /* }}} */
86  
87 @@ -182,11 +182,14 @@
88  }
89  /* }}} */
90  
91 +#endif /* PDO_USE_MYSQLND */
92 +
93  
94  /* {{{ PHP_GINIT_FUNCTION
95   */
96  static PHP_GINIT_FUNCTION(pdo_mysql)
97  {
98 +#if PDO_USE_MYSQLND
99         pdo_mysql_globals->mysqlnd_thd_zval_cache = NULL; /* zval cache */
100         pdo_mysql_globals->cache_size = 0;
101  #ifndef PHP_WIN32
102 @@ -196,10 +199,10 @@
103         pdo_mysql_globals->debug = NULL;        /* The actual string */
104         pdo_mysql_globals->dbg = NULL;  /* The DBG object*/
105  #endif
106 +#endif /* PDO_USE_MYSQLND */
107 +       pdo_mysql_globals->connect_charset = NULL;
108  }
109  /* }}} */
110 -#endif
111 -
112  
113  /* {{{ pdo_mysql_functions[] */
114  const zend_function_entry pdo_mysql_functions[] = {
115 @@ -242,15 +245,11 @@
116  #endif
117         PHP_MINFO(pdo_mysql),
118         "1.0.2",
119 -#if PDO_USE_MYSQLND
120         PHP_MODULE_GLOBALS(pdo_mysql),
121         PHP_GINIT(pdo_mysql),
122         NULL,
123         NULL,
124         STANDARD_MODULE_PROPERTIES_EX
125 -#else
126 -       STANDARD_MODULE_PROPERTIES
127 -#endif
128  };
129  /* }}} */
130  
131 --- php-5.3.1/ext/pdo_mysql/php_pdo_mysql_int.h~        2009-10-14 16:51:25.000000000 +0300
132 +++ php-5.3.1/ext/pdo_mysql/php_pdo_mysql_int.h 2010-02-20 02:04:48.918516081 +0200
133 @@ -61,8 +61,8 @@
134  #include "ext/mysqlnd/mysqlnd_debug.h"
135  #endif
136  
137 -#ifdef PDO_USE_MYSQLND
138  ZEND_BEGIN_MODULE_GLOBALS(pdo_mysql)
139 +#ifdef PDO_USE_MYSQLND
140         MYSQLND_THD_ZVAL_PCACHE *mysqlnd_thd_zval_cache;
141         long          cache_size;
142  #ifndef PHP_WIN32
143 @@ -72,10 +72,11 @@
144         char          *debug; /* The actual string */
145         MYSQLND_DEBUG *dbg;     /* The DBG object */
146  #endif
147 +#endif /* PDO_USE_MYSQLND */
148 +       char          *connect_charset;
149  ZEND_END_MODULE_GLOBALS(pdo_mysql)
150  
151  ZEND_EXTERN_MODULE_GLOBALS(pdo_mysql);
152 -#endif
153  
154  #ifdef ZTS
155  #define PDO_MYSQL_G(v) TSRMG(pdo_mysql_globals_id, zend_pdo_mysql_globals *, v)
This page took 0.029886 seconds and 3 git commands to generate.