Commit 3456a512 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1/

into serg.mylan:/usr/home/serg/Abk/mysql-4.1

parents 8f063cec 68755d7f
......@@ -1235,6 +1235,7 @@ class select_insert :public select_result_interceptor {
~select_insert();
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
bool send_data(List<Item> &items);
virtual void store_values(List<Item> &values);
void send_error(uint errcode,const char *err);
bool send_eof();
/* not implemented: select_insert is never re-used in prepared statements */
......@@ -1262,7 +1263,7 @@ class select_create: public select_insert {
create_info(create_info_par), lock(0)
{}
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
bool send_data(List<Item> &values);
void store_values(List<Item> &values);
bool send_eof();
void abort();
};
......
......@@ -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");
......@@ -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;
}
......@@ -1711,7 +1702,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment