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

version» Context lines:

pike.git/lib/modules/Sql.pmod/mysql.pike:1:   /* -  * $Id: mysql.pike,v 1.30 2006/12/03 16:47:20 nilsson Exp $ +  * $Id: mysql.pike,v 1.31 2006/12/05 11:48:21 grubba Exp $    *    * Glue for the Mysql-module    */      //! Implements the glue needed to access the Mysql-module from the generic   //! SQL module.      #pike __REAL_VERSION__      #if constant(Mysql.mysql)
pike.git/lib/modules/Sql.pmod/mysql.pike:129:      int get_unicode_encode_mode()   //! Returns nonzero if unicode encode mode is enabled, zero otherwise.   //!   //! @seealso   //! @[set_unicode_encode_mode]   {    return !!send_charset;   }    - #if constant (Mysql.mysql.HAVE_MYSQL_FIELD_CHARSETNR) +    void set_unicode_decode_mode (int enable) - #else - //! @ignore - static void broken_set_unicode_decode_mode (int enable) - //! @endignore - #endif +    //! Enable or disable unicode decode mode.   //!   //! In this mode, if the server supports UTF-8 then non-binary text   //! strings in results are automatically decoded to (possibly wide)   //! unicode strings. Not enabled by default.   //!   //! The statement "@expr{SET character_set_results = utf8@}" is sent   //! to the server to enable the mode. When the mode is disabled,   //! "@expr{SET character_set_results = xxx@}" is sent, where   //! @expr{xxx@} is the connection charset that @[get_charset] returns.
pike.git/lib/modules/Sql.pmod/mysql.pike:157:   //! @param enable   //! Nonzero enables this feature, zero disables it.   //!   //! @throws   //! Throws an exception if the server doesn't support this, i.e. if   //! the statement above fails. The MySQL system variable   //! @expr{character_set_results@} was added in MySQL 4.1.1.   //!   //! @note   //! This function is only available if Pike has been compiled with - //! MySQL client library 4.1.0 or later. + //! MySQL client library 4.1.0 or later, or if the environment + //! variable @tt{PIKE_BROKEN_MYSQL_UNICODE_MODE@} is set.   //!   //! @seealso   //! @[set_unicode_encode_mode]   { -  + #if !constant (Mysql.mysql.HAVE_MYSQL_FIELD_CHARSETNR) +  if (!getenv("PIKE_BROKEN_MYSQL_UNICODE_MODE")) { +  predef::error("set_unicode_decode_mode not available.\n"); +  } + #endif    if (enable) {    CH_DEBUG("Enabling unicode decode mode.\n");    ::big_query ("SET character_set_results = utf8");    utf8_mode |= UNICODE_DECODE_MODE;    }    else {    CH_DEBUG("Disabling unicode decode mode.\n");    ::big_query ("SET character_set_results = " + get_charset());    utf8_mode &= ~UNICODE_DECODE_MODE;    }   }    - #if !constant (Mysql.mysql.HAVE_MYSQL_FIELD_CHARSETNR) - // See blurb at MySQLBrokenUnicodeWrapper in sql_util.pmod. The - // PIKE_BROKEN_MYSQL_UNICODE_MODE thingy ought to be a define, but - // it's an environment variable instead to avoid problems with - // overcaching in dumped files. - function(int:void) set_unicode_decode_mode = -  getenv ("PIKE_BROKEN_MYSQL_UNICODE_MODE") && -  broken_set_unicode_decode_mode; - #endif -  +    int get_unicode_decode_mode()   //! Returns nonzero if unicode decode mode is enabled, zero otherwise.   //!   //! @seealso   //! @[set_unicode_decode_mode]   {    return utf8_mode & UNICODE_DECODE_MODE;   }      void set_charset (string charset)