Commit fe63e095 authored by unknown's avatar unknown
Browse files

Inefficient usage of String::append() fixed.

Bad examples of usage of a string with its length fixed.
The incorrect length in the trigger file configuration descriptor
  fixed (BUG#14090).
A hook for unknown keys added to the parser to support old .TRG files.


sql/field.cc:
  Inefficient usage of String::append() fixed.
  Bad examples of usage of a string with its length fixed.
sql/ha_berkeley.cc:
  A bad example of usage of a string with its length fixed.
sql/ha_federated.cc:
  Inefficient usage of String::append() fixed.
sql/ha_myisammrg.cc:
  Bad examples of usage of a string with its length fixed.
sql/handler.cc:
  Inefficient usage of String::append() fixed.
sql/item.cc:
  Bad examples of usage of a string with its length fixed.
sql/item.h:
  A bad example of usage of a string with its length fixed.
sql/item_cmpfunc.cc:
  Bad examples of usage of a string with its length fixed.
sql/item_func.cc:
  Bad examples of usage of a string with its length fixed.
sql/item_strfunc.cc:
  Bad examples of usage of a string with its length fixed.
sql/item_subselect.cc:
  Bad examples of usage of a string with its length fixed.
sql/item_sum.cc:
  Bad examples of usage of a string with its length fixed.
  Inefficient usage of String::append() fixed.
sql/item_timefunc.cc:
  Inefficient using of String::append() fixed.
  Bad examples of usage of a string with its length fixed.
sql/item_uniq.h:
  Bad examples of usage of a string with its length fixed.
sql/key.cc:
  Bad examples of usage of a string with its length fixed.
sql/log.cc:
  Bad examples of usage of a string with its length fixed.
sql/log_event.cc:
  Bad examples of usage of a string with its length fixed.
sql/mysqld.cc:
  The dummy parser hook allocated.
sql/opt_range.cc:
  Inefficient usage of String::append() fixed.
sql/parse_file.cc:
  Bad examples of usage of a string with its length fixed.
  A hook for unknown keys added to the parser.
sql/parse_file.h:
  A hook for unknown keys added to the parser.
sql/protocol.cc:
  A bad example of usage of a string with its length fixed.
sql/repl_failsafe.cc:
  Bad examples of usage of a string with its length fixed.
sql/share/errmsg.txt:
  A warning for old format config file.
sql/slave.cc:
  Bad examples of usage of a string with its length fixed.
sql/sp.cc:
  Bad examples of usage of a string with its length fixed.
sql/sp_head.cc:
  Bad examples of usage of a string with its length fixed.
sql/spatial.cc:
  A bad example of usage of a string with its length fixed.
sql/sql_acl.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_analyse.cc:
  Bad examples of usage of a string with its length fixed.
  Inefficient usage of String::append() fixed.
sql/sql_lex.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_load.cc:
  A bad example of usage of a string with its length fixed.
sql/sql_parse.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_prepare.cc:
  A bad example of usage of a string with its length fixed.
sql/sql_select.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_show.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_string.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_string.h:
  The macro definition moved to sql_string.h to
    be accessible in all parts of server.
sql/sql_table.cc:
  Bad examples of usage of a string with its length fixed.
sql/sql_trigger.cc:
  Bad examples of usage of a string with its length fixed.
  The incorrect length in the trigger file configuration descriptor
    fixed (BUG#14090).
  The hook for processing incorrect sql_mode record added.
sql/sql_view.cc:
  A dummy  hook used for parsing views.
sql/structs.h:
  The macro definition moved to sql_string.h to be
    accessible in all parts of server.
sql/table.cc:
  A bad example of usage of a string with its length fixed.
sql/tztime.cc:
  A bad example of usage of a string with its length fixed.
parent 5d425f93
Loading
Loading
Loading
Loading
+26 −26
Original line number Diff line number Diff line
@@ -1272,9 +1272,9 @@ my_decimal *Field::val_decimal(my_decimal *decimal)
void Field_num::add_zerofill_and_unsigned(String &res) const
{
  if (unsigned_flag)
    res.append(" unsigned");
    res.append(STRING_WITH_LEN(" unsigned"));
  if (zerofill)
    res.append(" zerofill");
    res.append(STRING_WITH_LEN(" zerofill"));
}


@@ -1655,7 +1655,7 @@ bool Field::needs_quotes(void)

void Field_null::sql_type(String &res) const
{
  res.set_ascii("null", 4);
  res.set_ascii(STRING_WITH_LEN("null"));
}


@@ -1667,7 +1667,7 @@ void Field_null::sql_type(String &res) const
void
Field_decimal::reset(void)
{
  Field_decimal::store("0",1,&my_charset_bin);
  Field_decimal::store(STRING_WITH_LEN("0"),&my_charset_bin);
}

void Field_decimal::overflow(bool negative)
@@ -4113,7 +4113,7 @@ void Field_float::sql_type(String &res) const
{
  if (dec == NOT_FIXED_DEC)
  {
    res.set_ascii("float", 5);
    res.set_ascii(STRING_WITH_LEN("float"));
  }
  else
  {
@@ -4384,7 +4384,7 @@ void Field_double::sql_type(String &res) const
  CHARSET_INFO *cs=res.charset();
  if (dec == NOT_FIXED_DEC)
  {
    res.set_ascii("double",6);
    res.set_ascii(STRING_WITH_LEN("double"));
  }
  else
  {
@@ -4673,7 +4673,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)

  if (temp == 0L)
  {				      /* Zero time is "000000" */
    val_ptr->set("0000-00-00 00:00:00", 19, &my_charset_bin);
    val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_bin);
    return val_ptr;
  }
  val_buffer->set_charset(&my_charset_bin);	// Safety
@@ -4805,7 +4805,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))

void Field_timestamp::sql_type(String &res) const
{
  res.set_ascii("timestamp", 9);
  res.set_ascii(STRING_WITH_LEN("timestamp"));
}


@@ -5074,7 +5074,7 @@ void Field_time::sort_string(char *to,uint length __attribute__((unused)))

void Field_time::sql_type(String &res) const
{
  res.set_ascii("time", 4);
  res.set_ascii(STRING_WITH_LEN("time"));
}

/****************************************************************************
@@ -5381,7 +5381,7 @@ void Field_date::sort_string(char *to,uint length __attribute__((unused)))

void Field_date::sql_type(String &res) const
{
  res.set_ascii("date", 4);
  res.set_ascii(STRING_WITH_LEN("date"));
}


@@ -5564,7 +5564,7 @@ void Field_newdate::sort_string(char *to,uint length __attribute__((unused)))

void Field_newdate::sql_type(String &res) const
{
  res.set_ascii("date", 4);
  res.set_ascii(STRING_WITH_LEN("date"));
}


@@ -5838,7 +5838,7 @@ void Field_datetime::sort_string(char *to,uint length __attribute__((unused)))

void Field_datetime::sql_type(String &res) const
{
  res.set_ascii("datetime", 8);
  res.set_ascii(STRING_WITH_LEN("datetime"));
}

/****************************************************************************
@@ -6061,7 +6061,7 @@ void Field_string::sql_type(String &res) const
  res.length(length);
  if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
      has_charset() && (charset()->state & MY_CS_BINSORT))
    res.append(" binary");
    res.append(STRING_WITH_LEN(" binary"));
}


@@ -6454,7 +6454,7 @@ void Field_varstring::sql_type(String &res) const
  res.length(length);
  if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
      has_charset() && (charset()->state & MY_CS_BINSORT))
    res.append(" binary");
    res.append(STRING_WITH_LEN(" binary"));
}


@@ -7174,10 +7174,10 @@ void Field_blob::sql_type(String &res) const
  }
  res.set_ascii(str,length);
  if (charset() == &my_charset_bin)
    res.append("blob");
    res.append(STRING_WITH_LEN("blob"));
  else
  {
    res.append("text");
    res.append(STRING_WITH_LEN("text"));
  }
}

@@ -7397,28 +7397,28 @@ void Field_geom::sql_type(String &res) const
  switch (geom_type)
  {
    case GEOM_POINT:
     res.set("point", 5, cs);
     res.set(STRING_WITH_LEN("point"), cs);
     break;
    case GEOM_LINESTRING:
     res.set("linestring", 10, cs);
     res.set(STRING_WITH_LEN("linestring"), cs);
     break;
    case GEOM_POLYGON:
     res.set("polygon", 7, cs);
     res.set(STRING_WITH_LEN("polygon"), cs);
     break;
    case GEOM_MULTIPOINT:
     res.set("multipoint", 10, cs);
     res.set(STRING_WITH_LEN("multipoint"), cs);
     break;
    case GEOM_MULTILINESTRING:
     res.set("multilinestring", 15, cs);
     res.set(STRING_WITH_LEN("multilinestring"), cs);
     break;
    case GEOM_MULTIPOLYGON:
     res.set("multipolygon", 12, cs);
     res.set(STRING_WITH_LEN("multipolygon"), cs);
     break;
    case GEOM_GEOMETRYCOLLECTION:
     res.set("geometrycollection", 18, cs);
     res.set(STRING_WITH_LEN("geometrycollection"), cs);
     break;
    default:
     res.set("geometry", 8, cs);
     res.set(STRING_WITH_LEN("geometry"), cs);
  }
}

@@ -7695,7 +7695,7 @@ void Field_enum::sql_type(String &res) const
  String enum_item(buffer, sizeof(buffer), res.charset());

  res.length(0);
  res.append("enum(");
  res.append(STRING_WITH_LEN("enum("));

  bool flag=0;
  uint *len= typelib->type_lengths;
@@ -7809,7 +7809,7 @@ void Field_set::sql_type(String &res) const
  String set_item(buffer, sizeof(buffer), res.charset());

  res.length(0);
  res.append("set(");
  res.append(STRING_WITH_LEN("set("));

  bool flag=0;
  uint *len= typelib->type_lengths;
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ int berkeley_show_logs(Protocol *protocol)
    {
      protocol->prepare_for_resend();
      protocol->store(*a, system_charset_info);
      protocol->store("BDB", 3, system_charset_info);
      protocol->store(STRING_WITH_LEN("BDB"), system_charset_info);
      if (f && *f && strcmp(*a, *f) == 0)
      {
	f++;
+2 −2
Original line number Diff line number Diff line
@@ -2627,9 +2627,9 @@ bool ha_federated::get_error_message(int error, String* buf)
  DBUG_PRINT("enter", ("error: %d", error));
  if (error == HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM)
  {
    buf->append("Error on remote system: ");
    buf->append(STRING_WITH_LEN("Error on remote system: "));
    buf->qs_append(remote_error_number);
    buf->append(": ");
    buf->append(STRING_WITH_LEN(": "));
    buf->append(remote_error_buf, FEDERATED_QUERY_BUFFER_SIZE);

    remote_error_number= 0;
+2 −2
Original line number Diff line number Diff line
@@ -490,10 +490,10 @@ void ha_myisammrg::append_create_info(String *packet)

  if (file->merge_insert_method != MERGE_INSERT_DISABLED)
  {
    packet->append(" INSERT_METHOD=",15);
    packet->append(STRING_WITH_LEN(" INSERT_METHOD="));
    packet->append(get_type(&merge_insert_method,file->merge_insert_method-1));
  }
  packet->append(" UNION=(",8);
  packet->append(STRING_WITH_LEN(" UNION=("));
  MYRG_TABLE *open_table,*first;

  current_db= table->s->db;
+1 −1
Original line number Diff line number Diff line
@@ -1684,7 +1684,7 @@ void handler::print_error(int error, myf errflag)
      if (str.length() >= max_length)
      {
	str.length(max_length-4);
	str.append("...");
	str.append(STRING_WITH_LEN("..."));
      }
      my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), key_nr+1);
      DBUG_VOID_RETURN;
Loading