pike.git/lib/modules/Sql.pmod/mysql.pike:59: Inside #if constant(Mysql.mysql)
#if constant(Mysql.mysql)
inherit Mysql.mysql;
#define UNICODE_DECODE_MODE 1 // Unicode decode mode
#define LATIN1_UNICODE_ENCODE_MODE 2 // Unicode encode mode with latin1 charset
#define UTF8_UNICODE_ENCODE_MODE 4 // Unicode encode mode with utf8 charset
#ifdef MYSQL_CHARSET_DEBUG
- #define CH_DEBUG(X...) werror("Sql.mysql: " + X)
+ #define CH_DEBUG(X...) \
+ werror(replace (sprintf ("%O", this), "%", "%%") + ": " + X)
#else
#define CH_DEBUG(X...)
#endif
#if !constant (Mysql.mysql.HAVE_MYSQL_FIELD_CHARSETNR)
// Recognition constant to tell that the unicode decode mode would use
// the buggy MySQLBrokenUnicodeWrapper if it would be enabled through
// any of the undocumented methods.
constant unicode_decode_mode_is_broken = 1;
#endif
pike.git/lib/modules/Sql.pmod/mysql.pike:699:
predef::error ("The query is a wide string " \
"and the MySQL server doesn't support UTF-8: %s\n", \
describe_error (err)); \
else \
throw (err); \
} \
send_charset = new_send_charset; \
} \
} \
\
- CH_DEBUG ("Sending query with charset %O: %O.\n", \
- charset || send_charset, query); \
+ CH_DEBUG ("Sending query with charset %O: %s.\n", \
+ charset || send_charset, \
+ (sizeof (query) > 200 ? \
+ sprintf ("%O...", query[..200]) : \
+ sprintf ("%O", query))); \
\
int|object res = ::do_query(query); \
\
if (restore_charset) { \
if (send_charset && (<"latin1", "utf8">)[charset]) \
send_charset = charset; \
else { \
CH_DEBUG ("Restoring charset %O.\n", restore_charset); \
::big_query ("SET character_set_client=" + restore_charset); \
/* Can't be changed automatically - has side effects. /mast */ \