~drizzle-trunk/drizzle/development

851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
20
21
#ifndef DRIZZLED_MULTI_UPDATE_H
22
#define DRIZZLED_MULTI_UPDATE_H
23
997.4.1 by Padraig O'Sullivan
Removed 1 instance of SQL_LIST from the source base. Replaced it with
24
#include <list>
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
25
26
class multi_update :public select_result_interceptor
27
{
28
  TableList *all_tables; /* query/update command tables */
29
  TableList *leaves;     /* list of leves of join table tree */
997.4.1 by Padraig O'Sullivan
Removed 1 instance of SQL_LIST from the source base. Replaced it with
30
  std::list<TableList*> update_tables;
31
  TableList *table_being_updated;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
32
  Table **tmp_tables, *main_table, *table_to_update;
33
  Tmp_Table_Param *tmp_table_param;
34
  ha_rows updated, found;
35
  List <Item> *fields, *values;
36
  List <Item> **fields_for_table, **values_for_table;
37
  uint32_t table_count;
38
  /*
39
   List of tables referenced in the CHECK OPTION condition of
40
   the updated view excluding the updated table.
41
  */
42
  List <Table> unupdated_check_opt_tables;
1052.2.2 by Nathan Williams
No actual code changes. Changed Copy_field to CopyField, to reflect the coding standards.
43
  CopyField *copy_field;
851 by Brian Aker
Class rewrite of Session (aka get all of the junk out)
44
  enum enum_duplicates handle_duplicates;
45
  bool do_update, trans_safe;
46
  /* True if the update operation has made a change in a transactional table */
47
  bool transactional_tables;
48
  bool ignore;
49
  /*
50
     error handling (rollback and binlogging) can happen in send_eof()
51
     so that afterward send_error() needs to find out that.
52
  */
53
  bool error_handled;
54
55
public:
56
  multi_update(TableList *ut, TableList *leaves_list,
57
	       List<Item> *fields, List<Item> *values,
58
	       enum_duplicates handle_duplicates, bool ignore);
59
  ~multi_update();
60
  int prepare(List<Item> &list, Select_Lex_Unit *u);
61
  bool send_data(List<Item> &items);
62
  bool initialize_tables (JOIN *join);
63
  void send_error(uint32_t errcode,const char *err);
64
  int  do_updates();
65
  bool send_eof();
66
  virtual void abort();
67
};
68
69
#endif /* DRIZZLED_MULTI_UPDATE_H */