30
46
class Slave_log_event;
31
47
class Lex_input_stream;
32
48
class Rows_log_event;
34
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
35
enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
36
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
37
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
38
DELAY_KEY_WRITE_ALL };
39
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
40
SLAVE_EXEC_MODE_IDEMPOTENT,
41
SLAVE_EXEC_MODE_LAST_BIT};
42
enum enum_mark_columns
43
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
44
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
46
54
extern char internal_table_name[2];
47
55
extern char empty_c_string[1];
98
class Key_part_spec :public Sql_alloc {
100
LEX_STRING field_name;
102
Key_part_spec(const LEX_STRING &name, uint32_t len)
103
: field_name(name), length(len)
105
Key_part_spec(const char *name, const size_t name_len, uint32_t len)
107
{ field_name.str= (char *)name; field_name.length= name_len; }
108
bool operator==(const Key_part_spec& other) const;
110
Construct a copy of this Key_part_spec. field_name is copied
111
by-pointer as it is known to never change. At the same time
112
'length' may be reset in mysql_prepare_create_table, and this
113
is why we supply it with a copy.
115
@return If out of memory, 0 is returned and an error is set in
118
Key_part_spec *clone(MEM_ROOT *mem_root) const
119
{ return new (mem_root) Key_part_spec(*this); }
123
class Alter_drop :public Sql_alloc {
125
enum drop_type {KEY, COLUMN };
128
Alter_drop(enum drop_type par_type,const char *par_name)
129
:name(par_name), type(par_type) {}
131
Used to make a clone of this object for ALTER/CREATE TABLE
132
@sa comment for Key_part_spec::clone
134
Alter_drop *clone(MEM_ROOT *mem_root) const
135
{ return new (mem_root) Alter_drop(*this); }
139
class Alter_column :public Sql_alloc {
143
Alter_column(const char *par_name,Item *literal)
144
:name(par_name), def(literal) {}
146
Used to make a clone of this object for ALTER/CREATE TABLE
147
@sa comment for Key_part_spec::clone
149
Alter_column *clone(MEM_ROOT *mem_root) const
150
{ return new (mem_root) Alter_column(*this); }
154
class Key :public Sql_alloc {
156
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY};
158
KEY_CREATE_INFO key_create_info;
159
List<Key_part_spec> columns;
163
Key(enum Keytype type_par, const LEX_STRING &name_arg,
164
KEY_CREATE_INFO *key_info_arg,
165
bool generated_arg, List<Key_part_spec> &cols)
166
:type(type_par), key_create_info(*key_info_arg), columns(cols),
167
name(name_arg), generated(generated_arg)
169
Key(enum Keytype type_par, const char *name_arg, size_t name_len_arg,
170
KEY_CREATE_INFO *key_info_arg, bool generated_arg,
171
List<Key_part_spec> &cols)
172
:type(type_par), key_create_info(*key_info_arg), columns(cols),
173
generated(generated_arg)
175
name.str= (char *)name_arg;
176
name.length= name_len_arg;
178
Key(const Key &rhs, MEM_ROOT *mem_root);
180
/* Equality comparison of keys (ignoring name) */
181
friend bool foreign_key_prefix(Key *a, Key *b);
183
Used to make a clone of this object for ALTER/CREATE TABLE
184
@sa comment for Key_part_spec::clone
186
virtual Key *clone(MEM_ROOT *mem_root) const
187
{ return new (mem_root) Key(*this, mem_root); }
192
class Foreign_key: public Key {
194
enum fk_match_opt { FK_MATCH_UNDEF, FK_MATCH_FULL,
195
FK_MATCH_PARTIAL, FK_MATCH_SIMPLE};
196
enum fk_option { FK_OPTION_UNDEF, FK_OPTION_RESTRICT, FK_OPTION_CASCADE,
197
FK_OPTION_SET_NULL, FK_OPTION_NO_ACTION, FK_OPTION_DEFAULT};
199
Table_ident *ref_table;
200
List<Key_part_spec> ref_columns;
201
uint32_t delete_opt, update_opt, match_opt;
202
Foreign_key(const LEX_STRING &name_arg, List<Key_part_spec> &cols,
203
Table_ident *table, List<Key_part_spec> &ref_cols,
204
uint32_t delete_opt_arg, uint32_t update_opt_arg, uint32_t match_opt_arg)
205
:Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols),
206
ref_table(table), ref_columns(ref_cols),
207
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
208
match_opt(match_opt_arg)
210
Foreign_key(const Foreign_key &rhs, MEM_ROOT *mem_root);
212
Used to make a clone of this object for ALTER/CREATE TABLE
213
@sa comment for Key_part_spec::clone
215
virtual Key *clone(MEM_ROOT *mem_root) const
216
{ return new (mem_root) Foreign_key(*this, mem_root); }
219
109
typedef struct st_mysql_lock
235
125
class select_result;
238
#define THD_SENTRY_MAGIC 0xfeedd1ff
239
#define THD_SENTRY_GONE 0xdeadbeef
128
#define Session_SENTRY_MAGIC 0xfeedd1ff
129
#define Session_SENTRY_GONE 0xdeadbeef
241
#define THD_CHECK_SENTRY(thd) assert(thd->dbug_sentry == THD_SENTRY_MAGIC)
131
#define Session_CHECK_SENTRY(session) assert(session->dbug_sentry == Session_SENTRY_MAGIC)
243
133
struct system_variables
246
136
How dynamically allocated system variables are handled:
248
138
The global_system_variables and max_system_variables are "authoritative"
249
139
They both should have the same 'version' and 'size'.
250
140
When attempting to access a dynamic variable, if the session version
251
141
is out of date, then the session version is updated and realloced if
252
142
neccessary and bytes copied from global to make up for missing data.
254
144
ulong dynamic_variables_version;
255
145
char* dynamic_variables_ptr;
256
146
uint32_t dynamic_variables_head; /* largest valid variable offset */
257
147
uint32_t dynamic_variables_size; /* how many bytes are in use */
259
149
uint64_t myisam_max_extra_sort_file_size;
260
150
uint64_t myisam_max_sort_file_size;
261
151
uint64_t max_heap_table_size;
262
152
uint64_t tmp_table_size;
263
uint64_t long_query_time;
264
153
ha_rows select_limit;
265
154
ha_rows max_join_size;
266
ulong auto_increment_increment, auto_increment_offset;
267
ulong bulk_insert_buff_size;
268
ulong join_buff_size;
269
ulong max_allowed_packet;
270
ulong max_error_count;
271
ulong max_length_for_sort_data;
272
ulong max_sort_length;
273
ulong max_tmp_tables;
274
ulong min_examined_row_limit;
275
ulong myisam_repair_threads;
276
ulong myisam_sort_buff_size;
277
ulong myisam_stats_method;
278
ulong net_buffer_length;
279
ulong net_interactive_timeout;
280
ulong net_read_timeout;
281
ulong net_retry_count;
282
ulong net_wait_timeout;
283
ulong net_write_timeout;
284
ulong optimizer_prune_level;
285
ulong optimizer_search_depth;
155
uint32_t auto_increment_increment;
156
uint32_t auto_increment_offset;
157
uint64_t bulk_insert_buff_size;
158
uint64_t join_buff_size;
159
uint32_t max_allowed_packet;
160
uint64_t max_error_count;
161
uint64_t max_length_for_sort_data;
162
uint64_t max_sort_length;
163
uint64_t max_tmp_tables;
164
uint64_t min_examined_row_limit;
165
uint32_t myisam_repair_threads;
166
size_t myisam_sort_buff_size;
167
uint32_t myisam_stats_method;
168
uint32_t net_buffer_length;
169
uint32_t net_interactive_timeout;
170
uint32_t net_read_timeout;
171
uint32_t net_retry_count;
172
uint32_t net_wait_timeout;
173
uint32_t net_write_timeout;
174
bool optimizer_prune_level;
175
uint32_t optimizer_search_depth;
287
177
Controls use of Engine-MRR:
288
178
0 - auto, based on cost
289
179
1 - force MRR when the storage engine is capable of doing it
292
ulong optimizer_use_mrr;
182
uint32_t optimizer_use_mrr;
293
183
/* A bitmap for switching optimizations on/off */
294
ulong optimizer_switch;
295
ulong preload_buff_size;
296
ulong profiling_history_size;
297
ulong query_cache_type;
298
ulong read_buff_size;
299
ulong read_rnd_buff_size;
300
ulong div_precincrement;
302
ulong thread_handling;
304
ulong completion_type;
184
uint32_t optimizer_switch;
185
uint64_t preload_buff_size;
186
uint32_t read_buff_size;
187
uint32_t read_rnd_buff_size;
188
uint32_t div_precincrement;
189
size_t sortbuff_size;
190
uint32_t thread_handling;
191
uint32_t tx_isolation;
192
uint32_t completion_type;
305
193
/* Determines which non-standard SQL behaviour should be enabled */
307
ulong default_week_format;
308
ulong max_seeks_for_key;
309
ulong range_alloc_block_size;
310
ulong query_alloc_block_size;
311
ulong query_prealloc_size;
312
ulong trans_alloc_block_size;
313
ulong trans_prealloc_size;
315
ulong group_concat_max_len;
316
ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
195
uint32_t default_week_format;
196
uint64_t max_seeks_for_key;
197
size_t range_alloc_block_size;
198
uint32_t query_alloc_block_size;
199
uint32_t query_prealloc_size;
200
uint32_t trans_alloc_block_size;
201
uint32_t trans_prealloc_size;
203
uint64_t group_concat_max_len;
318
205
In slave thread we need to know in behalf of which
319
206
thread the query is being run to replicate temp tables properly
321
my_thread_id pseudo_thread_id;
208
/* TODO: change this to my_thread_id - but have to fix set_var first */
209
uint64_t pseudo_thread_id;
323
211
bool low_priority_updates;
326
214
compatibility option:
327
- index usage hints (USE INDEX without a FOR clause) behave as in 5.0
215
- index usage hints (USE INDEX without a FOR clause) behave as in 5.0
330
218
bool engine_condition_pushdown;
441
330
#define last_system_status_var questions
443
void mark_transaction_to_rollback(THD *thd, bool all);
332
void mark_transaction_to_rollback(Session *session, bool all);
445
334
#ifdef DRIZZLE_SERVER
451
List of items created in the parser for this query. Every item puts
452
itself to the list on creation (see Item::Item() for details))
455
MEM_ROOT *mem_root; // Pointer to current memroot
457
Query_arena(MEM_ROOT *mem_root_arg) :
458
free_list(0), mem_root(mem_root_arg)
461
This constructor is used only when Query_arena is created as
462
backup storage for another instance of Query_arena.
466
virtual ~Query_arena() {};
468
inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
469
inline void* calloc(size_t size)
472
if ((ptr=alloc_root(mem_root,size)))
473
memset(ptr, 0, size);
476
inline char *strdup(const char *str)
477
{ return strdup_root(mem_root,str); }
478
inline char *strmake(const char *str, size_t size)
479
{ return strmake_root(mem_root,str,size); }
480
inline void *memdup(const void *str, size_t size)
481
{ return memdup_root(mem_root,str,size); }
482
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
485
if ((ptr= alloc_root(mem_root,size+gap)))
486
memcpy(ptr,str,size);
496
338
@brief State of a single command executed against this connection.
539
381
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
540
382
non-NULL value if its previous value is NULL. We do not need to protect
541
383
operation (B) with any mutex. To avoid crashes in races, if we do not
542
know that thd->query cannot change at the moment, one should print
543
thd->query like this:
384
know that session->query cannot change at the moment, one should print
385
session->query like this:
544
386
(1) reserve the LOCK_thread_count mutex;
545
(2) check if thd->query is NULL;
546
(3) if not NULL, then print at most thd->query_length characters from
387
(2) check if session->query is NULL;
388
(3) if not NULL, then print at most session->query_length characters from
547
389
it. We will see the query_length field as either 0, or the right value
549
391
Assuming that the write and read of an n-bit memory field in an n-bit
550
computer is atomic, we can avoid races in the above way.
392
computer is atomic, we can avoid races in the above way.
551
393
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
769
609
from the anticipated conditions trapped during runtime.
771
611
This mechanism is similar to C++ try/throw/catch:
772
- 'try' correspond to <code>THD::push_internal_handler()</code>,
612
- 'try' correspond to <code>Session::push_internal_handler()</code>,
773
613
- 'throw' correspond to <code>my_error()</code>,
774
614
which invokes <code>my_message_sql()</code>,
775
615
- 'catch' correspond to checking how/if an internal handler was invoked,
776
616
before removing it from the exception stack with
777
<code>THD::pop_internal_handler()</code>.
617
<code>Session::pop_internal_handler()</code>.
779
619
@param sql_errno the error number
780
620
@param level the error level
781
@param thd the calling thread
621
@param session the calling thread
782
622
@return true if the error is handled
784
624
virtual bool handle_error(uint32_t sql_errno,
785
625
const char *message,
786
626
DRIZZLE_ERROR::enum_warning_level level,
627
Session *session) = 0;
869
709
uint32_t m_sql_errno;
872
Copied from thd->server_status when the diagnostics area is assigned.
712
Copied from session->server_status when the diagnostics area is assigned.
873
713
We need this member as some places in the code use the following pattern:
874
thd->server_status|= ...
876
thd->server_status&= ~...
714
session->server_status|= ...
716
session->server_status&= ~...
877
717
Assigned by OK, EOF or ERROR.
879
719
uint32_t m_server_status;
881
721
The number of rows affected by the last statement. This is
882
semantically close to thd->row_count_func, but has a different
883
life cycle. thd->row_count_func stores the value returned by
722
semantically close to session->row_count_func, but has a different
723
life cycle. session->row_count_func stores the value returned by
884
724
function ROW_COUNT() and is cleared only by statements that
885
725
update its value, such as INSERT, UPDATE, DELETE and few others.
886
726
This member is cleared at the beginning of the next statement.
888
We could possibly merge the two, but life cycle of thd->row_count_func
728
We could possibly merge the two, but life cycle of session->row_count_func
889
729
can not be changed.
891
731
ha_rows m_affected_rows;
893
733
Similarly to the previous member, this is a replacement of
894
thd->first_successful_insert_id_in_prev_stmt, which is used
734
session->first_successful_insert_id_in_prev_stmt, which is used
895
735
to implement LAST_INSERT_ID().
897
737
uint64_t m_last_insert_id;
1038
877
time_t start_time, user_time;
1039
878
uint64_t connect_utime, thr_create_utime; // track down slow pthread_create
1040
879
uint64_t start_utime, utime_after_lock;
1042
881
thr_lock_type update_lock_default;
1044
/* <> 0 if we are inside of trigger or stored function. */
1045
uint32_t in_sub_stmt;
884
Both of the following container points in session will be converted to an API.
1047
887
/* container for handler's private per-connection data */
1048
888
Ha_data ha_data[MAX_HA];
890
/* container for replication data */
891
void *replication_data;
892
inline void setReplicationData (void *data) { replication_data= data; }
893
inline void *getReplicationData () { return replication_data; }
1050
895
/* Place to store various things */
1052
int binlog_setup_trx_data();
1055
Public interface to write RBR events to the binlog
1057
void binlog_start_trans_and_stmt();
1058
void binlog_set_stmt_begin();
1059
int binlog_write_table_map(Table *table, bool is_transactional);
1060
int binlog_write_row(Table* table, bool is_transactional,
1061
const unsigned char *new_data);
1062
int binlog_delete_row(Table* table, bool is_transactional,
1063
const unsigned char *old_data);
1064
int binlog_update_row(Table* table, bool is_transactional,
1065
const unsigned char *old_data, const unsigned char *new_data);
896
void *session_marker;
1067
898
void set_server_id(uint32_t sid) { server_id = sid; }
1070
Member functions to handle pending event for row-level logging.
1072
template <class RowsEventT> Rows_log_event*
1073
binlog_prepare_pending_rows_event(Table* table, uint32_t serv_id,
1075
bool is_transactional,
1077
Rows_log_event* binlog_get_pending_rows_event() const;
1078
void binlog_set_pending_rows_event(Rows_log_event* ev);
1079
int binlog_flush_pending_rows_event(bool stmt_end);
1082
901
uint32_t binlog_table_maps; // Number of table maps currently in the binlog
1084
enum enum_binlog_flag {
1085
BINLOG_FLAG_UNSAFE_STMT_PRINTED,
1090
904
Flags with per-thread information regarding the status of the
1186
993
first_successful_insert_id_in_cur_stmt.
1189
stmt_depends_on_first_successful_insert_id_in_prev_stmt is set when
1190
LAST_INSERT_ID() is used by a statement.
1191
If it is set, first_successful_insert_id_in_prev_stmt_for_binlog will be
1192
stored in the statement-based binlog.
1193
This variable is CUMULATIVE along the execution of a stored function or
1194
trigger: if one substatement sets it to 1 it will stay 1 until the
1195
function/trigger ends, thus making sure that
1196
first_successful_insert_id_in_prev_stmt_for_binlog does not change anymore
1197
and is propagated to the caller for binlogging.
1199
bool stmt_depends_on_first_successful_insert_id_in_prev_stmt;
1201
996
List of auto_increment intervals reserved by the thread so far, for
1202
997
storage in the statement-based binlog.
1203
998
Note that its minimum is not first_successful_insert_id_in_cur_stmt:
1430
1215
ulong ulong_value;
1431
1216
uint64_t uint64_t_value;
1436
If true, mysql_bin_log::write(Log_event) call will not write events to
1221
If true, drizzle_bin_log::write(Log_event) call will not write events to
1437
1222
binlog, and maintain 2 below variables instead (use
1438
mysql_bin_log.start_union_events to turn this on)
1223
drizzle_bin_log.start_union_events to turn this on)
1442
If true, at least one mysql_bin_log::write(Log_event) call has been
1443
made after last mysql_bin_log.start_union_events() call.
1227
If true, at least one drizzle_bin_log::write(Log_event) call has been
1228
made after last drizzle_bin_log.start_union_events() call.
1445
1230
bool unioned_events;
1447
If true, at least one mysql_bin_log::write(Log_event e), where
1448
e.cache_stmt == true call has been made after last
1449
mysql_bin_log.start_union_events() call.
1232
If true, at least one drizzle_bin_log::write(Log_event e), where
1233
e.cache_stmt == true call has been made after last
1234
drizzle_bin_log.start_union_events() call.
1451
1236
bool unioned_events_trans;
1454
1239
'queries' (actually SP statements) that run under inside this binlog
1455
union have thd->query_id >= first_query_id.
1240
union have session->query_id >= first_query_id.
1457
1242
query_id_t first_query_id;
1458
1243
} binlog_evt_union;
1467
1252
Lex_input_stream *m_lip;
1472
1257
void init(void);
1474
1259
Initialize memory roots necessary for query processing and (!)
1475
pre-allocate memory for it. We can't do that in THD constructor because
1260
pre-allocate memory for it. We can't do that in Session constructor because
1476
1261
there are use cases (acl_init, watcher threads,
1477
1262
killing mysqld) where it's vital to not allocate excessive and not used
1478
1263
memory. Note, that we still don't return error from init_for_queries():
1479
1264
if preallocation fails, we should notice that at the first call to
1482
1267
void init_for_queries();
1483
void change_user(void);
1484
1268
void cleanup(void);
1485
1269
void cleanup_after_query();
1486
1270
bool store_globals();
1487
void awake(THD::killed_state state_to_set);
1271
void awake(Session::killed_state state_to_set);
1489
1273
enum enum_binlog_query_type {
1491
1275
The query can be logged row-based or statement-based
1493
1277
ROW_QUERY_TYPE,
1496
1280
The query has to be logged statement-based
1498
1282
STMT_QUERY_TYPE,
1501
1285
The query represents a change to a table in the "mysql"
1502
1286
database and is currently mapped to ROW_QUERY_TYPE.
1661
1440
void reset_n_backup_open_tables_state(Open_tables_state *backup);
1662
1441
void restore_backup_open_tables_state(Open_tables_state *backup);
1664
inline void set_current_stmt_binlog_row_based_if_mixed()
1667
If in a stored/function trigger, the caller should already have done the
1668
change. We test in_sub_stmt to prevent introducing bugs where people
1669
wouldn't ensure that, and would switch to row-based mode in the middle
1670
of executing a stored function/trigger (which is too late, see also
1671
reset_current_stmt_binlog_row_based()); this condition will make their
1672
tests fail and so force them to propagate the
1673
lex->binlog_row_based_if_mixed upwards to the caller.
1675
if ((variables.binlog_format == BINLOG_FORMAT_MIXED) &&
1677
current_stmt_binlog_row_based= true;
1679
inline void set_current_stmt_binlog_row_based()
1681
current_stmt_binlog_row_based= true;
1683
inline void clear_current_stmt_binlog_row_based()
1685
current_stmt_binlog_row_based= false;
1687
inline void reset_current_stmt_binlog_row_based()
1690
If there are temporary tables, don't reset back to
1691
statement-based. Indeed it could be that:
1692
CREATE TEMPORARY TABLE t SELECT UUID(); # row-based
1693
# and row-based does not store updates to temp tables
1695
INSERT INTO u SELECT * FROM t; # stmt-based
1696
and then the INSERT will fail as data inserted into t was not logged.
1697
So we continue with row-based until the temp table is dropped.
1698
If we are in a stored function or trigger, we mustn't reset in the
1699
middle of its execution (as the binary logging way of a stored function
1700
or trigger is decided when it starts executing, depending for example on
1701
the caller (for a stored function: if caller is SELECT or
1702
INSERT/UPDATE/DELETE...).
1704
Don't reset binlog format for NDB binlog injector thread.
1706
if ((temporary_tables == NULL) && (in_sub_stmt == 0))
1708
current_stmt_binlog_row_based=
1709
test(variables.binlog_format == BINLOG_FORMAT_ROW);
1714
1444
Set the current database; use deep copy of C-string.
1821
/** A short cut for thd->main_da.set_ok_status(). */
1541
/** A short cut for session->main_da.set_ok_status(). */
1824
my_ok(THD *thd, ha_rows affected_rows= 0, uint64_t id= 0,
1544
my_ok(Session *session, ha_rows affected_rows= 0, uint64_t id= 0,
1825
1545
const char *message= NULL)
1827
thd->main_da.set_ok_status(thd, affected_rows, id, message);
1547
session->main_da.set_ok_status(session, affected_rows, id, message);
1831
/** A short cut for thd->main_da.set_eof_status(). */
1551
/** A short cut for session->main_da.set_eof_status(). */
1554
my_eof(Session *session)
1836
thd->main_da.set_eof_status(thd);
1556
session->main_da.set_eof_status(session);
1839
1559
#define tmp_disable_binlog(A) \
2336
2050
bool get(Table *table);
2337
static double get_use_cost(uint32_t *buffer, uint32_t nkeys, uint32_t key_size,
2338
uint64_t max_in_memory_size);
2339
inline static int get_cost_calc_buff_size(ulong nkeys, uint32_t key_size,
2340
uint64_t max_in_memory_size)
2051
static double get_use_cost(uint32_t *buffer, uint32_t nkeys, uint32_t key_size,
2052
size_t max_in_memory_size);
2053
inline static int get_cost_calc_buff_size(ulong nkeys, uint32_t key_size,
2054
size_t max_in_memory_size)
2342
register uint64_t max_elems_in_tree=
2056
register size_t max_elems_in_tree=
2343
2057
(1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
2344
2058
return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
2454
2168
/* Bits in sql_command_flags */
2456
#define CF_CHANGES_DATA 1
2457
#define CF_HAS_ROW_COUNT 2
2458
#define CF_STATUS_COMMAND 4
2459
#define CF_SHOW_TABLE_COMMAND 8
2460
#define CF_WRITE_LOGS_COMMAND 16
2170
enum sql_command_flag_bits {
2171
CF_BIT_CHANGES_DATA,
2172
CF_BIT_HAS_ROW_COUNT,
2173
CF_BIT_STATUS_COMMAND,
2174
CF_BIT_SHOW_TABLE_COMMAND,
2175
CF_BIT_WRITE_LOGS_COMMAND,
2179
static const std::bitset<CF_BIT_SIZE> CF_CHANGES_DATA(1 << CF_BIT_CHANGES_DATA);
2180
static const std::bitset<CF_BIT_SIZE> CF_HAS_ROW_COUNT(1 << CF_BIT_HAS_ROW_COUNT);
2181
static const std::bitset<CF_BIT_SIZE> CF_STATUS_COMMAND(1 << CF_BIT_STATUS_COMMAND);
2182
static const std::bitset<CF_BIT_SIZE> CF_SHOW_TABLE_COMMAND(1 << CF_BIT_SHOW_TABLE_COMMAND);
2183
static const std::bitset<CF_BIT_SIZE> CF_WRITE_LOGS_COMMAND(1 << CF_BIT_WRITE_LOGS_COMMAND);
2462
2185
/* Functions in sql_class.cc */
2466
2189
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
2467
2190
STATUS_VAR *dec_var);
2192
/* Some inline functions for more speed */
2194
inline bool add_item_to_list(Session *session, Item *item)
2196
return session->lex->current_select->add_item_to_list(session, item);
2199
inline bool add_value_to_list(Session *session, Item *value)
2201
return session->lex->value_list.push_back(value);
2204
inline bool add_order_to_list(Session *session, Item *item, bool asc)
2206
return session->lex->current_select->add_order_to_list(session, item, asc);
2209
inline bool add_group_to_list(Session *session, Item *item, bool asc)
2211
return session->lex->current_select->add_group_to_list(session, item, asc);
2469
2214
#endif /* DRIZZLE_SERVER */
2216
#endif /* DRIZZLED_SQL_CLASS_H */