1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

subselect with union

new error handling
Item_ref bug fixed
This commit is contained in:
bell@sanja.is.com.ua
2002-09-03 09:50:36 +03:00
parent 189d1dd630
commit b07aaeb295
25 changed files with 686 additions and 382 deletions

View File

@ -407,13 +407,19 @@ bool select_send::send_data(List<Item> &items)
if (item->send(thd, packet))
{
packet->free(); // Free used
my_error(ER_OUT_OF_RESOURCES,MYF(0));
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
DBUG_RETURN(1);
}
}
thd->sent_row_count++;
bool error=my_net_write(&thd->net,(char*) packet->ptr(),packet->length());
DBUG_RETURN(error);
if (!thd->net.report_error)
{
DBUG_RETURN(my_net_write(&thd->net,
(char*) packet->ptr(),
packet->length()));
}
else
DBUG_RETURN(1);
}
bool select_send::send_eof()
@ -423,8 +429,13 @@ bool select_send::send_eof()
{
mysql_unlock_tables(thd, thd->lock); thd->lock=0;
}
::send_eof(&thd->net);
return 0;
if (!thd->net.report_error)
{
::send_eof(&thd->net);
return 0;
}
else
return 1;
}
@ -460,7 +471,7 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
option);
if (!access(path,F_OK))
{
my_error(ER_FILE_EXISTS_ERROR,MYF(0),exchange->file_name);
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
return 1;
}
/* Create the file world readable */
@ -646,9 +657,9 @@ err:
}
void select_export::send_error(uint errcode,const char *err)
void select_export::send_error(uint errcode, const char *err)
{
::send_error(&thd->net,errcode,err);
my_message(errcode, err, MYF(0));;
(void) end_io_cache(&cache);
(void) my_close(file,MYF(0));
file= -1;
@ -660,9 +671,7 @@ bool select_export::send_eof()
int error=test(end_io_cache(&cache));
if (my_close(file,MYF(MY_WME)))
error=1;
if (error)
::send_error(&thd->net);
else
if (!error)
::send_ok(&thd->net,row_count);
file= -1;
return error;
@ -735,7 +744,7 @@ bool select_dump::send_data(List<Item> &items)
}
if (row_count++ > 1)
{
my_error(ER_TOO_MANY_ROWS,MYF(0));
my_error(ER_TOO_MANY_ROWS, MYF(0));
goto err;
}
while ((item=li++))
@ -760,7 +769,7 @@ err:
void select_dump::send_error(uint errcode,const char *err)
{
::send_error(&thd->net,errcode,err);
my_message(errcode, err, MYF(0));
(void) end_io_cache(&cache);
(void) my_close(file,MYF(0));
(void) my_delete(path,MYF(0)); // Delete file on error
@ -772,9 +781,7 @@ bool select_dump::send_eof()
int error=test(end_io_cache(&cache));
if (my_close(file,MYF(MY_WME)))
error=1;
if (error)
::send_error(&thd->net);
else
if (!error)
::send_ok(&thd->net,row_count);
file= -1;
return error;
@ -789,8 +796,9 @@ bool select_singleval_subselect::send_data(List<Item> &items)
{
DBUG_ENTER("select_singleval_subselect::send_data");
Item_singleval_subselect *it= (Item_singleval_subselect *)item;
if (it->assigned){
my_printf_error(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0));
if (it->assigned()){
thd->fatal_error= 1;
my_message(ER_SUBSELECT_NO_1_ROW, ER(ER_SUBSELECT_NO_1_ROW), MYF(0));
DBUG_RETURN(1);
}
if (unit->offset_limit_cnt)
@ -816,7 +824,7 @@ bool select_singleval_subselect::send_data(List<Item> &items)
it->int_value= val_item->val_int();
it->res_type= val_item->result_type();
}
it->assigned= 1;
it->assigned(1);
DBUG_RETURN(0);
}
@ -830,7 +838,7 @@ bool select_exists_subselect::send_data(List<Item> &items)
DBUG_RETURN(0);
}
it->value= 1;
it->assigned= 1;
it->assigned(1);
DBUG_RETURN(0);
}