~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.h

  • Committer: Lee Bieber
  • Date: 2009-10-20 20:39:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1191.
  • Revision ID: lbieber@dhcp-umpk18-111-94.sfbay.sun.com-20091020203901-wmeq850fgv7iiqff
Add test case for MySQL BUG #42742: crash in setup_sj_materialization, Copy_field::set
If a semi-join strategy covers certain [first_table; last_table] range in join order, do reset the sj_strategy member for all tables within the range, except the first one.  Failure to do so caused EXPLAIN/execution code to try applying two strategies at once which would cause all kinds of undesired effects. 

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
 
 
21
 
 
22
20
#ifndef DRIZZLED_SQL_BASE_H
23
21
#define DRIZZLED_SQL_BASE_H
24
22
 
 
23
#include <stdint.h>
25
24
#include <drizzled/table.h>
26
 
#include <drizzled/table/concurrent.h>
27
 
 
28
 
#include "drizzled/visibility.h"
29
 
 
30
 
namespace drizzled
31
 
{
 
25
 
32
26
class TableShare;
33
 
class Name_resolution_context;
34
27
 
35
28
void table_cache_free(void);
36
29
bool table_cache_init(void);
 
30
void assign_new_table_id(TableShare *share);
37
31
uint32_t cached_open_tables(void);
38
32
uint32_t cached_table_definitions(void);
39
33
 
40
 
table::Cache &get_open_cache();
41
 
 
42
 
DRIZZLED_API void kill_drizzle(void);
 
34
void kill_drizzle(void);
43
35
 
44
36
/* sql_base.cc */
45
37
void set_item_name(Item *item,char *pos,uint32_t length);
57
49
                               Item *default_value, Item *on_update_value,
58
50
                               LEX_STRING *comment, char *change,
59
51
                               List<String> *interval_list, CHARSET_INFO *cs);
 
52
void store_position_for_column(const char *name);
60
53
bool push_new_name_resolution_context(Session *session,
61
54
                                      TableList *left_op,
62
55
                                      TableList *right_op);
63
56
void add_join_on(TableList *b,Item *expr);
64
57
void add_join_natural(TableList *a,TableList *b,List<String> *using_fields,
65
58
                      Select_Lex *lex);
 
59
 
 
60
SQL_SELECT *make_select(Table *head, table_map const_tables,
 
61
                        table_map read_tables, COND *conds,
 
62
                        bool allow_null_cond,  int *error);
66
63
extern Item **not_found_item;
67
64
 
68
65
/**
94
91
  RESOLVED_WITH_NO_ALIAS,
95
92
  RESOLVED_AGAINST_ALIAS
96
93
};
97
 
Item ** find_item_in_list(Session *session,
98
 
                          Item *item, List<Item> &items, uint32_t *counter,
 
94
Item ** find_item_in_list(Item *item, List<Item> &items, uint32_t *counter,
99
95
                          find_item_error_report_type report_error,
100
96
                          enum_resolution_type *resolution);
101
97
bool insert_fields(Session *session, Name_resolution_context *context,
133
129
                               TableList *TableList::*link,
134
130
                               const char *db_name,
135
131
                               const char *table_name);
136
 
TableList *unique_table(TableList *table, TableList *table_list,
137
 
                        bool check_alias= false);
 
132
TableList *unique_table(Session *session, TableList *table, TableList *table_list,
 
133
                         bool check_alias);
 
134
void remove_db_from_cache(const char *db);
138
135
 
139
 
/* bits for last argument to table::Cache::singleton().removeTable() */
 
136
/* bits for last argument to remove_table_from_cache() */
140
137
#define RTFC_NO_FLAG                0x0000
141
138
#define RTFC_OWNED_BY_Session_FLAG      0x0001
142
139
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
143
140
#define RTFC_CHECK_KILLED_FLAG      0x0004
 
141
bool remove_table_from_cache(Session *session, const char *db, const char *table,
 
142
                             uint32_t flags);
 
143
 
 
144
#define NORMAL_PART_NAME 0
 
145
#define TEMP_PART_NAME 1
 
146
#define RENAMED_PART_NAME 2
144
147
 
145
148
void mem_alloc_error(size_t size);
146
149
 
147
 
bool fill_record(Session* session, List<Item> &fields, List<Item> &values, bool ignore_errors= false);
148
 
bool fill_record(Session *session, Field **field, List<Item> &values, bool ignore_errors= false);
 
150
#define WFRM_WRITE_SHADOW 1
 
151
#define WFRM_INSTALL_SHADOW 2
 
152
#define WFRM_PACK_FRM 4
 
153
#define WFRM_KEEP_SHARE 8
 
154
 
 
155
bool fill_record(Session* session, List<Item> &fields, List<Item> &values, bool ignore_errors);
 
156
bool fill_record(Session *session, Field **field, List<Item> &values, bool ignore_errors);
 
157
bool list_open_tables(const char *db, const char *wild, bool(*func)(Table *table, open_table_list_st& open_list), Table *display);
 
158
 
149
159
inline TableList *find_table_in_global_list(TableList *table,
150
160
                                             const char *db_name,
151
161
                                             const char *table_name)
153
163
  return find_table_in_list(table, &TableList::next_global,
154
164
                            db_name, table_name);
155
165
}
156
 
 
157
 
} /* namespace drizzled */
158
 
 
159
166
#endif /* DRIZZLED_SQL_BASE_H */