Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-02-28 16:13:18+02:00, gkodinov@stripped +3 -0
Merge gkodinov@stripped:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B26261-5.0-opt
MERGE: 1.2411.8.1
sql/mysql_priv.h@stripped, 2007-02-28 16:13:15+02:00, gkodinov@stripped +0 -0
Auto merged
MERGE: 1.429.7.3
sql/sql_insert.cc@stripped, 2007-02-28 16:13:15+02:00, gkodinov@stripped +0 -0
Auto merged
MERGE: 1.211.3.6
sql/sql_prepare.cc@stripped, 2007-02-28 16:13:15+02:00, gkodinov@stripped +0 -0
Auto merged
MERGE: 1.187.1.9
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gkodinov
# Host: magare.gmz
# Root: /home/kgeorge/mysql/autopush/B26261-5.0-opt/RESYNC
--- 1.433/sql/mysql_priv.h 2007-02-26 14:57:41 +02:00
+++ 1.434/sql/mysql_priv.h 2007-02-28 16:13:15 +02:00
@@ -823,7 +823,10 @@
List<Item> &fields, List_item *values,
List<Item> &update_fields,
List<Item> &update_values, enum_duplicates duplic,
- COND **where, bool select_insert);
+ COND **where, bool select_insert,
+ bool (*check_fields) (THD *,TABLE *,
+ TABLE_LIST*,bool),
+ bool check_fields_arg);
bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
List<List_item> &values, List<Item> &update_fields,
List<Item> &update_values, enum_duplicates flag,
--- 1.217/sql/sql_insert.cc 2007-02-26 14:57:41 +02:00
+++ 1.218/sql/sql_insert.cc 2007-02-28 16:13:15 +02:00
@@ -355,6 +355,20 @@
}
+static bool check_insert_fields_and_values (THD *thd, TABLE *table,
+ TABLE_LIST *table_list,
+ bool abort_on_warning)
+{
+ bool old_abort_on_warning= thd->abort_on_warning;
+ bool result;
+ thd->abort_on_warning= abort_on_warning;
+
+ result= check_that_all_fields_are_given_values(thd, table, table_list);
+ thd->abort_on_warning= old_abort_on_warning;
+ return result;
+}
+
+
bool mysql_insert(THD *thd,TABLE_LIST *table_list,
List<Item> &fields,
List<List_item> &values_list,
@@ -451,10 +465,16 @@
thd->proc_info="init";
thd->used_tables=0;
values= its++;
+ value_count= values->elements;
if (mysql_prepare_insert(thd, table_list, table, fields, values,
update_fields, update_values, duplic, &unused_conds,
- FALSE))
+ FALSE,
+ (fields.elements || !value_count) ?
+ check_insert_fields_and_values : NULL,
+ !ignore && (thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES |
+ MODE_STRICT_ALL_TABLES))))
goto abort;
/* mysql_prepare_insert set table_list->table if it was not set */
@@ -480,7 +500,6 @@
table_list->next_local= 0;
context->resolve_in_table_list_only(table_list);
- value_count= values->elements;
while ((values= its++))
{
counter++;
@@ -551,17 +570,9 @@
table->file->start_bulk_insert(values_list.elements);
thd->no_trans_update= 0;
- thd->abort_on_warning= (!ignore &&
- (thd->variables.sql_mode &
- (MODE_STRICT_TRANS_TABLES |
- MODE_STRICT_ALL_TABLES)));
-
- if ((fields.elements || !value_count) &&
- check_that_all_fields_are_given_values(thd, table, table_list))
- {
- /* thd->net.report_error is now set, which will abort the next loop */
- error= 1;
- }
+ thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES |
+ MODE_STRICT_ALL_TABLES)));
mark_fields_used_by_triggers_for_insert_stmt(thd, table, duplic);
@@ -933,6 +944,9 @@
be taken from table_list->table)
where Where clause (for insert ... select)
select_insert TRUE if INSERT ... SELECT statement
+ check_fields additional verifier of the fields and values or NULL
+ if no extra check is nessesary
+ check_fields_arg argument to check_fields
TODO (in far future)
In cases of:
@@ -953,7 +967,10 @@
TABLE *table, List<Item> &fields, List_item *values,
List<Item> &update_fields, List<Item> &update_values,
enum_duplicates duplic,
- COND **where, bool select_insert)
+ COND **where, bool select_insert,
+ bool (*check_fields) (THD *,TABLE *,
+ TABLE_LIST*,bool),
+ bool check_fields_arg)
{
SELECT_LEX *select_lex= &thd->lex->select_lex;
Name_resolution_context *context= &select_lex->context;
@@ -1018,7 +1035,13 @@
if (!(res= check_insert_fields(thd, context->table_list, fields, *values,
!insert_into_view, &map) ||
- setup_fields(thd, 0, *values, 0, 0, 0))
+ setup_fields(thd, 0, *values, 0, 0, 0))
+ && (!check_fields || res ||
+ !(res= check_insert_fields_and_values (thd,
+ table ? table :
+ context->table_list->table,
+ context->table_list,
+ check_fields_arg)))
&& duplic == DUP_UPDATE)
{
select_lex->no_wrap_view_item= TRUE;
@@ -2294,7 +2317,7 @@
lex->query_tables->table, lex->field_list, 0,
lex->update_list, lex->value_list,
lex->duplicates,
- &select_lex->where, TRUE))
+ &select_lex->where, TRUE, NULL, FALSE))
DBUG_RETURN(TRUE);
/*
@@ -2356,7 +2379,14 @@
!insert_into_view, &map) ||
setup_fields(thd, 0, values, 0, 0, 0);
- if (info.handle_duplicates == DUP_UPDATE)
+ if (!res && fields->elements)
+ res= check_insert_fields_and_values (thd, table_list->table, table_list,
+ !info.ignore &&
+ (thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES |
+ MODE_STRICT_ALL_TABLES)));
+
+ if (info.handle_duplicates == DUP_UPDATE && !res)
{
Name_resolution_context *context= &lex->select_lex.context;
Name_resolution_context_state ctx_state;
@@ -2458,9 +2488,7 @@
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)));
- res= ((fields->elements &&
- check_that_all_fields_are_given_values(thd, table, table_list)) ||
- table_list->prepare_where(thd, 0, TRUE) ||
+ res= (table_list->prepare_where(thd, 0, TRUE) ||
table_list->prepare_check_option(thd));
if (!res)
--- 1.195/sql/sql_prepare.cc 2007-02-26 14:57:41 +02:00
+++ 1.196/sql/sql_prepare.cc 2007-02-28 16:13:15 +02:00
@@ -1057,7 +1057,7 @@
if (mysql_prepare_insert(thd, table_list, table_list->table,
fields, values, update_fields, update_values,
- duplic, &unused_conds, FALSE))
+ duplic, &unused_conds, FALSE, NULL, FALSE))
goto error;
value_count= values->elements;
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2425) | kgeorge | 28 Feb |