The patch doesnt change anything for me right now. the "old" mysql i was running was 5.0.70, not 5.0.7 ;-). So I do have mysql_set_character_set and pike is using it. The library sends an SET NAMES utf8 when using set_charset("unicode"). After the reconnect it sends a SET character_set_client=latin1.
I think the reason for this is, that set_charset() does not change PIKE_MYSQL->conn_charset accordingly. I guess its different when I create the sql object with the appropriate options without changing the charset later on.
arne
Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
Hmm, ok. Could you please try this patch without upgrading instead? That way I can verify that it fixes the problem.
Index: src/modules/Mysql/mysql.c
RCS file: /pike/data/cvsroot/Pike/7.8/src/modules/Mysql/mysql.c,v retrieving revision 1.119 diff -u -r1.119 mysql.c --- src/modules/Mysql/mysql.c 5 Nov 2009 14:15:15 -0000 1.119 +++ src/modules/Mysql/mysql.c 14 Nov 2009 18:26:17 -0000 @@ -157,6 +157,9 @@ #define MYSQL_DISALLOW() #endif /* _REENTRANT */
+#define PIKE_MYSQL_FLAG_STORE_RESULT 1 +#define PIKE_MYSQL_FLAG_TYPED_RESULT 2
#define CHECK_8BIT_NONBINARY_STRING(FUNC, ARG) do { \ if (sp[ARG-1-args].type != T_STRING || \ sp[ARG-1-args].u.string->size_shift || \ @@ -357,6 +360,8 @@ #endif /* HAVE_MYSQL_OPTIONS */ }
+static void low_query(INT32 args, char *name, int flags);
static void pike_mysql_reconnect (int reconnect) { MYSQL *mysql = PIKE_MYSQL->mysql; @@ -488,6 +493,17 @@ } } }
+#ifndef HAVE_MYSQL_SET_CHARACTER_SET
- if (PIKE_MYSQL->conn_charset) {
- push_constant_text ("SET NAMES '");
- ref_push_string (PIKE_MYSQL->conn_charset);
- push_constant_text ("'");
- f_add (3);
- low_query (1, "reconnect", PIKE_MYSQL_FLAG_STORE_RESULT);
- pop_stack();
- }
+#endif }
/* @@ -861,9 +877,6 @@ pop_n_elems(args); }
-#define PIKE_MYSQL_FLAG_STORE_RESULT 1 -#define PIKE_MYSQL_FLAG_TYPED_RESULT 2
static void low_query(INT32 args, char *name, int flags) { MYSQL *mysql = PIKE_MYSQL->mysql;