00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include <drizzled/select_dumpvar.h>
00023 #include <drizzled/sql_lex.h>
00024 #include <drizzled/session.h>
00025
00026 namespace drizzled {
00027
00028 bool select_dumpvar::send_data(List<Item> &items)
00029 {
00030 std::vector<var *>::const_iterator iter= var_list.begin();
00031
00032 List<Item>::iterator it(items.begin());
00033 Item *item= NULL;
00034 var *current_var;
00035
00036 if (unit->offset_limit_cnt)
00037 {
00038 unit->offset_limit_cnt--;
00039 return(0);
00040 }
00041 if (row_count++)
00042 {
00043 my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
00044 return(1);
00045 }
00046 while ((iter != var_list.end()) && (item= it++))
00047 {
00048 current_var= *iter;
00049 if (current_var->local == 0)
00050 {
00051 Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item);
00052 suv->fix_fields(session, 0);
00053 suv->check(0);
00054 suv->update();
00055 }
00056 ++iter;
00057 }
00058 return(session->is_error());
00059 }
00060
00061 bool select_dumpvar::send_eof()
00062 {
00063 if (! row_count)
00064 push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
00065 ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
00066
00067
00068
00069
00070
00071 session->my_ok(row_count);
00072 return 0;
00073 }
00074
00075 int select_dumpvar::prepare(List<Item> &list, Select_Lex_Unit *u)
00076 {
00077 unit= u;
00078
00079 if (var_list.size() != list.size())
00080 {
00081 my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
00082 ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
00083 return 1;
00084 }
00085 return 0;
00086 }
00087
00088 }