26
26
#include "drizzled/plugin.h"
27
27
#include <drizzled/sql_locale.h>
28
#include <drizzled/ha_trx_info.h>
28
#include "drizzled/resource_context.h"
29
29
#include <drizzled/cursor.h>
30
30
#include <drizzled/current_session.h>
31
31
#include <drizzled/sql_error.h>
177
179
bool log_warnings;
179
181
uint32_t optimizer_search_depth;
180
/* A bitmap for switching optimizations on/off */
181
uint32_t optimizer_switch;
182
182
uint32_t div_precincrement;
183
183
uint64_t preload_buff_size;
184
184
uint32_t read_buff_size;
316
0: Life time: one statement within a transaction. If @@autocommit is
317
on, also represents the entire transaction.
318
@sa trans_register_ha()
320
1: Life time: one transaction within a connection.
321
If the storage engine does not participate in a transaction,
322
this should not be used.
323
@sa trans_register_ha()
325
Ha_trx_info ha_info[2];
316
* Resource contexts for both the "statement" and "normal"
319
* Resource context at index 0:
321
* Life time: one statement within a transaction. If @@autocommit is
322
* on, also represents the entire transaction.
324
* Resource context at index 1:
326
* Life time: one transaction within a connection.
330
* If the storage engine does not participate in a transaction,
331
* there will not be a resource context.
333
drizzled::ResourceContext resource_context[2];
327
335
Ha_data() :ha_ptr(NULL) {}
409
417
LEX *lex; /**< parse tree descriptor */
411
Points to the query associated with this statement. It's const, but
412
we need to declare it char * because all table handlers are written
413
in C and need to point to it.
415
Note that (A) if we set query = NULL, we must at the same time set
416
query_length = 0, and protect the whole operation with the
417
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
418
non-NULL value if its previous value is NULL. We do not need to protect
419
operation (B) with any mutex. To avoid crashes in races, if we do not
420
know that session->query cannot change at the moment, one should print
421
session->query like this:
422
(1) reserve the LOCK_thread_count mutex;
423
(2) check if session->query is NULL;
424
(3) if not NULL, then print at most session->query_length characters from
425
it. We will see the query_length field as either 0, or the right value
427
Assuming that the write and read of an n-bit memory field in an n-bit
428
computer is atomic, we can avoid races in the above way.
429
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
433
uint32_t query_length; /**< current query length */
418
/** query associated with this statement */
436
422
Name of the current (default) database.
482
* Is this session viewable by the current user?
484
bool isViewable() const
486
return plugin::Authorization::isAuthorized(current_session->getSecurityContext(),
496
492
Used in error messages to tell user in what part of MySQL we found an
497
493
error. E. g. when where= "having clause", if fix_fields() fails, user
498
494
will know that the error was in having clause.
530
526
/* container for handler's private per-connection data */
531
Ha_data ha_data[MAX_HA];
527
std::vector<Ha_data> ha_data;
533
529
Id of current query. Statement can be reused to execute several queries
534
530
query_id is global in context of the whole MySQL server.
540
536
query_id_t query_id;
541
537
query_id_t warn_query_id;
543
void **getEngineData(const plugin::StorageEngine *engine);
544
Ha_trx_info *getEngineInfo(const plugin::StorageEngine *engine,
539
void **getEngineData(const plugin::MonitoredInTransaction *monitored);
540
ResourceContext *getResourceContext(const plugin::MonitoredInTransaction *monitored,
547
543
struct st_transactions {
548
std::deque<drizzled::NamedSavepoint> savepoints;
549
Session_TRANS all; // Trans since BEGIN WORK
550
Session_TRANS stmt; // Trans for current statement
544
std::deque<NamedSavepoint> savepoints;
545
TransactionContext all; ///< Trans since BEGIN WORK
546
TransactionContext stmt; ///< Trans for current statement
551
547
XID_STATE xid_state;
554
Tables changed in transaction (that must be invalidated in query cache).
555
List contain only transactional tables, that not invalidated in query
556
cache (instead of full list of changed in transaction tables).
560
551
savepoints.clear();
1430
1422
/* Work with temporary tables */
1431
1423
Table *find_temporary_table(TableList *table_list);
1432
1424
Table *find_temporary_table(const char *db, const char *table_name);
1425
void doGetTableNames(CachedDirectory &directory,
1426
const std::string& db_name,
1427
std::set<std::string>& set_of_names);
1428
int doGetTableDefinition(const char *path,
1430
const char *table_name,
1432
message::Table *table_proto);
1434
1434
void close_temporary_tables();
1435
1435
void close_temporary_table(Table *table);
1442
1442
int drop_temporary_table(TableList *table_list);
1443
1443
bool rm_temporary_table(plugin::StorageEngine *base, const char *path);
1444
bool rm_temporary_table(plugin::StorageEngine *base, TableIdentifier &identifier);
1444
bool rm_temporary_table(TableIdentifier &identifier);
1445
1445
Table *open_temporary_table(TableIdentifier &identifier,
1446
1446
bool link_in_list= true);
1552
1552
static const std::bitset<CF_BIT_SIZE> CF_WRITE_LOGS_COMMAND(1 << CF_BIT_WRITE_LOGS_COMMAND);
1554
1554
/* Functions in sql_class.cc */
1555
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
1555
void add_to_status(system_status_var *to_var, system_status_var *from_var);
1557
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
1558
STATUS_VAR *dec_var);
1557
void add_diff_to_status(system_status_var *to_var, system_status_var *from_var,
1558
system_status_var *dec_var);
1560
1560
} /* namespace drizzled */