mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
/*
|
||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -11,8 +12,8 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* Insert of records */
|
||||
|
||||
@@ -62,6 +63,8 @@
|
||||
#include "slave.h"
|
||||
#include "rpl_mi.h"
|
||||
|
||||
#include "debug_sync.h"
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static bool delayed_get_table(THD *thd, TABLE_LIST *table_list);
|
||||
static int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
|
||||
@@ -662,7 +665,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
lock_type= table_list->lock_type;
|
||||
|
||||
thd_proc_info(thd, "init");
|
||||
thd->used_tables=0;
|
||||
thd->lex->used_tables=0;
|
||||
values= its++;
|
||||
value_count= values->elements;
|
||||
|
||||
@@ -813,7 +816,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (thd->used_tables) // Column used in values()
|
||||
if (thd->lex->used_tables) // Column used in values()
|
||||
restore_record(table,s->default_values); // Get empty record
|
||||
else
|
||||
{
|
||||
@@ -1481,6 +1484,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
error= HA_ERR_FOUND_DUPP_KEY; /* Database can't find key */
|
||||
goto err;
|
||||
}
|
||||
DEBUG_SYNC(thd, "write_row_replace");
|
||||
|
||||
/* Read all columns for the row we are going to replace */
|
||||
table->use_all_columns();
|
||||
/*
|
||||
@@ -1675,6 +1680,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
}
|
||||
else if ((error=table->file->ha_write_row(table->record[0])))
|
||||
{
|
||||
DEBUG_SYNC(thd, "write_row_noreplace");
|
||||
if (!info->ignore ||
|
||||
table->file->is_fatal_error(error, HA_CHECK_DUP))
|
||||
goto err;
|
||||
@@ -3207,6 +3213,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||
if (!res)
|
||||
prepare_triggers_for_insert_stmt(table);
|
||||
|
||||
lex->current_select->no_error= lex->ignore;
|
||||
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
@@ -3898,7 +3906,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
||||
|
||||
if (table->s->fields < values.elements)
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1);
|
||||
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user