~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_dumpvar.h

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
 
20
 
20
21
#ifndef DRIZZLED_SELECT_DUMPVAR_H
21
22
#define DRIZZLED_SELECT_DUMPVAR_H
22
23
 
23
 
#include "drizzled/error.h"
24
 
#include "drizzled/function/set_user_var.h"
25
 
 
26
 
#include <vector>
27
 
 
28
 
namespace drizzled
29
 
{
 
24
#include <drizzled/error.h>
 
25
 
30
26
 
31
27
class select_dumpvar :public select_result_interceptor {
32
28
  ha_rows row_count;
33
29
public:
34
 
  std::vector<var *> var_list;
35
 
  select_dumpvar()  { var_list.clear(); row_count= 0;}
 
30
  List<my_var> var_list;
 
31
  select_dumpvar()  { var_list.empty(); row_count= 0;}
36
32
  ~select_dumpvar() {}
37
33
 
38
34
  int prepare(List<Item> &list, Select_Lex_Unit *u)
39
35
  {
40
36
    unit= u;
41
37
 
42
 
    if (var_list.size() != list.elements)
 
38
    if (var_list.elements != list.elements)
43
39
    {
44
40
      my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
45
41
                 ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
56
52
 
57
53
  bool send_data(List<Item> &items)
58
54
  {
59
 
    
60
 
    std::vector<var *>::const_iterator iter= var_list.begin();
61
 
 
 
55
    List_iterator_fast<my_var> var_li(var_list);
62
56
    List_iterator<Item> it(items);
63
 
    Item *item= NULL;
64
 
    var *current_var;
 
57
    Item *item;
 
58
    my_var *mv;
65
59
 
66
60
    if (unit->offset_limit_cnt)
67
61
    {                                           // using limit offset,count
73
67
      my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
74
68
      return(1);
75
69
    }
76
 
    while ((iter != var_list.end()) && (item= it++))
 
70
    while ((mv= var_li++) && (item= it++))
77
71
    {
78
 
      current_var= *iter;
79
 
      if (current_var->local == 0)
 
72
      if (mv->local == 0)
80
73
      {
81
 
        Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item);
 
74
        Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
82
75
        suv->fix_fields(session, 0);
83
76
        suv->check(0);
84
77
        suv->update();
85
78
      }
86
 
      ++iter;
87
79
    }
88
80
    return(session->is_error());
89
81
  }
104
96
 
105
97
};
106
98
 
107
 
} /* namespace drizzled */
108
 
 
109
99
#endif /* DRIZZLED_SELECT_DUMPVAR_H */