pike.git / lib / modules / Sql.pmod / mysql.pike

version» Context lines:

pike.git/lib/modules/Sql.pmod/mysql.pike:417:    "\x84": "\u201E", "\x85": "\u2026", "\x86": "\u2020", "\x87": "\u2021",    "\x88": "\u02C6", "\x89": "\u2030", "\x8a": "\u0160", "\x8b": "\u2039",    "\x8c": "\u0152", /*"\x8d": "\u008D",*/ "\x8e": "\u017D", /*"\x8f": "\u008F",*/    /*"\x90": "\u0090",*/ "\x91": "\u2018", "\x92": "\u2019", "\x93": "\u201C",    "\x94": "\u201D", "\x95": "\u2022", "\x96": "\u2013", "\x97": "\u2014",    "\x98": "\u02DC", "\x99": "\u2122", "\x9a": "\u0161", "\x9b": "\u203A",    "\x9c": "\u0153", /*"\x9d": "\u009D",*/ "\x9e": "\u017E", "\x9f": "\u0178",    ])));   }    - string utf8_encode_query (string q, function(string:string) encode_fn) + string utf8_encode_query (string q, +  function(string, mixed|void...:string) encode_fn, +  mixed ... extras)   //! Encodes the appropriate sections of the query with @[encode_fn].   //! Everything except strings prefixed by an introducer (i.e.   //! @expr{_something@} or @expr{N@}) is encoded.   {    // We need to find the segments that shouldn't be encoded.    string e = "";    while (1) {    sscanf(q, "%[^\'\"]%s", string prefix, string suffix); -  e += encode_fn (prefix); +  e += encode_fn (prefix, @extras);       if (suffix == "") break;       string quote = suffix[..0];    int start = 1;    int end;    while ((end = search(suffix, quote, start)) >= 0) {    if (suffix[end-1] == '\\') {    // Count the number of preceding back-slashes.    // if odd, continue searching after the quote.
pike.git/lib/modules/Sql.pmod/mysql.pike:522:    else    encoding = "utf8"; // Gotta be "N".    s = s[1..<1];    if (sizeof (s) > 40) s = sprintf ("%O...", s[..37]);    else s = sprintf ("%O", s);    predef::error ("A string in the query should be %s encoded "    "but it is wide: %s\n", encoding, s);    }    e += s;    } else { -  e += encode_fn (suffix[..end]); +  e += encode_fn (suffix[..end], @extras);    }       q = suffix[end+1..];    }    return e;   }      //! Converts a system time value to an appropriately formatted time   //! spec for the database.   //!
pike.git/lib/modules/Sql.pmod/mysql.pike:609:    } \    \    else { /* utf8_mode & UTF8_UNICODE_ENCODE_MODE */ \    /* NB: The send_charset may only be upgraded from \    * "latin1" to "utf8", not the other way around. \    * This is to avoid extraneous charset changes \    * where the charset is changed from query to query. \    */ \    if ((send_charset == "utf8") || !_can_send_as_latin1(query)) { \    CH_DEBUG ("Converting query to utf8.\n"); \ -  query = utf8_encode_query (query, string_to_utf8); \ +  query = utf8_encode_query (query, string_to_utf8, 2); \    new_send_charset = "utf8"; \    } \    } \    \    if (new_send_charset != send_charset) { \    CH_DEBUG ("Switching charset from %O to %O.\n", \    send_charset, new_send_charset); \    if (mixed err = catch { \    ::big_query ("SET character_set_client=" + new_send_charset); \    /* Can't be changed automatically - has side effects. /mast */ \