00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 #include <drizzled/table.h>
00025 #include <drizzled/table_list.h>
00026 #include <drizzled/table/concurrent.h>
00027
00028 #include <drizzled/visibility.h>
00029
00030 namespace drizzled {
00031
00032 void table_cache_free();
00033
00034 table::Cache &get_open_cache();
00035
00036 DRIZZLED_API void kill_drizzle();
00037
00038
00039 void set_item_name(Item *item,char *pos,uint32_t length);
00040 bool add_field_to_list(Session *session, str_ref field_name, enum enum_field_types type,
00041 const char *length, const char *decimal,
00042 uint32_t type_modifier,
00043 enum column_format_type column_format,
00044 Item *default_value, Item *on_update_value,
00045 str_ref comment,
00046 const char *change, List<String> *interval_list,
00047 const charset_info_st * const cs);
00048 CreateField * new_create_field(Session *session, const char *field_name, enum_field_types type,
00049 const char *length, const char *decimals,
00050 uint32_t type_modifier,
00051 Item *default_value, Item *on_update_value,
00052 str_ref comment, const char *change,
00053 List<String> *interval_list, charset_info_st *cs);
00054 void push_new_name_resolution_context(Session&, TableList& left_op, TableList& right_op);
00055 void add_join_on(TableList *b,Item *expr);
00056 void add_join_natural(TableList *a,TableList *b,List<String> *using_fields,
00057 Select_Lex *lex);
00058 extern Item **not_found_item;
00059
00064 enum enum_group_by_mode_type
00065 {
00066 NON_AGG_FIELD_USED= 0,
00067 SUM_FUNC_USED
00068 };
00069
00082 enum enum_resolution_type {
00083 NOT_RESOLVED=0,
00084 RESOLVED_IGNORING_ALIAS,
00085 RESOLVED_BEHIND_ALIAS,
00086 RESOLVED_WITH_NO_ALIAS,
00087 RESOLVED_AGAINST_ALIAS
00088 };
00089 Item ** find_item_in_list(Session *session,
00090 Item *item, List<Item> &items, uint32_t *counter,
00091 find_item_error_report_type report_error,
00092 enum_resolution_type *resolution);
00093 bool insert_fields(Session *session, Name_resolution_context *context,
00094 const char *db_name, const char *table_name,
00095 List<Item>::iterator *it, bool any_privileges);
00096 bool setup_tables(Session *session, Name_resolution_context *context,
00097 List<TableList> *from_clause, TableList *tables,
00098 TableList **leaves, bool select_insert);
00099 bool setup_tables_and_check_access(Session *session,
00100 Name_resolution_context *context,
00101 List<TableList> *from_clause,
00102 TableList *tables,
00103 TableList **leaves,
00104 bool select_insert);
00105 int setup_wild(Session *session, List<Item> &fields,
00106 List<Item> *sum_func_list,
00107 uint32_t wild_num);
00108 bool setup_fields(Session *session, Item** ref_pointer_array,
00109 List<Item> &item, enum_mark_columns mark_used_columns,
00110 List<Item> *sum_func_list, bool allow_sum_func);
00111 inline bool setup_fields_with_no_wrap(Session *session, Item **ref_pointer_array,
00112 List<Item> &item,
00113 enum_mark_columns mark_used_columns,
00114 List<Item> *sum_func_list,
00115 bool allow_sum_func)
00116 {
00117 bool res;
00118 res= setup_fields(session, ref_pointer_array, item, mark_used_columns, sum_func_list,
00119 allow_sum_func);
00120 return res;
00121 }
00122 int setup_conds(Session *session, TableList *leaves, COND **conds);
00123
00124 TableList *find_table_in_list(TableList *table,
00125 TableList *TableList::*link,
00126 const char *db_name,
00127 const char *table_name);
00128 TableList *unique_table(TableList *table, TableList *table_list,
00129 bool check_alias= false);
00130
00131
00132 #define RTFC_NO_FLAG 0x0000
00133 #define RTFC_OWNED_BY_Session_FLAG 0x0001
00134 #define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
00135 #define RTFC_CHECK_KILLED_FLAG 0x0004
00136
00137 void mem_alloc_error(size_t size);
00138
00139 bool fill_record(Session* session, List<Item> &fields, List<Item> &values, bool ignore_errors= false);
00140 bool fill_record(Session *session, Field **field, List<Item> &values, bool ignore_errors= false);
00141 inline TableList *find_table_in_global_list(TableList *table,
00142 const char *db_name,
00143 const char *table_name)
00144 {
00145 return find_table_in_list(table, &TableList::next_global,
00146 db_name, table_name);
00147 }
00148
00149 void drizzle_rm_tmp_tables();
00150
00151 }
00152