~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_class.cc

  • Committer: Andrey Hristov
  • Date: 2008-08-06 00:04:45 UTC
  • mto: (264.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 266.
  • Revision ID: ahristov@mysql.com-20080806000445-84urmltikgwk9v5d
Constify the usage of CHARSET_INFO almost to the last place in the code.
99% of the parameters are const CHARSET_INFO * const cs.
Wherever possible stack variables are also double consted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1045
1045
        In this case to->str will point to 0 and to->length will be 0.
1046
1046
*/
1047
1047
 
1048
 
bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
 
1048
bool THD::convert_string(LEX_STRING *to, const CHARSET_INFO * const to_cs,
1049
1049
                         const char *from, uint from_length,
1050
 
                         CHARSET_INFO *from_cs)
 
1050
                         const CHARSET_INFO * const from_cs)
1051
1051
{
1052
1052
  size_t new_length= to_cs->mbmaxlen * from_length;
1053
1053
  uint dummy_errors;
1078
1078
   !0   out of memory
1079
1079
*/
1080
1080
 
1081
 
bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
 
1081
bool THD::convert_string(String *s, const CHARSET_INFO * const from_cs,
 
1082
                         const CHARSET_INFO * const to_cs)
1082
1083
{
1083
1084
  uint dummy_errors;
1084
1085
  if (convert_buffer.copy(s->ptr(), s->length(), from_cs, to_cs, &dummy_errors))
1195
1196
{
1196
1197
  List<Item> field_list;
1197
1198
  Item *item;
1198
 
  CHARSET_INFO *cs= system_charset_info;
 
1199
  const CHARSET_INFO * const cs= system_charset_info;
1199
1200
  field_list.push_back(new Item_return_int("id",3, DRIZZLE_TYPE_LONGLONG));
1200
1201
  field_list.push_back(new Item_empty_string("select_type", 19, cs));
1201
1202
  field_list.push_back(item= new Item_empty_string("table", NAME_CHAR_LEN, cs));
1726
1727
           escape_char != -1)
1727
1728
      {
1728
1729
        char *pos, *start, *end;
1729
 
        CHARSET_INFO *res_charset= res->charset();
1730
 
        CHARSET_INFO *character_set_client= thd->variables.
1731
 
                                            character_set_client;
 
1730
        const CHARSET_INFO * const res_charset= res->charset();
 
1731
        const CHARSET_INFO * const character_set_client= thd->variables.
 
1732
                                                            character_set_client;
1732
1733
        bool check_second_byte= (res_charset == &my_charset_bin) &&
1733
1734
                                 character_set_client->
1734
1735
                                 escape_with_backslash_is_dangerous;
2384
2385
 
2385
2386
 
2386
2387
#ifdef INNODB_COMPATIBILITY_HOOKS
2387
 
extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd)
 
2388
extern "C" const struct charset_info_st *thd_charset(MYSQL_THD thd)
2388
2389
{
2389
2390
  return(thd->charset());
2390
2391
}