Commit c92b025b authored by unknown's avatar unknown
Browse files

BUG#17138: Crashes in stored procedure

Last round of review fixes


BUILD/compile-pentium-gcov:
  No change
sql/ha_ndbcluster.h:
  Last round of review changes
sql/ha_partition.h:
  Last round of review changes
sql/handler.h:
  Last round of review changes
sql/item_sum.cc:
  Last round of review changes
sql/sql_acl.cc:
  Last round of review changes
sql/sql_insert.cc:
  Last round of review changes
sql/sql_select.cc:
  Last round of review changes
sql/sql_table.cc:
  Last round of review changes
sql/sql_union.cc:
  Last round of review changes
sql/sql_update.cc:
  Last round of review changes
parent bf723783
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -656,9 +656,8 @@ class ha_ndbcluster: public handler
  void set_auto_partitions(partition_info *part_info);
  virtual bool is_fatal_error(int error, uint flags)
  {
    if (!handler::is_fatal_error(error, flags))
      return FALSE;
    if (error == HA_ERR_NO_PARTITION_FOUND)
    if (!handler::is_fatal_error(error, flags) ||
        error == HA_ERR_NO_PARTITION_FOUND)
      return FALSE;
    return TRUE;
  }
+2 −3
Original line number Diff line number Diff line
@@ -304,9 +304,8 @@ class ha_partition :public handler

  virtual bool is_fatal_error(int error, uint flags)
  {
    if (!handler::is_fatal_error(error, flags))
      return FALSE;
    if (error == HA_ERR_NO_PARTITION_FOUND)
    if (!handler::is_fatal_error(error, flags) ||
        error == HA_ERR_NO_PARTITION_FOUND)
      return FALSE;
    return TRUE;
  }
+8 −6
Original line number Diff line number Diff line
@@ -235,6 +235,11 @@
/* Options of START TRANSACTION statement (and later of SET TRANSACTION stmt) */
#define MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT 1

/* Flags for method is_fatal_error */
#define HA_CHECK_DUP_KEY 1
#define HA_CHECK_DUP_UNIQUE 2
#define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE)

enum legacy_db_type
{
  DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,
@@ -972,17 +977,14 @@ class handler :public Sql_alloc
    ignorable than others. E.g. the partition handler can get inserts
    into a range where there is no partition and this is an ignorable
    error.
    HA_ERR_FOUND_DUPP_UNIQUE is a special case in MyISAM that means the
    same thing as HA_ERR_FOUND_DUPP_KEY but can in some cases lead to
    HA_ERR_FOUND_DUP_UNIQUE is a special case in MyISAM that means the
    same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to
    a slightly different error message.
  */
#define HA_CHECK_DUPP_KEY 1
#define HA_CHECK_DUPP_UNIQUE 2
#define HA_CHECK_DUPP (HA_CHECK_DUPP_KEY + HA_CHECK_DUPP_UNIQUE)
  virtual bool is_fatal_error(int error, uint flags)
  {
    if (!error ||
        ((flags & HA_CHECK_DUPP_KEY) &&
        ((flags & HA_CHECK_DUP_KEY) &&
         (error == HA_ERR_FOUND_DUPP_KEY ||
          error == HA_ERR_FOUND_DUPP_UNIQUE)))
      return FALSE;
+1 −1
Original line number Diff line number Diff line
@@ -2663,7 +2663,7 @@ bool Item_sum_count_distinct::add()
    return tree->unique_add(table->record[0] + table->s->null_bytes);
  }
  if ((error= table->file->ha_write_row(table->record[0])) &&
      table->file->is_fatal_error(error, HA_CHECK_DUPP))
      table->file->is_fatal_error(error, HA_CHECK_DUP))
    return TRUE;
  return FALSE;
}
+4 −4
Original line number Diff line number Diff line
@@ -2049,7 +2049,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
  }
  else if ((error=table->file->ha_write_row(table->record[0]))) // insert
  {						// This should never happen
    if (table->file->is_fatal_error(error, HA_CHECK_DUPP))
    if (table->file->is_fatal_error(error, HA_CHECK_DUP))
    {
      table->file->print_error(error,MYF(0));	/* purecov: deadcode */
      error= -1;				/* purecov: deadcode */
@@ -2171,7 +2171,7 @@ static int replace_db_table(TABLE *table, const char *db,
  }
  else if (rights && (error= table->file->ha_write_row(table->record[0])))
  {
    if (table->file->is_fatal_error(error, HA_CHECK_DUPP_KEY))
    if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
      goto table_error; /* purecov: deadcode */
  }

@@ -2743,7 +2743,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
  else
  {
    error=table->file->ha_write_row(table->record[0]);
    if (table->file->is_fatal_error(error, HA_CHECK_DUPP_KEY))
    if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
      goto table_error;				/* purecov: deadcode */
  }

@@ -2861,7 +2861,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name,
  else
  {
    error=table->file->ha_write_row(table->record[0]);
    if (table->file->is_fatal_error(error, HA_CHECK_DUPP_KEY))
    if (table->file->is_fatal_error(error, HA_CHECK_DUP_KEY))
      goto table_error;
  }

Loading