35
35
void kill_drizzle(void);
38
#define TMP_TABLE_KEY_EXTRA 8
39
void set_item_name(Item *item,char *pos,uint32_t length);
40
bool add_field_to_list(Session *session, LEX_STRING *field_name, enum enum_field_types type,
41
char *length, char *decimal,
42
uint32_t type_modifier,
43
enum column_format_type column_format,
44
Item *default_value, Item *on_update_value,
46
char *change, List<String> *interval_list,
47
const CHARSET_INFO * const cs,
48
virtual_column_info *vcol_info);
49
Create_field * new_create_field(Session *session, char *field_name, enum_field_types type,
50
char *length, char *decimals,
51
uint32_t type_modifier,
52
Item *default_value, Item *on_update_value,
53
LEX_STRING *comment, char *change,
54
List<String> *interval_list, CHARSET_INFO *cs,
55
virtual_column_info *vcol_info);
56
void store_position_for_column(const char *name);
57
bool add_to_list(Session *session, SQL_LIST &list,Item *group,bool asc);
58
bool push_new_name_resolution_context(Session *session,
61
void add_join_on(TableList *b,Item *expr);
62
void add_join_natural(TableList *a,TableList *b,List<String> *using_fields,
64
bool add_proc_to_list(Session *session, Item *item);
65
void unlink_open_table(Session *session, Table *find, bool unlock);
66
void drop_open_table(Session *session, Table *table, const char *db_name,
67
const char *table_name);
68
void update_non_unique_table_error(TableList *update,
69
const char *operation,
70
TableList *duplicate);
72
SQL_SELECT *make_select(Table *head, table_map const_tables,
73
table_map read_tables, COND *conds,
74
bool allow_null_cond, int *error);
75
extern Item **not_found_item;
78
A set of constants used for checking non aggregated fields and sum
79
functions mixture in the ONLY_FULL_GROUP_BY_MODE.
81
#define NON_AGG_FIELD_USED 1
82
#define SUM_FUNC_USED 2
85
This enumeration type is used only by the function find_item_in_list
86
to return the info on how an item has been resolved against a list
87
of possibly aliased items.
88
The item can be resolved:
89
- against an alias name of the list's element (RESOLVED_AGAINST_ALIAS)
90
- against non-aliased field name of the list (RESOLVED_WITH_NO_ALIAS)
91
- against an aliased field name of the list (RESOLVED_BEHIND_ALIAS)
92
- ignoring the alias name in cases when SQL requires to ignore aliases
93
(e.g. when the resolved field reference contains a table name or
94
when the resolved item is an expression) (RESOLVED_IGNORING_ALIAS)
96
enum enum_resolution_type {
98
RESOLVED_IGNORING_ALIAS,
99
RESOLVED_BEHIND_ALIAS,
100
RESOLVED_WITH_NO_ALIAS,
101
RESOLVED_AGAINST_ALIAS
103
Item ** find_item_in_list(Item *item, List<Item> &items, uint32_t *counter,
104
find_item_error_report_type report_error,
105
enum_resolution_type *resolution);
106
bool get_key_map_from_key_list(key_map *map, Table *table,
107
List<String> *index_list);
108
bool insert_fields(Session *session, Name_resolution_context *context,
109
const char *db_name, const char *table_name,
110
List_iterator<Item> *it, bool any_privileges);
111
bool setup_tables(Session *session, Name_resolution_context *context,
112
List<TableList> *from_clause, TableList *tables,
113
TableList **leaves, bool select_insert);
114
bool setup_tables_and_check_access(Session *session,
115
Name_resolution_context *context,
116
List<TableList> *from_clause,
120
int setup_wild(Session *session, TableList *tables, List<Item> &fields,
121
List<Item> *sum_func_list, uint32_t wild_num);
122
bool setup_fields(Session *session, Item** ref_pointer_array,
123
List<Item> &item, enum_mark_columns mark_used_columns,
124
List<Item> *sum_func_list, bool allow_sum_func);
125
inline bool setup_fields_with_no_wrap(Session *session, Item **ref_pointer_array,
127
enum_mark_columns mark_used_columns,
128
List<Item> *sum_func_list,
132
res= setup_fields(session, ref_pointer_array, item, mark_used_columns, sum_func_list,
136
int setup_conds(Session *session, TableList *tables, TableList *leaves,
138
int setup_ftfuncs(SELECT_LEX* select);
139
int init_ftfuncs(Session *session, SELECT_LEX* select, bool no_order);
140
void wait_for_condition(Session *session, pthread_mutex_t *mutex,
141
pthread_cond_t *cond);
142
int open_tables(Session *session, TableList **tables, uint32_t *counter, uint32_t flags);
143
/* open_and_lock_tables with optional derived handling */
144
int open_and_lock_tables_derived(Session *session, TableList *tables, bool derived);
145
/* simple open_and_lock_tables without derived handling */
146
inline int simple_open_n_lock_tables(Session *session, TableList *tables)
148
return open_and_lock_tables_derived(session, tables, false);
150
/* open_and_lock_tables with derived handling */
151
inline int open_and_lock_tables(Session *session, TableList *tables)
153
return open_and_lock_tables_derived(session, tables, true);
155
/* simple open_and_lock_tables without derived handling for single table */
156
Table *open_n_lock_single_table(Session *session, TableList *table_l,
157
thr_lock_type lock_type);
158
bool open_normal_and_derived_tables(Session *session, TableList *tables, uint32_t flags);
159
int lock_tables(Session *session, TableList *tables, uint32_t counter, bool *need_reopen);
160
int decide_logging_format(Session *session);
161
Table *open_temporary_table(Session *session, const char *path, const char *db,
162
const char *table_name, bool link_in_list,
163
open_table_mode open_mode);
164
bool rm_temporary_table(handlerton *base, char *path, bool frm_only);
165
void free_io_cache(Table *entry);
166
void intern_close_table(Table *entry);
167
bool close_thread_table(Session *session, Table **table_ptr);
168
void close_temporary_tables(Session *session);
169
void close_tables_for_reopen(Session *session, TableList **tables);
170
TableList *find_table_in_list(TableList *table,
171
TableList *TableList::*link,
173
const char *table_name);
174
TableList *unique_table(Session *session, TableList *table, TableList *table_list,
176
Table *find_temporary_table(Session *session, const char *db, const char *table_name);
177
Table *find_temporary_table(Session *session, TableList *table_list);
178
int drop_temporary_table(Session *session, TableList *table_list);
179
void close_temporary_table(Session *session, Table *table, bool free_share,
181
void close_temporary(Table *table, bool free_share, bool delete_table);
182
bool rename_temporary_table(Session* session, Table *table, const char *new_db,
183
const char *table_name);
184
void remove_db_from_cache(const char *db);
186
bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
187
char *make_default_log_name(char *buff,const char* log_ext);
189
/* bits for last argument to remove_table_from_cache() */
190
#define RTFC_NO_FLAG 0x0000
191
#define RTFC_OWNED_BY_Session_FLAG 0x0001
192
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
193
#define RTFC_CHECK_KILLED_FLAG 0x0004
194
bool remove_table_from_cache(Session *session, const char *db, const char *table,
197
#define NORMAL_PART_NAME 0
198
#define TEMP_PART_NAME 1
199
#define RENAMED_PART_NAME 2
201
void mem_alloc_error(size_t size);
203
#define WFRM_WRITE_SHADOW 1
204
#define WFRM_INSTALL_SHADOW 2
205
#define WFRM_PACK_FRM 4
206
#define WFRM_KEEP_SHARE 8
208
bool close_cached_tables(Session *session, TableList *tables, bool have_lock,
209
bool wait_for_refresh, bool wait_for_placeholders);
210
bool close_cached_connection_tables(Session *session, bool wait_for_refresh,
211
LEX_STRING *connect_string,
212
bool have_lock= false);
213
void copy_field_from_tmp_record(Field *field,int offset);
214
bool fill_record(Session * session, List<Item> &fields, List<Item> &values, bool ignore_errors);
215
bool fill_record(Session *session, Field **field, List<Item> &values, bool ignore_errors);
216
OPEN_TableList *list_open_tables(Session *session, const char *db, const char *wild);
218
inline TableList *find_table_in_global_list(TableList *table,
220
const char *table_name)
222
return find_table_in_list(table, &TableList::next_global,
223
db_name, table_name);
226
inline TableList *find_table_in_local_list(TableList *table,
228
const char *table_name)
230
return find_table_in_list(table, &TableList::next_local,
231
db_name, table_name);
38
237
#endif /* DRIZZLED_SQL_BASE_H */