Classes | |
class | impl_c |
Public Types | |
enum | global_read_lock_t { NONE = 0, GOT_GLOBAL_READ_LOCK = 1, MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT = 2 } |
enum | killed_state_t { NOT_KILLED, KILL_BAD_DATA, KILL_CONNECTION, KILL_QUERY, KILLED_NO_VALUE } |
typedef boost::shared_ptr < Session > | shared_ptr |
typedef boost::shared_ptr < const std::string > | QueryString |
typedef boost::unordered_map < std::string, user_var_entry *, util::insensitive_hash, util::insensitive_equal_to > | UserVars |
Public Member Functions | |
void | free_items () |
uint64_t | getXaId () const |
void | setXaId (uint64_t in_xa_id) |
Diagnostics_area & | main_da () |
const LEX & | lex () const |
LEX & | lex () |
enum_sql_command | getSqlCommand () const |
void | resetQueryString () |
const boost::shared_ptr < session::State > & | state () |
QueryString | getQueryString () const |
const char * | getQueryStringCopy (size_t &length) |
util::string::ptr | schema () const |
void | setClient (plugin::Client *client_arg) |
plugin::Client * | getClient () const |
const UserVars & | getUserVariables () const |
enum_tx_isolation | getTxIsolation () const |
identifier::user::ptr | user () const |
void | setUser (identifier::user::mptr arg) |
int32_t | getScoreboardIndex () const |
void | setScoreboardIndex (int32_t in_scoreboard_index) |
bool | isOriginatingServerUUIDSet () const |
void | setOriginatingServerUUID (std::string in_originating_server_uuid) |
const std::string & | getOriginatingServerUUID () const |
void | setOriginatingCommitID (uint64_t in_originating_commit_id) |
uint64_t | getOriginatingCommitID () const |
bool | isViewable (const identifier::User &) const |
const char * | where () const |
void | setWhere (const char *arg) |
thread_ptr & | getThread () |
void | pushInterrupt (boost::this_thread::disable_interruption *interrupt_arg) |
boost::this_thread::disable_interruption & | getThreadInterupt () |
internal::st_my_thread_var * | getThreadVar () |
void ** | getEngineData (const plugin::MonitoredInTransaction *monitored) |
ResourceContext & | getResourceContext (const plugin::MonitoredInTransaction &, size_t index=0) |
void | setConcurrentExecute (bool arg) |
bool | isConcurrentExecuteAllowed () const |
int64_t | rowCount () const |
global_read_lock_t | isGlobalReadLock () const |
void | setGlobalReadLock (global_read_lock_t arg) |
DrizzleLock * | lockTables (Table **tables, uint32_t count, uint32_t flags) |
bool | lockGlobalReadLock () |
bool | lock_table_names (TableList *table_list) |
bool | lock_table_names_exclusively (TableList *table_list) |
bool | makeGlobalReadLockBlockCommit () |
bool | abortLockForThread (Table *table) |
bool | wait_if_global_read_lock (bool abort_on_refresh, bool is_not_commit) |
int | lock_table_name (TableList *table_list) |
void | abortLock (Table *table) |
void | removeLock (Table *table) |
void | unlockReadTables (DrizzleLock *sql_lock) |
void | unlockSomeTables (Table **table, uint32_t count) |
void | unlockTables (DrizzleLock *sql_lock) |
void | startWaitingGlobalReadLock () |
void | unlockGlobalReadLock () |
void | setKilled (killed_state_t arg) |
killed_state_t | getKilled () const |
volatile killed_state_t * | getKilledPtr () |
bool | doing_tablespace_operation () const |
void | setDoingTablespaceOperation (bool doing) |
void | set_proc_info (const char *info) |
const char * | get_proc_info () const |
void | setQueryId (query_id_t in_query_id) |
query_id_t | getQueryId () const |
void | setWarningQueryId (query_id_t in_query_id) |
query_id_t | getWarningQueryId () const |
session_id_t | getSessionId () const |
uint32_t | getServerId () const |
std::string & | getServerUUID () const |
void | record_first_successful_insert_id_in_cur_stmt (uint64_t id_arg) |
uint64_t | read_first_successful_insert_id_in_prev_stmt () const |
Session (plugin::Client *, boost::shared_ptr< catalog::Instance >) | |
void | cleanup () |
void | cleanup_after_query () |
void | storeGlobals () |
void | awake (Session::killed_state_t state_to_set) |
void | prepareForQueries () |
bool | executeStatement () |
void | readAndStoreQuery (str_ref) |
bool | endTransaction (enum enum_mysql_completiontype completion) |
bool | endActiveTransaction () |
bool | startTransaction (start_transaction_option_t opt=START_TRANS_NO_OPTIONS) |
void | markTransactionForRollback (bool all) |
bool | authenticate () |
void | run () |
const char * | enter_cond (boost::condition_variable_any &cond, boost::mutex &mutex, const char *msg) |
void | exit_cond (const char *old_msg) |
uint64_t | found_rows () const |
bool | inTransaction () const |
lex_string_t * | make_lex_string (lex_string_t *, str_ref) |
void | send_explain_fields (select_result *) |
void | clear_error (bool full=false) |
void | clearDiagnostics () |
bool | is_error () const |
void | end_statement () |
int | killed_errno () const |
void | send_kill_message () const |
bool | abortOnWarning () |
void | setAbortOnWarning (bool arg) |
void | setAbort (bool arg) |
void | lockOnSys () |
void | set_status_var_init () |
void | set_schema (const std::string &) |
str_ref | copy_db_to () const |
void | reset_for_next_command () |
void | disconnect (enum error_t errcode=EE_OK) |
bool | checkUser (const std::string &passwd, const std::string &db) |
message::Transaction * | getTransactionMessage () const |
message::Statement * | getStatementMessage () const |
message::Resultset * | getResultsetMessage () const |
void | setTransactionMessage (message::Transaction *in_message) |
void | setStatementMessage (message::Statement *in_message) |
void | setResultsetMessage (message::Resultset *in_message) |
void | resetResultsetMessage () |
plugin::EventObserverList * | getSessionObservers () |
void | setSessionObservers (plugin::EventObserverList *observers) |
plugin::EventObserverList * | getSchemaObservers (const std::string &schema) |
plugin::EventObserverList * | setSchemaObservers (const std::string &schema, plugin::EventObserverList *) |
void | my_ok (ha_rows affected_rows=0, ha_rows found_rows_arg=0, uint64_t passed_id=0, const char *message=NULL) |
void | my_eof () |
void | add_item_to_list (Item *item) |
void | add_value_to_list (Item *value) |
void | add_order_to_list (Item *item, bool asc) |
void | add_group_to_list (Item *item, bool asc) |
void | refresh_status () |
user_var_entry * | getVariable (str_ref name, bool create_if_not_exists) |
void | setVariable (const std::string &name, const std::string &value) |
void | close_thread_tables () |
void | close_old_data_files (bool morph_locks=false, bool send_refresh=false) |
void | close_data_files_and_morph_locks (const identifier::Table &) |
void | close_tables_for_reopen (TableList **tables) |
bool | openTablesLock (TableList *) |
Table * | open_temporary_table (const identifier::Table &identifier, bool link_in_list=true) |
int | open_tables_from_list (TableList **start, uint32_t *counter, uint32_t flags=0) |
Table * | openTableLock (TableList *table_list, thr_lock_type lock_type) |
Table * | openTable (TableList *table_list, bool *refresh, uint32_t flags=0) |
void | unlink_open_table (Table *find) |
void | drop_open_table (Table *table, const identifier::Table &identifier) |
void | close_cached_table (Table *table) |
table::Placeholder & | table_cache_insert_placeholder (const identifier::Table &) |
Table * | lock_table_name_if_not_cached (const identifier::Table &) |
session::TableMessages & | getMessageCache () |
bool | reopen_tables () |
bool | close_cached_tables (TableList *tables, bool wait_for_refresh, bool wait_for_placeholders) |
void | wait_for_condition (boost::mutex &mutex, boost::condition_variable_any &cond) |
int | setup_conds (TableList *leaves, COND **conds) |
int | lock_tables (TableList *tables, uint32_t count, bool *need_reopen) |
template<class T > | |
T * | getProperty (const std::string &name) |
template<class T > | |
T | setProperty (const std::string &name, T value) |
plugin::StorageEngine * | getDefaultStorageEngine () |
void | get_xid (DrizzleXid *xid) const |
table::Singular & | getInstanceTable () |
table::Singular & | getInstanceTable (std::list< CreateField > &) |
void | setUsage (bool arg) |
const rusage & | getUsage () |
const catalog::Instance & | catalog () const |
catalog::Instance & | catalog () |
Static Public Member Functions | |
static shared_ptr | make_shared (plugin::Client *client, boost::shared_ptr< catalog::Instance > instance_arg) |
static bool | schedule (const Session::shared_ptr &) |
static void | unlink (session_id_t &) |
static void | unlink (const Session::shared_ptr &) |
static const charset_info_st * | charset () |
Public Attributes | |
enum_mark_columns | mark_used_columns |
Item * | free_list |
memory::Root & | mem |
memory::Root * | mem_root |
memory::Root | warn_root |
plugin::Scheduler * | scheduler |
drizzle_system_variables & | variables |
system_status_var & | status_var |
THR_LOCK_INFO | lock_info |
THR_LOCK_OWNER | main_lock_id |
THR_LOCK_OWNER * | lock_id |
char * | thread_stack |
enum_server_command | command |
thr_lock_type | update_lock_default |
session::Transactions & | transaction |
Open_tables_state & | open_tables |
session::Times & | times |
Field * | dup_field |
sigset_t | signals |
uint64_t | first_successful_insert_id_in_prev_stmt |
uint64_t | first_successful_insert_id_in_cur_stmt |
uint64_t | limit_found_rows |
uint64_t | options |
int64_t | row_count_func |
ha_rows | cuted_fields |
ha_rows | sent_row_count |
ha_rows | examined_row_count |
table_map | used_tables |
uint32_t | warn_count [(uint32_t) DRIZZLE_ERROR::WARN_LEVEL_END] |
uint32_t | total_warn_count |
uint32_t | row_count |
session_id_t | thread_id |
uint32_t | tmp_table |
uint32_t | server_status |
uint32_t | open_options |
uint32_t | select_number |
enum_tx_isolation | session_tx_isolation |
enum_check_fields | count_cuted_fields |
bool | is_admin_connection |
bool | no_errors |
bool | is_fatal_error |
bool | transaction_rollback_request |
bool | is_fatal_sub_stmt_error |
bool | substitute_null_with_insert_id |
bool | cleanup_done |
bool | got_warning |
bool | no_warnings_for_error |
bool | derived_tables_processing |
union { | |
bool bool_value | |
uint32_t uint32_t_value | |
int32_t int32_t_value | |
uint64_t uint64_t_value | |
} | sys_var_tmp |
Lex_input_stream * | m_lip |
void * | session_marker |
bool | arg_of_last_insert_id_function |
Static Public Attributes | |
static const char *const | DEFAULT_WHERE = "field list" |
Private Types | |
typedef std::pair < UserVars::iterator, UserVars::iterator > | UserVarsRange |
Private Member Functions | |
int | unlock_external (Table **table, uint32_t count) |
int | lock_external (Table **tables, uint32_t count) |
bool | wait_for_locked_table_names (TableList *table_list) |
DrizzleLock * | get_lock_data (Table **table_ptr, uint32_t count, bool should_lock, Table **write_lock_used) |
drizzled::util::Storable * | getProperty0 (const std::string &) |
void | setProperty0 (const std::string &, drizzled::util::Storable *) |
bool | resetUsage () |
Private Attributes | |
boost::scoped_ptr< impl_c > | impl_ |
boost::shared_ptr< std::string > | query |
UserVars | user_vars |
const char * | _where |
boost::thread::id | boost_thread_id |
thread_ptr | _thread |
boost::this_thread::disable_interruption * | interrupt |
internal::st_my_thread_var * | mysys_var |
std::vector< Ha_data > | ha_data |
query_id_t | query_id |
query_id_t | warn_query_id |
global_read_lock_t | _global_read_lock |
killed_state_t volatile | _killed |
boost::shared_ptr < catalog::Instance > | _catalog |
message::Transaction * | transaction_message |
message::Statement * | statement_message |
message::Resultset * | resultset |
plugin::EventObserverList * | session_event_observers |
uint64_t | xa_id |
const char * | proc_info |
bool | abort_on_warning |
bool | concurrent_execute_allowed |
bool | tablespace_op |
bool | use_usage |
rusage | usage |
identifier::user::mptr | security_ctx |
int32_t | scoreboard_index |
bool | originating_server_uuid_set |
std::string | originating_server_uuid |
uint64_t | originating_commit_id |
plugin::Client * | client |
typedef boost::shared_ptr<const std::string> drizzled::Session::QueryString |
bool drizzled::Session::authenticate | ( | void | ) |
Authenticates users, with error reporting.
Returns true on success, or false on failure.
Definition at line 649 of file session.cc.
References drizzled::plugin::Client::authenticate().
bool drizzled::Session::checkUser | ( | const std::string & | passwd, |
const std::string & | db | ||
) |
Check if user exists and the password supplied is correct.
Returns true on success, and false on failure.
passwd | Scrambled password received from client |
db | Database name to connect to, may be NULL |
Definition at line 659 of file session.cc.
References my_ok().
void drizzled::Session::cleanup_after_query | ( | ) |
Cleans up after query.
This function is used to reset thread data to its default state.
This function is not suitable for setting thread data to some non-default values, as there is only one replication thread, so different master threads may overwrite data of each other on slave.
Definition at line 811 of file session.cc.
References _where, DEFAULT_WHERE, first_successful_insert_id_in_cur_stmt, first_successful_insert_id_in_prev_stmt, free_items(), and substitute_null_with_insert_id.
Referenced by drizzled::parse().
void drizzled::Session::close_data_files_and_morph_locks | ( | const identifier::Table & | identifier) |
Close all instances of a table open by this thread and replace them with exclusive name-locks.
session | Thread context |
db | Database name for the table to be closed |
table_name | Name of the table to be closed |
Definition at line 1125 of file sql_base.cc.
Referenced by drizzled::internal_alter_table().
void drizzled::Session::close_old_data_files | ( | bool | morph_locks = false , |
bool | send_refresh = false |
||
) |
Close handlers for tables in list, but leave the Table structure intact so that we can re-open these quickly.
session | Thread context |
table | Head of the list of Table objects |
morph_locks | true - remove locks which we have on tables being closed but ensure that no DML or DDL will sneak in before we will re-open the table (i.e. temporarily morph our table-level locks into name-locks). false - otherwise |
send_refresh | Should we awake waiters even if we didn't close any tables? |
Definition at line 1258 of file sql_base.cc.
References drizzled::locking::broadcast_refresh(), drizzled::Table::db_stat, and drizzled::Table::lock_count.
void drizzled::Session::close_tables_for_reopen | ( | TableList ** | tables) |
Prepares statement for reopening of tables and recalculation of set of prelocked tables.
Pointer | to a pointer to a list of tables which we were trying to open and lock |
Definition at line 1753 of file session.cc.
References close_thread_tables(), and drizzled::TableList::next_global.
Referenced by openTablesLock().
void drizzled::Session::close_thread_tables | ( | ) |
Closes all tables used by the current substatement, or all tables used by this thread if we are on the upper level.
Definition at line 1714 of file session.cc.
References drizzled::TransactionServices::autocommitOrRollback(), drizzled::Diagnostics_area::can_overwrite_status, drizzled::Open_tables_state::close_open_tables(), is_error(), drizzled::Open_tables_state::mark_temp_tables_as_free_for_reuse(), drizzled::Open_tables_state::open_tables_, and drizzled::session::Transactions::stmt.
Referenced by close_tables_for_reopen(), and drizzled::dispatch_command().
void drizzled::Session::disconnect | ( | enum error_t | errcode = EE_OK ) |
Disconnects the session from a client connection and updates any status variables necessary.
errcode | Error code to print to console |
Definition at line 1525 of file session.cc.
References drizzled::plugin::Client::close(), drizzled::plugin::Client::isConnected(), and variables.
void drizzled::Session::drop_open_table | ( | Table * | table, |
const identifier::Table & | identifier | ||
) |
Auxiliary routine which closes and drops open table.
session | Thread handle |
table | Table object for table to be dropped |
db_name | Name of database for this table |
table_name | Name of this table |
Definition at line 647 of file sql_base.cc.
void drizzled::Session::end_statement | ( | ) |
Cleanup statement parse state (parse tree, lex) and execution state after execution of a non-prepared SQL statement.
Move this to Statement::~Statement
Definition at line 1462 of file session.cc.
References resetResultsetMessage().
Referenced by drizzled::parse().
bool drizzled::Session::endTransaction | ( | enum enum_mysql_completiontype | completion) |
Ends the current transaction and (maybe) begins the next.
Returns true if the transaction completed successfully, otherwise false.
Completion | type |
Definition at line 720 of file session.cc.
References drizzled::TransactionServices::commitTransaction(), and options.
bool drizzled::Session::executeStatement | ( | ) |
Executes a single statement received from the client connection.
Returns true if the statement was successful, or false otherwise.
For profiling to work, it must never be called recursively.
In MySQL, this used to be the do_command() C function whic accepted a single parameter of the THD pointer.
Definition at line 677 of file session.cc.
References command, drizzled::dispatch_command(), drizzled::plugin::Client::readCommand(), and drizzled::Diagnostics_area::reset_diagnostics_area().
void drizzled::Session::free_items | ( | ) |
Frees all items attached to this Statement
Definition at line 351 of file session.cc.
References free_list.
Referenced by cleanup_after_query().
plugin::StorageEngine * drizzled::Session::getDefaultStorageEngine | ( | ) |
Return the default storage engine
getDefaultStorageEngine() |
Definition at line 1889 of file session.cc.
References variables.
Referenced by drizzled::statement::CreateTable::execute().
table::Singular & drizzled::Session::getInstanceTable | ( | std::list< CreateField > & | field_list) |
Create a reduced Table object with properly set up Field list from a list of field definitions.
The created table doesn't have a table Cursor associated with it, has no keys, no group/distinct, no copy_funcs array. The sole purpose of this Table object is to use the power of Field class to read/write data to/from table->getInsertRecord(). Then one can store the record in any container (RB tree, hash, etc). The table is created in Session mem_root, so are the table's fields. Consequently, if you don't BLOB fields, you don't need to free it.
session | connection handle |
field_list | list of column definitions |
Definition at line 1838 of file session.cc.
|
inline |
Returns the current query ID
Definition at line 625 of file session.h.
Referenced by drizzled::plugin::QueryLog::afterStatement(), drizzled::Item_func_get_user_var::const_item(), innobase_mysql_print_thd(), drizzled::Open_tables_state::mark_temp_tables_as_free_for_reuse(), and drizzled::TransactionServices::registerResourceForTransaction().
|
inline |
|
inline |
Accessor method returning the server's ID.
Definition at line 650 of file session.h.
Referenced by drizzled::TransactionServices::initTransactionMessage().
|
inline |
Accessor method returning the session's ID.
Definition at line 644 of file session.h.
Referenced by drizzled::plugin::QueryLog::afterStatement(), Scoreboard::findScoreboardSlotToLog(), innobase_mysql_print_thd(), user_locks::IsFreeLock::val_int(), user_locks::ReleaseLock::val_int(), user_locks::barriers::WaitUntil::val_int(), user_locks::barriers::Release::val_int(), user_locks::locks::WaitFor::val_int(), user_locks::barriers::CreateBarrier::val_int(), user_locks::locks::ReleaseAndWait::val_int(), and user_locks::barriers::Wait::val_int().
|
inline |
Returns a pointer to the active Statement message for this Session, or NULL if no active message.
Definition at line 896 of file session.h.
Referenced by drizzled::TransactionServices::autocommitOrRollback(), drizzled::TransactionServices::commitTransactionMessage(), drizzled::TransactionServices::getDeleteStatement(), drizzled::TransactionServices::getInsertStatement(), drizzled::TransactionServices::getUpdateStatement(), and drizzled::TransactionServices::rollbackStatementMessage().
|
inline |
Returns a pointer to the active Transaction message for this Session being managed by the ReplicationServices component, or NULL if no active message.
Definition at line 887 of file session.h.
Referenced by drizzled::TransactionServices::commitTransactionMessage(), drizzled::TransactionServices::getActiveTransactionMessage(), and drizzled::TransactionServices::setSavepoint().
|
inline |
|
inline |
Returns whether the session is currently inside a transaction
Definition at line 771 of file session.h.
Referenced by drizzled::statement::Truncate::execute(), and drizzled::execute_command().
bool drizzled::Session::is_error | ( | ) | const |
true if there is an error in the error stack.
Please use this method instead of direct access to net.report_error.
If true, the current (sub)-statement should be aborted. The main difference between this member and is_fatal_error is that a fatal error can not be handled by a stored procedure continue handler, whereas a normal error can.
To raise this flag, use my_error().
Definition at line 1871 of file session.cc.
Referenced by drizzled::plugin::QueryLog::afterStatement(), close_thread_tables(), drizzled::copy_funcs(), drizzled::delete_query(), drizzled::dispatch_command(), drizzled::do_select(), drizzled::evaluate_join_record(), drizzled::Join::exec(), drizzled::execute_command(), drizzled::handle_select(), drizzled::insert_query(), drizzled::internal_alter_table(), drizzled::Join::optimize(), drizzled::parse(), drizzled::parse_sql(), drizzled::Join::prepare(), drizzled::select_query(), drizzled::sql_set_variables(), and drizzled::update_query().
bool drizzled::Session::isViewable | ( | const identifier::User & | user_arg) | const |
Is this session viewable by the current user?
Definition at line 618 of file session.cc.
References drizzled::plugin::Authorization::isAuthorized().
Table * drizzled::Session::lock_table_name_if_not_cached | ( | const identifier::Table & | identifier) |
Obtain an exclusive name lock on the table if it is not cached in the table cache.
session | Thread context | |
db | Name of database | |
table_name | Name of table | |
[out] | table | Out parameter which is either:
|
true | Error occured (OOM) |
false | Success. 'table' parameter set according to above rules. |
Definition at line 760 of file sql_base.cc.
Referenced by drizzled::drizzle_create_table().
lex_string_t * drizzled::Session::make_lex_string | ( | lex_string_t * | lex_str, |
str_ref | str | ||
) |
Create a lex_string_t in this connection.
lex_str | pointer to lex_string_t object to be initialized |
str | initializer to be copied into lex_str |
length | length of str, in bytes |
allocate_lex_string | if true, allocate new lex_string_t object, instead of using lex_str value |
Definition at line 847 of file session.cc.
References mem_root, and drizzled::memory::Root::strdup().
Referenced by drizzled::_schema_select(), and ha_innobase::get_foreign_key_list().
void drizzled::Session::markTransactionForRollback | ( | bool | all) |
Mark transaction to rollback and mark error as fatal to a sub-statement.
session | Thread handle |
all | true <=> rollback main transaction(). |
Definition at line 1519 of file session.cc.
References is_fatal_sub_stmt_error, and transaction_rollback_request.
Referenced by convert_error_code_to_mysql().
void drizzled::Session::my_eof | ( | ) |
A short cut for session->main_da().set_eof_status().
Definition at line 1884 of file session.cc.
References drizzled::Diagnostics_area::set_eof_status().
Referenced by drizzled::dispatch_command().
void drizzled::Session::my_ok | ( | ha_rows | affected_rows = 0 , |
ha_rows | found_rows_arg = 0 , |
||
uint64_t | passed_id = 0 , |
||
const char * | message = NULL |
||
) |
A short cut for session->main_da().set_ok_status().
Definition at line 1877 of file session.cc.
References drizzled::Diagnostics_area::set_ok_status().
Referenced by checkUser(), drizzled::delete_query(), drizzled::dispatch_command(), drizzled::statement::SetOption::execute(), drizzled::statement::Kill::execute(), drizzled::statement::Rollback::execute(), drizzled::statement::ChangeSchema::execute(), drizzled::statement::UnlockTables::execute(), drizzled::statement::EmptyQuery::execute(), drizzled::statement::Savepoint::execute(), drizzled::statement::Commit::execute(), drizzled::statement::ReleaseSavepoint::execute(), drizzled::statement::RollbackToSavepoint::execute(), drizzled::statement::StartTransaction::execute(), drizzled::statement::Flush::execute(), drizzled::insert_query(), drizzled::internal_alter_table(), and drizzled::update_query().
bool drizzled::Session::openTablesLock | ( | TableList * | tables) |
Open all tables in list, locks them (all, including derived)
Pointer | to a list of tables for open & locking |
false | - ok |
true | - error |
The lock will automaticaly be freed by close_thread_tables()
Definition at line 1767 of file session.cc.
References close_tables_for_reopen().
Referenced by drizzled::delete_query(), drizzled::insert_query(), and drizzled::update_query().
void drizzled::Session::prepareForQueries | ( | ) |
Initialize memory roots necessary for query processing and (!) pre-allocate memory for it. We can't do that in Session constructor because there are use cases where it's vital to not allocate excessive and not used memory.
Definition at line 538 of file session.cc.
References command, options, drizzled::memory::Root::reset_defaults(), set_proc_info(), and variables.
void drizzled::Session::readAndStoreQuery | ( | str_ref | v) |
Reads a query from packet and stores it.
Returns true if query is read and allocated successfully, false otherwise. On a return of false, Session::fatal_error is set.
Sets the following Session variables:
The | packet pointer to read from |
The | length of the query to read |
Definition at line 706 of file session.cc.
References drizzled::plugin::QueryRewriter::rewriteQuery().
Referenced by drizzled::dispatch_command().
bool drizzled::Session::reopen_tables | ( | ) |
Reopen all tables with closed data files.
session | Thread context |
get_locks | Should we get locks after reopening tables ? |
mark_share_as_old | Mark share as old to protect from a impending global read lock. |
Definition at line 1175 of file sql_base.cc.
References drizzled::locking::broadcast_refresh().
void drizzled::Session::reset_for_next_command | ( | ) |
Resets Session part responsible for command processing state.
This needs to be called before execution of every statement (prepared or conventional). It is not called by substatements of routines.
Make it a method of Session and align its name with the rest of reset/end/start/init methods.
Call it after we use Session for queries, not before.
Definition at line 1562 of file session.cc.
References examined_row_count, free_list, is_fatal_error, drizzled::Diagnostics_area::reset_diagnostics_area(), select_number, and sent_row_count.
Referenced by drizzled::parse().
|
inline |
reset the active Resultset message used by the Query Cache plugin.
Definition at line 946 of file session.h.
Referenced by end_statement().
|
inline |
Points to info-string that we show in SHOW PROCESSLIST You are supposed to call Session_SET_PROC_INFO only if you have coded a time-consuming piece that MySQL can get stuck in for a long time.
Set it using the session_proc_info(Session *thread, const char *message) macro/function.
Definition at line 609 of file session.h.
Referenced by drizzled::delete_query(), drizzled::dispatch_command(), drizzled::Join::exec(), drizzled::execute_command(), drizzled::insert_query(), drizzled::internal_alter_table(), drizzled::Join::optimize(), drizzled::parse(), prepareForQueries(), drizzled::select_query(), and drizzled::update_query().
void drizzled::Session::set_schema | ( | const std::string & | new_db) |
Set the current database; use deep copy of C-string.
new_db | a pointer to the new database name. |
new_db_len | length of the new database name. |
Initialize the current database from a NULL-terminated string with length. If we run out of memory, we free the current database and return true. This way the user will notice the error as there will be no current database selected (in addition to the error message set by malloc).
Definition at line 1507 of file session.cc.
|
inline |
Sets this Session's current query ID
Definition at line 619 of file session.h.
Referenced by drizzled::dispatch_command().
|
inline |
|
inline |
Sets the active statement message used by the ReplicationServices component.
[in] | Pointer | to the message |
Definition at line 926 of file session.h.
Referenced by drizzled::TransactionServices::cleanupTransactionMessage(), drizzled::TransactionServices::finalizeStatementMessage(), drizzled::TransactionServices::getDeleteStatement(), drizzled::TransactionServices::getInsertStatement(), drizzled::TransactionServices::getUpdateStatement(), and drizzled::TransactionServices::rollbackStatementMessage().
|
inline |
Sets the active transaction message used by the ReplicationServices component.
[in] | Pointer | to the message |
Definition at line 915 of file session.h.
Referenced by drizzled::TransactionServices::cleanupTransactionMessage(), and drizzled::TransactionServices::getActiveTransactionMessage().
|
inline |
table::Placeholder & drizzled::Session::table_cache_insert_placeholder | ( | const identifier::Table & | arg) |
Create and insert into table cache placeholder for table which will prevent its opening (or creation) (a.k.a lock table name).
session | Thread context |
key | Table cache key for name to be locked |
key_length | Table cache key length |
Definition at line 722 of file sql_base.cc.
void drizzled::Session::unlink_open_table | ( | Table * | find) |
Remove all instances of table from thread's open list and table cache.
session | Thread context |
find | Table to remove |
Definition at line 591 of file sql_base.cc.
References drizzled::locking::broadcast_refresh().
Referenced by drizzled::drizzle_create_table(), and drizzled::internal_alter_table().
|
private |
Used in error messages to tell user in what part of MySQL we found an error. E. g. when where= "having clause", if fix_fields() fails, user will know that the error was in having clause.
Definition at line 270 of file session.h.
Referenced by cleanup_after_query().
enum_server_command drizzled::Session::command |
Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from first byte of the packet in executeStatement()
Definition at line 322 of file session.h.
Referenced by drizzled::plugin::QueryLog::afterStatement(), drizzled::dispatch_command(), executeStatement(), and prepareForQueries().
ha_rows drizzled::Session::cuted_fields |
Count of "cut" or truncated fields.
Definition at line 408 of file session.h.
Referenced by drizzled::insert_query(), drizzled::internal_alter_table(), drizzled::Field::set_warning(), drizzled::store_val_in_field(), and drizzled::update_query().
|
static |
Constant for Session::where initialization in the beginning of every query.
It's needed because we do not save/restore Session::where normally during primary (non subselect) query execution.
Definition at line 174 of file session.h.
Referenced by cleanup_after_query().
bool drizzled::Session::derived_tables_processing |
set during loop of derived table processing
Definition at line 567 of file session.h.
Referenced by drizzled::Join::prepare().
ha_rows drizzled::Session::examined_row_count |
Number of rows we read, sent or not, including in create_sort_index()
Definition at line 419 of file session.h.
Referenced by drizzled::plugin::QueryLog::afterStatement(), drizzled::Join::exec(), and reset_for_next_command().
uint64_t drizzled::Session::first_successful_insert_id_in_cur_stmt |
This is the first autogenerated insert id which was successfully inserted by the current statement. It is maintained only to set first_successful_insert_id_in_prev_stmt when statement ends.
Definition at line 385 of file session.h.
Referenced by cleanup_after_query(), and drizzled::insert_query().
uint64_t drizzled::Session::first_successful_insert_id_in_prev_stmt |
This is the first autogenerated insert id which was successfully inserted by the previous statement (exactly, if the previous statement didn't successfully insert an autogenerated insert id, then it's the one of the statement before, etc). It can also be set by SET LAST_INSERT_ID=# or SELECT LAST_INSERT_ID(#). It is returned by LAST_INSERT_ID().
Definition at line 379 of file session.h.
Referenced by cleanup_after_query(), drizzled::insert_query(), drizzled::remove_eq_conds(), drizzled::update_query(), and drizzled::Item_func_last_insert_id::val_int().
Item* drizzled::Session::free_list |
List of items created in the parser for this query. Every item puts itself to the list on creation (see Item::Item() for details))
Definition at line 116 of file session.h.
Referenced by free_items(), drizzled::Item::Item(), and reset_for_next_command().
bool drizzled::Session::got_warning |
Set on call to push_warning()
Definition at line 564 of file session.h.
Referenced by drizzled::Field_decimal::store().
bool drizzled::Session::is_fatal_error |
Set to true if execution of the current compound statement can not continue. In particular, disables activation of CONTINUE or EXIT handlers of stored routines. Reset in the end of processing of the current user request, in
Definition at line 540 of file session.h.
Referenced by drizzled::add_ref_to_table_cond(), drizzled::change_refs_to_tmp_fields(), drizzled::create_tmp_table(), drizzled::delete_query(), drizzled::Join::exec(), drizzled::subselect_hash_sj_engine::exec(), drizzled::find_order_in_list(), drizzled::Join::optimize(), drizzled::parse_sql(), reset_for_next_command(), and drizzle_plugin::ClientMySQLProtocol::writeEOFPacket().
bool drizzled::Session::is_fatal_sub_stmt_error |
true if we are in a sub-statement and the current error can not be safely recovered until we left the sub-statement mode. In particular, disables activation of CONTINUE and EXIT handlers inside sub-statements. E.g. if it is a deadlock error and requires a transaction-wide rollback, this flag is raised (traditionally, MySQL first has to close all the reads via
Definition at line 558 of file session.h.
Referenced by markTransactionForRollback().
uint64_t drizzled::Session::limit_found_rows |
We follow this logic:
Definition at line 399 of file session.h.
Referenced by drizzled::Join::exec(), and drizzled::handle_select().
THR_LOCK_OWNER* drizzled::Session::lock_id |
THR_LOCK_INFO drizzled::Session::lock_info |
Lex_input_stream* drizzled::Session::m_lip |
Character input stream consumed by the lexical analyser, used during parsing. Note that since the parser is not re-entrant, we keep only one input stream here. This member is valid only when executing code during parsing, and may point to invalid memory after that.
Definition at line 596 of file session.h.
Referenced by drizzled::check_simple_select(), and drizzled::parse_sql().
THR_LOCK_OWNER drizzled::Session::main_lock_id |
memory::Root* drizzled::Session::mem_root |
Pointer to current memroot
Definition at line 118 of file session.h.
Referenced by drizzled::create_tmp_field_from_field(), drizzled::create_tmp_table(), drizzled::TransactionServices::deleteRecord(), drizzled::dispatch_command(), drizzled::optimizer::QuickRangeSelect::init_ror_merged_scan(), drizzled::TransactionServices::insertRecord(), make_lex_string(), drizzled::prepare_create_table(), drizzled::setup_copy_fields(), and drizzled::TransactionServices::updateRecord().
bool drizzled::Session::no_warnings_for_error |
uint64_t drizzled::Session::options |
Bitmap of options
Definition at line 400 of file session.h.
Referenced by endTransaction(), drizzled::fix_max_join_size(), drizzled::handle_select(), drizzled::subselect_hash_sj_engine::init_permanent(), drizzled::insert_query(), drizzled::Join::optimize(), drizzled::subselect_single_select_engine::prepare(), prepareForQueries(), and drizzled::remove_eq_conds().
uint32_t drizzled::Session::row_count |
Row counter, mainly for errors and warnings. Not increased in create_sort_index(); may differ from examined_row_count.
Definition at line 447 of file session.h.
Referenced by drizzled::Field_num::check_int(), drizzled::evaluate_join_record(), drizzled::insert_query(), drizzled::internal_alter_table(), drizzled::Field::set_warning(), drizzled::sub_select(), and drizzled::update_query().
int64_t drizzled::Session::row_count_func |
For the ROW_COUNT() function
Definition at line 401 of file session.h.
Referenced by drizzled::delete_query(), drizzled::execute_command(), drizzled::insert_query(), and drizzled::update_query().
plugin::Scheduler* drizzled::Session::scheduler |
uint32_t drizzled::Session::select_number |
number of select (used for EXPLAIN)
Definition at line 498 of file session.h.
Referenced by reset_for_next_command().
ha_rows drizzled::Session::sent_row_count |
Number of rows we actually sent to the client, including "synthetic" rows in ROLLUP etc.
Definition at line 414 of file session.h.
Referenced by drizzled::plugin::QueryLog::afterStatement(), drizzled::Join::exec(), and reset_for_next_command().
void* drizzled::Session::session_marker |
Place to store various things
Definition at line 599 of file session.h.
Referenced by drizzled::handle_select().
bool drizzled::Session::substitute_null_with_insert_id |
for IS NULL => = last_insert_id() fix in remove_eq_conds()
Definition at line 560 of file session.h.
Referenced by cleanup_after_query(), and drizzled::remove_eq_conds().
union { ... } drizzled::Session::sys_var_tmp |
Used by the sys_var class to store temporary values
|
private |
char* drizzled::Session::thread_stack |
A pointer to the stack frame of the scheduler thread which is called first in the thread for handling a client
Definition at line 211 of file session.h.
Referenced by drizzled::check_stack_overrun().
|
private |
Pointers to memory managed by the ReplicationServices component
bool drizzled::Session::transaction_rollback_request |
Set by a storage engine to request the entire transaction (that possibly spans multiple engines) to rollback. Reset in ha_rollback.
Definition at line 546 of file session.h.
Referenced by drizzled::TransactionServices::autocommitOrRollback(), and markTransactionForRollback().
table_map drizzled::Session::used_tables |
The set of those tables whose fields are referenced in all subqueries of the query.
Possibly this it is incorrect to have used tables in Session because with more than one subquery, it is not clear what does the field mean.
Definition at line 430 of file session.h.
Referenced by drizzled::insert_query(), drizzled::Join::optimize(), and drizzled::select_query().
|
private |
drizzle_system_variables& drizzled::Session::variables |
Mutable local variables local to the session
Definition at line 199 of file session.h.
Referenced by drizzled::TransactionServices::autocommitOrRollback(), drizzled::best_access_path(), drizzled::choose_plan(), drizzled::TransactionServices::commitPhaseOne(), drizzled::convert_constant_item(), drizzled::Create_func_space::create(), drizzled::create_tmp_table(), disconnect(), drizzled::field_conv(), drizzled::fix_max_join_size(), drizzled::FileSort::get_addon_fields(), drizzled::get_date_from_str(), getDefaultStorageEngine(), drizzled::TransactionServices::initStatementMessage(), drizzled::make_date_time(), drizzled::Join::optimize(), drizzled::prepare_create_table(), prepareForQueries(), drizzled::optimizer::QuickIndexMergeSelect::read_keys_and_merge(), drizzle_plugin::ClientMySQLProtocol::readCommand(), drizzled::FileSort::run(), drizzled::Item_sum_distinct::setup(), drizzled::Field_date::store_time(), drizzled::Item_func_dayname::val_str(), drizzled::Item_load_file::val_str(), drizzled::Item_func_rpad::val_str(), drizzled::Item_func_repeat::val_str(), drizzled::Item_func_replace::val_str(), drizzled::Item_func_insert::val_str(), drizzled::Item_func_concat::val_str(), drizzled::Item_func_lpad::val_str(), drizzled::Item_func_monthname::val_str(), and drizzled::Item_func_concat_ws::val_str().
uint32_t drizzled::Session::warn_count[(uint32_t) DRIZZLE_ERROR::WARN_LEVEL_END] |
memory::Root drizzled::Session::warn_root |