~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.h

  • Committer: Monty Taylor
  • Date: 2008-11-16 23:47:43 UTC
  • mto: (584.1.10 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116234743-c38gmv0pa2kdefaj
BrokeĀ outĀ cached_item.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_SQL_BASE_H
21
21
#define DRIZZLED_SQL_BASE_H
22
22
 
23
 
#include <drizzled/table.h>
 
23
#include <stdint.h>
24
24
 
25
 
namespace drizzled
26
 
{
27
 
class TableShare;
28
 
class Name_resolution_context;
 
25
typedef struct st_table_share TABLE_SHARE;
29
26
 
30
27
void table_cache_free(void);
31
28
bool table_cache_init(void);
 
29
bool table_def_init(void);
 
30
void table_def_free(void);
 
31
void assign_new_table_id(TABLE_SHARE *share);
32
32
uint32_t cached_open_tables(void);
33
33
uint32_t cached_table_definitions(void);
34
 
HASH *get_open_cache();
35
34
 
36
35
void kill_drizzle(void);
37
36
 
38
 
/* sql_base.cc */
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,
45
 
                       LEX_STRING *comment,
46
 
                       char *change, List<String> *interval_list,
47
 
                       const CHARSET_INFO * const cs);
48
 
CreateField * new_create_field(Session *session, char *field_name, enum_field_types type,
49
 
                               char *length, char *decimals,
50
 
                               uint32_t type_modifier,
51
 
                               Item *default_value, Item *on_update_value,
52
 
                               LEX_STRING *comment, char *change,
53
 
                               List<String> *interval_list, CHARSET_INFO *cs);
54
 
void store_position_for_column(const char *name);
55
 
bool push_new_name_resolution_context(Session *session,
56
 
                                      TableList *left_op,
57
 
                                      TableList *right_op);
58
 
void add_join_on(TableList *b,Item *expr);
59
 
void add_join_natural(TableList *a,TableList *b,List<String> *using_fields,
60
 
                      Select_Lex *lex);
61
 
extern Item **not_found_item;
62
 
 
63
 
/**
64
 
  A set of constants used for checking non aggregated fields and sum
65
 
  functions mixture in the ONLY_FULL_GROUP_BY_MODE.
66
 
*/
67
 
enum enum_group_by_mode_type
68
 
{
69
 
  NON_AGG_FIELD_USED= 0,
70
 
  SUM_FUNC_USED
71
 
};
72
 
 
73
 
/**
74
 
  This enumeration type is used only by the function find_item_in_list
75
 
  to return the info on how an item has been resolved against a list
76
 
  of possibly aliased items.
77
 
  The item can be resolved:
78
 
   - against an alias name of the list's element (RESOLVED_AGAINST_ALIAS)
79
 
   - against non-aliased field name of the list  (RESOLVED_WITH_NO_ALIAS)
80
 
   - against an aliased field name of the list   (RESOLVED_BEHIND_ALIAS)
81
 
   - ignoring the alias name in cases when SQL requires to ignore aliases
82
 
     (e.g. when the resolved field reference contains a table name or
83
 
     when the resolved item is an expression)   (RESOLVED_IGNORING_ALIAS)
84
 
*/
85
 
enum enum_resolution_type {
86
 
  NOT_RESOLVED=0,
87
 
  RESOLVED_IGNORING_ALIAS,
88
 
  RESOLVED_BEHIND_ALIAS,
89
 
  RESOLVED_WITH_NO_ALIAS,
90
 
  RESOLVED_AGAINST_ALIAS
91
 
};
92
 
Item ** find_item_in_list(Item *item, List<Item> &items, uint32_t *counter,
93
 
                          find_item_error_report_type report_error,
94
 
                          enum_resolution_type *resolution);
95
 
bool insert_fields(Session *session, Name_resolution_context *context,
96
 
                   const char *db_name, const char *table_name,
97
 
                   List_iterator<Item> *it, bool any_privileges);
98
 
bool setup_tables(Session *session, Name_resolution_context *context,
99
 
                  List<TableList> *from_clause, TableList *tables,
100
 
                  TableList **leaves, bool select_insert);
101
 
bool setup_tables_and_check_access(Session *session,
102
 
                                   Name_resolution_context *context,
103
 
                                   List<TableList> *from_clause,
104
 
                                   TableList *tables,
105
 
                                   TableList **leaves,
106
 
                                   bool select_insert);
107
 
int setup_wild(Session *session, List<Item> &fields,
108
 
               List<Item> *sum_func_list,
109
 
               uint32_t wild_num);
110
 
bool setup_fields(Session *session, Item** ref_pointer_array,
111
 
                  List<Item> &item, enum_mark_columns mark_used_columns,
112
 
                  List<Item> *sum_func_list, bool allow_sum_func);
113
 
inline bool setup_fields_with_no_wrap(Session *session, Item **ref_pointer_array,
114
 
                                      List<Item> &item,
115
 
                                      enum_mark_columns mark_used_columns,
116
 
                                      List<Item> *sum_func_list,
117
 
                                      bool allow_sum_func)
118
 
{
119
 
  bool res;
120
 
  res= setup_fields(session, ref_pointer_array, item, mark_used_columns, sum_func_list,
121
 
                    allow_sum_func);
122
 
  return res;
123
 
}
124
 
int setup_conds(Session *session, TableList *leaves, COND **conds);
125
 
/* open_and_lock_tables with optional derived handling */
126
 
TableList *find_table_in_list(TableList *table,
127
 
                               TableList *TableList::*link,
128
 
                               const char *db_name,
129
 
                               const char *table_name);
130
 
TableList *unique_table(TableList *table, TableList *table_list,
131
 
                        bool check_alias= false);
132
 
void remove_db_from_cache(SchemaIdentifier &schema_identifier);
133
 
 
134
 
/* bits for last argument to remove_table_from_cache() */
135
 
#define RTFC_NO_FLAG                0x0000
136
 
#define RTFC_OWNED_BY_Session_FLAG      0x0001
137
 
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
138
 
#define RTFC_CHECK_KILLED_FLAG      0x0004
139
 
bool remove_table_from_cache(Session *session, const char *db, const char *table,
140
 
                             uint32_t flags);
141
 
 
142
 
void mem_alloc_error(size_t size);
143
 
 
144
 
bool fill_record(Session* session, List<Item> &fields, List<Item> &values, bool ignore_errors= false);
145
 
bool fill_record(Session *session, Field **field, List<Item> &values, bool ignore_errors= false);
146
 
inline TableList *find_table_in_global_list(TableList *table,
147
 
                                             const char *db_name,
148
 
                                             const char *table_name)
149
 
{
150
 
  return find_table_in_list(table, &TableList::next_global,
151
 
                            db_name, table_name);
152
 
}
153
 
 
154
 
} /* namespace drizzled */
155
37
 
156
38
#endif /* DRIZZLED_SQL_BASE_H */