1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
4
* Copyright (C) 2008 Sun Microsystems
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
22
20
#ifndef DRIZZLED_SQL_BASE_H
23
21
#define DRIZZLED_SQL_BASE_H
25
24
#include <drizzled/table.h>
26
#include <drizzled/table/concurrent.h>
28
#include "drizzled/visibility.h"
33
class Name_resolution_context;
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);
40
table::Cache &get_open_cache();
42
DRIZZLED_API void kill_drizzle(void);
34
void kill_drizzle(void);
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,
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;
94
91
RESOLVED_WITH_NO_ALIAS,
95
92
RESOLVED_AGAINST_ALIAS
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,
134
void remove_db_from_cache(const char *db);
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,
144
#define NORMAL_PART_NAME 0
145
#define TEMP_PART_NAME 1
146
#define RENAMED_PART_NAME 2
145
148
void mem_alloc_error(size_t size);
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
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);
149
159
inline TableList *find_table_in_global_list(TableList *table,
150
160
const char *db_name,
151
161
const char *table_name)