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.21 2004/04/16 12:12:46 grubba Exp $ +  * $Id: mysql.pike,v 1.22 2006/08/09 14:59:43 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)      inherit Mysql.mysql;    -  + //! Set to 1 if the connection is in utf8-mode. + static int unicode_mode; +    #if constant( Mysql.mysql.MYSQL_NO_ADD_DROP_DB )   // Documented in the C-file.   void create_db( string db )   {    ::big_query( "CREATE DATABASE "+db );   }      void drop_db( string db )   {    ::big_query( "DROP DATABASE "+db );
pike.git/lib/modules/Sql.pmod/mysql.pike:140: Inside #if constant(Mysql.mysql)
   if (n >= 12)    return decode_date (timestr[..n-7]) + decode_time (timestr[n-6..n-1]);    else    return decode_date (timestr);    }   }      //!   int|object big_query(string q, mapping(string|int:mixed)|void bindings)   { -  if (!bindings) +  if (bindings) +  q = .sql_util.emulate_bindings(q,bindings,this); +  if (unicode_mode) { +  int|object res = ::big_query(string_to_utf8(q)); +  if (!objectp(res)) return res; +  return .sql_util.UnicodeWrapper(res); +  }    return ::big_query(q); -  return ::big_query(.sql_util.emulate_bindings(q,bindings,this)); +    }         int(0..1) is_keyword( string name )   //! Return 1 if the argument @[name] is a mysql keyword.   {    return (<    "action", "add", "aggregate", "all", "alter", "after", "and", "as",    "asc", "avg", "avg_row_length", "auto_increment", "between", "bigint",    "bit", "binary", "blob", "bool", "both", "by", "cascade", "case",
pike.git/lib/modules/Sql.pmod/mysql.pike:190: Inside #if constant(Mysql.mysql)
   "sql_select_limit", "sql_small_result", "sql_big_result",    "sql_warnings", "straight_join", "starting", "status", "string",    "table", "tables", "temporary", "terminated", "text", "then", "time",    "timestamp", "tinyblob", "tinytext", "tinyint", "trailing", "to",    "type", "use", "using", "unique", "unlock", "unsigned", "update",    "usage", "values", "varchar", "variables", "varying", "varbinary",    "with", "write", "when", "where", "year", "year_month", "zerofill",    >)[ lower_case(name) ];   }    + static void create(string|void host, string|void database, +  string|void user, string|void password, +  mapping(string:string|int)|void options) + { +  if (options) { +  ::create(host||"", database||"", user||"", password||"", options); +  } else { +  ::create(host||"", database||"", user||"", password||""); +  } +  catch { +  big_query("SET NAMES 'utf8'"); +  unicode_mode = 1; +  }; + } +    #else   constant this_program_does_not_exist=1;   #endif /* constant(Mysql.mysql) */