summaryrefslogtreecommitdiff
path: root/sql/sql_insert.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2004-12-03 17:48:19 +0100
committerunknown <jimw@mysql.com>2004-12-03 17:48:19 +0100
commita1fb39e7ba46b72e4986b60c24298173cef07f8a (patch)
treec70e2fed45bb2ec769b74ade57d28b36aa7b5a31 /sql/sql_insert.cc
parent8948b7450fa543ef14f29b6087fd70ccfa640972 (diff)
parent0284e541b31b885fdb0ec899ad5cf83c83fa5804 (diff)
downloadmariadb-git-a1fb39e7ba46b72e4986b60c24298173cef07f8a.tar.gz
Merge
sql/sql_insert.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_class.h: SCCS merged
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r--sql/sql_insert.cc51
1 files changed, 21 insertions, 30 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index d63bb29affa..d53ad4a8102 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -368,7 +368,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
if (error <= 0)
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
- log_delayed);
+ log_delayed, FALSE);
if (mysql_bin_log.write(&qinfo) && transactional_table)
error=1;
}
@@ -1364,7 +1364,7 @@ bool delayed_insert::handle_inserts(void)
mysql_update_log.write(&thd,row->query, row->query_length);
if (row->log_query & DELAYED_LOG_BIN && using_bin_log)
{
- Query_log_event qinfo(&thd, row->query, row->query_length,0);
+ Query_log_event qinfo(&thd, row->query, row->query_length,0, FALSE);
mysql_bin_log.write(&qinfo);
}
}
@@ -1457,7 +1457,6 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
restore_record(table,default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
- thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields
thd->cuted_fields=0;
if (info.handle_duplicates == DUP_IGNORE ||
info.handle_duplicates == DUP_REPLACE)
@@ -1487,27 +1486,34 @@ select_insert::~select_insert()
bool select_insert::send_data(List<Item> &values)
{
DBUG_ENTER("select_insert::send_data");
+ bool error=0;
if (unit->offset_limit_cnt)
{ // using limit offset,count
unit->offset_limit_cnt--;
DBUG_RETURN(0);
}
- if (fields->elements)
- fill_record(*fields, values, 1);
- else
- fill_record(table->field, values, 1);
- if (thd->net.report_error || write_record(table,&info))
- DBUG_RETURN(1);
- if (table->next_number_field) // Clear for next record
+ thd->count_cuted_fields= CHECK_FIELD_WARN; // calc cuted fields
+ store_values(values);
+ error=thd->net.report_error || write_record(table,&info);
+ thd->count_cuted_fields= CHECK_FIELD_IGNORE;
+ if (!error && table->next_number_field) // Clear for next record
{
table->next_number_field->reset();
if (! last_insert_id && thd->insert_id_used)
last_insert_id=thd->insert_id();
}
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
+void select_insert::store_values(List<Item> &values)
+{
+ if (fields->elements)
+ fill_record(*fields, values, 1);
+ else
+ fill_record(table->field, values, 1);
+}
+
void select_insert::send_error(uint errcode,const char *err)
{
DBUG_ENTER("select_insert::send_error");
@@ -1539,7 +1545,7 @@ void select_insert::send_error(uint errcode,const char *err)
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions());
+ table->file->has_transactions(), FALSE);
mysql_bin_log.write(&qinfo);
}
if (!table->tmp_table)
@@ -1581,7 +1587,7 @@ bool select_insert::send_eof()
if (!error)
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
- table->file->has_transactions());
+ table->file->has_transactions(), FALSE);
mysql_bin_log.write(&qinfo);
}
if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
@@ -1637,7 +1643,6 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
table->next_number_field=table->found_next_number_field;
restore_record(table,default_values); // Get empty record
- thd->count_cuted_fields= CHECK_FIELD_WARN; // count warnings
thd->cuted_fields=0;
if (info.handle_duplicates == DUP_IGNORE ||
info.handle_duplicates == DUP_REPLACE)
@@ -1647,23 +1652,9 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
}
-bool select_create::send_data(List<Item> &values)
+void select_create::store_values(List<Item> &values)
{
- if (unit->offset_limit_cnt)
- { // using limit offset,count
- unit->offset_limit_cnt--;
- return 0;
- }
fill_record(field, values, 1);
- if (thd->net.report_error ||write_record(table,&info))
- return 1;
- if (table->next_number_field) // Clear for next record
- {
- table->next_number_field->reset();
- if (! last_insert_id && thd->insert_id_used)
- last_insert_id=thd->insert_id();
- }
- return 0;
}
@@ -1723,7 +1714,7 @@ void select_create::abort()
enum db_type table_type=table->db_type;
if (!table->tmp_table)
{
- ulong version= table->version;
+ ulong version= table->version;
hash_delete(&open_cache,(byte*) table);
if (!create_info->table_existed)
quick_rm_table(table_type, db, name);