143
144
bool optimizer_prune_level;
144
145
bool log_warnings;
145
146
bool engine_condition_pushdown;
147
bool keep_files_on_create;
147
149
uint32_t optimizer_search_depth;
151
Controls use of Engine-MRR:
152
0 - auto, based on cost
153
1 - force MRR when the storage engine is capable of doing it
156
uint32_t optimizer_use_mrr;
148
157
/* A bitmap for switching optimizations on/off */
149
158
uint32_t optimizer_switch;
150
159
uint32_t div_precincrement;
265
274
void mark_transaction_to_rollback(Session *session, bool all);
269
struct st_savepoint *prev;
272
Ha_trx_info *ha_list;
275
extern pthread_mutex_t LOCK_xid_cache;
276
extern HASH xid_cache;
278
#include <drizzled/security_context.h>
279
#include <drizzled/open_tables_state.h>
281
#include <drizzled/internal_error_handler.h>
282
#include <drizzled/diagnostics_area.h>
285
Storage engine specific thread local data.
290
Storage engine specific thread local data.
291
Lifetime: one user connection.
295
0: Life time: one statement within a transaction. If @@autocommit is
296
on, also represents the entire transaction.
297
@sa trans_register_ha()
299
1: Life time: one transaction within a connection.
300
If the storage engine does not participate in a transaction,
301
this should not be used.
302
@sa trans_register_ha()
304
Ha_trx_info ha_info[2];
306
Ha_data() :ha_ptr(NULL) {}
310
* Represents a client connection to the database server.
312
* Contains the client/server protocol object, the current statement
313
* being executed, local-to-session variables and status counters, and
314
* a host of other information.
318
* Session should NOT inherit from Statement, but rather it should have a
319
* vector of Statement object pointers which comprise the statements executed
320
* on the Session. Until this architectural change is done, we can forget
321
* about parallel operations inside a session.
325
* Make member variables private and have inlined accessors and setters. Hide
326
* all member variables that are not critical to non-internal operations of the
277
* Single command executed against this connection.
281
* One connection can contain a lot of simultaneously running statements,
282
* some of which could be prepared, that is, contain placeholders.
284
* To perform some action with statement we reset Session part to the state of
285
* that statement, do the action, and then save back modified state from Session
286
* to the statement. It will be changed in near future, and Statement will
287
* be used explicitly.
291
* The above comment is bullshit in Drizzle. See TODO markers on Session to
292
* completely detach the inheritance of Session from Statement.
329
class Session : public Open_tables_state
296
Statement(const Statement &rhs); /* not implemented: */
297
Statement &operator=(const Statement &rhs); /* non-copyable */
334
* The elements from here until the END_STATEMENT_VARIABLES below have
335
* been coped from the original Statement class that used to be declared
336
* in this header file. Session used to inherit from that class. Thus, we
337
* copied the elements from Statement that were needed in Session and then
338
* removed the Statement class.
300
* List of items created in the parser for this query. Every item puts
301
* itself to the list on creation (see Item::Item() for details))
304
MEM_ROOT *mem_root; /**< Pointer to current memroot */
306
* Uniquely identifies each statement object in thread scope; change during
307
* statement lifetime.
309
* @todo should be const
342
314
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
343
315
handler of fields used is set
352
324
enum enum_mark_columns mark_used_columns;
353
inline void* alloc(size_t size)
355
return alloc_root(mem_root,size);
357
inline void* calloc(size_t size)
360
if ((ptr= alloc_root(mem_root,size)))
361
memset(ptr, 0, size);
364
inline char *strdup(const char *str)
366
return strdup_root(mem_root,str);
368
inline char *strmake(const char *str, size_t size)
370
return strmake_root(mem_root,str,size);
372
inline void *memdup(const void *str, size_t size)
374
return memdup_root(mem_root,str,size);
376
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
379
if ((ptr= alloc_root(mem_root,size+gap)))
380
memcpy(ptr,str,size);
383
/** Frees all items attached to this Statement */
386
* List of items created in the parser for this query. Every item puts
387
* itself to the list on creation (see Item::Item() for details))
390
MEM_ROOT *mem_root; /**< Pointer to current memroot */
392
* Uniquely identifies each statement object in thread scope; change during
393
* statement lifetime.
395
* @todo should be const
398
326
LEX *lex; /**< parse tree descriptor */
400
328
Points to the query associated with this statement. It's const, but
437
365
uint32_t db_length; /**< Length of current schema name */
438
/**< END_STATEMENT_VARIABLES */
369
/* This constructor is called for backup statements */
372
Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, uint32_t id_arg)
375
mem_root(mem_root_arg),
377
mark_used_columns(MARK_COLUMNS_READ),
384
virtual ~Statement() {}
385
inline void* alloc(size_t size)
387
return alloc_root(mem_root,size);
389
inline void* calloc(size_t size)
392
if ((ptr= alloc_root(mem_root,size)))
393
memset(ptr, 0, size);
396
inline char *strdup(const char *str)
398
return strdup_root(mem_root,str);
400
inline char *strmake(const char *str, size_t size)
402
return strmake_root(mem_root,str,size);
404
inline void *memdup(const void *str, size_t size)
406
return memdup_root(mem_root,str,size);
408
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
411
if ((ptr= alloc_root(mem_root,size+gap)))
412
memcpy(ptr,str,size);
415
/** Frees all items attached to this Statement */
421
struct st_savepoint *prev;
424
Ha_trx_info *ha_list;
427
extern pthread_mutex_t LOCK_xid_cache;
428
extern HASH xid_cache;
430
#include <drizzled/security_context.h>
431
#include <drizzled/open_tables_state.h>
433
#include <drizzled/internal_error_handler.h>
434
#include <drizzled/diagnostics_area.h>
437
Storage engine specific thread local data.
442
Storage engine specific thread local data.
443
Lifetime: one user connection.
447
0: Life time: one statement within a transaction. If @@autocommit is
448
on, also represents the entire transaction.
449
@sa trans_register_ha()
451
1: Life time: one transaction within a connection.
452
If the storage engine does not participate in a transaction,
453
this should not be used.
454
@sa trans_register_ha()
456
Ha_trx_info ha_info[2];
458
Ha_data() :ha_ptr(NULL) {}
462
* Represents a client connection to the database server.
464
* Contains the client/server protocol object, the current statement
465
* being executed, local-to-session variables and status counters, and
466
* a host of other information.
470
* Session should NOT inherit from Statement, but rather it should have a
471
* vector of Statement object pointers which comprise the statements executed
472
* on the Session. Until this architectural change is done, we can forget
473
* about parallel operations inside a session.
477
* Make member variables private and have inlined accessors and setters. Hide
478
* all member variables that are not critical to non-internal operations of the
481
class Session :public Statement, public Open_tables_state
441
485
Constant for Session::where initialization in the beginning of every query.
1224
1269
* @param Database name to connect to, may be NULL
1226
1271
bool checkUser(const char *passwd, uint32_t passwd_len, const char *db);
1229
* Returns the timestamp (in microseconds) of when the Session
1230
* connected to the server.
1232
inline uint64_t getConnectMicroseconds() const
1234
return connect_microseconds;
1238
/** Microsecond timestamp of when Session connected */
1239
uint64_t connect_microseconds;
1240
1274
const char *proc_info;
1242
1276
/** The current internal error handler for this thread, or NULL. */
1333
1367
* used by this thread if we are on the upper level.
1335
1369
void close_thread_tables();
1336
void close_old_data_files(bool morph_locks= false,
1337
bool send_refresh= false);
1370
void close_old_data_files(bool morph_locks, bool send_refresh);
1338
1371
void close_open_tables();
1339
1372
void close_data_files_and_morph_locks(const char *db, const char *table_name);
1342
bool free_cached_table();
1346
1374
* Prepares statement for reopening of tables and recalculation of set of
1347
1375
* prelocked tables.
1385
1410
* This is to be used on prepare stage when you don't read any
1386
1411
* data from the tables.
1388
bool openTables(TableList *tables, uint32_t flags= 0);
1390
int open_tables_from_list(TableList **start, uint32_t *counter, uint32_t flags= 0);
1392
Table *openTableLock(TableList *table_list, thr_lock_type lock_type);
1393
Table *openTable(TableList *table_list, bool *refresh, uint32_t flags= 0);
1413
bool open_normal_and_derived_tables(TableList *tables, uint32_t flags);
1414
int open_tables_from_list(TableList **start, uint32_t *counter, uint32_t flags);
1415
Table *open_ltable(TableList *table_list, thr_lock_type lock_type);
1416
Table *open_table(TableList *table_list, bool *refresh, uint32_t flags);
1395
1417
void unlink_open_table(Table *find);
1396
1418
void drop_open_table(Table *table, const char *db_name,
1397
1419
const char *table_name);
1407
1429
Table *find_temporary_table(const char *db, const char *table_name);
1408
1430
void close_temporary_tables();
1409
1431
void close_temporary_table(Table *table, bool free_share, bool delete_table);
1410
void close_temporary(Table *table, bool free_share, bool delete_table);
1411
1432
int drop_temporary_table(TableList *table_list);
1412
bool rm_temporary_table(StorageEngine *base, char *path);
1413
Table *open_temporary_table(const char *path, const char *db,
1414
const char *table_name, bool link_in_list,
1415
open_table_mode open_mode);
1417
1434
/* Reopen operations */
1418
1435
bool reopen_tables(bool get_locks, bool mark_share_as_old);
1419
1436
bool reopen_name_locked_table(TableList* table_list, bool link_in);
1420
bool close_cached_tables(TableList *tables, bool wait_for_refresh, bool wait_for_placeholders);
1422
1438
void wait_for_condition(pthread_mutex_t *mutex, pthread_cond_t *cond);
1423
int setup_conds(TableList *leaves, COND **conds);
1424
int lock_tables(TableList *tables, uint32_t count, bool *need_reopen);