240
240
#define Session_SENTRY_MAGIC 0xfeedd1ff
241
241
#define Session_SENTRY_GONE 0xdeadbeef
243
#define Session_CHECK_SENTRY(thd) assert(thd->dbug_sentry == Session_SENTRY_MAGIC)
243
#define Session_CHECK_SENTRY(session) assert(session->dbug_sentry == Session_SENTRY_MAGIC)
245
245
struct system_variables
312
312
ulong trans_prealloc_size;
313
313
ulong log_warnings;
314
314
ulong group_concat_max_len;
315
ulong binlog_format; // binlog format for this thd (see enum_binlog_format)
315
ulong binlog_format; // binlog format for this session (see enum_binlog_format)
317
317
In slave thread we need to know in behalf of which
318
318
thread the query is being run to replicate temp tables properly
519
519
handler of fields used is set
520
520
MARK_COLUMNS_READ: Means a bit in read set is set to inform handler
521
521
that the field is to be read. If field list contains
522
duplicates, then thd->dup_field is set to point
522
duplicates, then session->dup_field is set to point
523
523
to the last found duplicate.
524
524
MARK_COLUMNS_WRITE: Means a bit is set in write set to inform handler
525
525
that it needs to update this field in write_row
538
538
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
539
539
non-NULL value if its previous value is NULL. We do not need to protect
540
540
operation (B) with any mutex. To avoid crashes in races, if we do not
541
know that thd->query cannot change at the moment, one should print
542
thd->query like this:
541
know that session->query cannot change at the moment, one should print
542
session->query like this:
543
543
(1) reserve the LOCK_thread_count mutex;
544
(2) check if thd->query is NULL;
545
(3) if not NULL, then print at most thd->query_length characters from
544
(2) check if session->query is NULL;
545
(3) if not NULL, then print at most session->query_length characters from
546
546
it. We will see the query_length field as either 0, or the right value
548
548
Assuming that the write and read of an n-bit memory field in an n-bit
592
592
/* For now, this is only used to catch duplicated external xids */
593
593
XID xid; // transaction identifier
594
594
enum xa_states xa_state; // used by external XA only
598
598
extern pthread_mutex_t LOCK_xid_cache;
778
778
@param sql_errno the error number
779
779
@param level the error level
780
@param thd the calling thread
780
@param session the calling thread
781
781
@return true if the error is handled
783
783
virtual bool handle_error(uint32_t sql_errno,
784
784
const char *message,
785
785
DRIZZLE_ERROR::enum_warning_level level,
786
Session *session) = 0;
815
815
/** Set to make set_error_status after set_{ok,eof}_status possible. */
816
816
bool can_overwrite_status;
818
void set_ok_status(Session *thd, ha_rows affected_rows_arg,
818
void set_ok_status(Session *session, ha_rows affected_rows_arg,
819
819
uint64_t last_insert_id_arg,
820
820
const char *message);
821
void set_eof_status(Session *thd);
822
void set_error_status(Session *thd, uint32_t sql_errno_arg, const char *message_arg);
821
void set_eof_status(Session *session);
822
void set_error_status(Session *session, uint32_t sql_errno_arg, const char *message_arg);
824
824
void disable_status();
868
868
uint32_t m_sql_errno;
871
Copied from thd->server_status when the diagnostics area is assigned.
871
Copied from session->server_status when the diagnostics area is assigned.
872
872
We need this member as some places in the code use the following pattern:
873
thd->server_status|= ...
875
thd->server_status&= ~...
873
session->server_status|= ...
875
session->server_status&= ~...
876
876
Assigned by OK, EOF or ERROR.
878
878
uint32_t m_server_status;
880
880
The number of rows affected by the last statement. This is
881
semantically close to thd->row_count_func, but has a different
882
life cycle. thd->row_count_func stores the value returned by
881
semantically close to session->row_count_func, but has a different
882
life cycle. session->row_count_func stores the value returned by
883
883
function ROW_COUNT() and is cleared only by statements that
884
884
update its value, such as INSERT, UPDATE, DELETE and few others.
885
885
This member is cleared at the beginning of the next statement.
887
We could possibly merge the two, but life cycle of thd->row_count_func
887
We could possibly merge the two, but life cycle of session->row_count_func
888
888
can not be changed.
890
890
ha_rows m_affected_rows;
892
892
Similarly to the previous member, this is a replacement of
893
thd->first_successful_insert_id_in_prev_stmt, which is used
893
session->first_successful_insert_id_in_prev_stmt, which is used
894
894
to implement LAST_INSERT_ID().
896
896
uint64_t m_last_insert_id;
967
967
THR_LOCK_OWNER main_lock_id; // To use for conventional queries
968
968
THR_LOCK_OWNER *lock_id; // If not main_lock_id, points to
969
969
// the lock_id of a cursor.
970
pthread_mutex_t LOCK_delete; // Locked before thd is deleted
970
pthread_mutex_t LOCK_delete; // Locked before session is deleted
972
972
A pointer to the stack frame of handle_one_connection(),
973
973
which is called first in the thread for handling a client
1000
1000
You are supposed to call Session_SET_PROC_INFO only if you have coded
1001
1001
a time-consuming piece that MySQL can get stuck in for a long time.
1003
Set it using the thd_proc_info(Session *thread, const char *message)
1003
Set it using the session_proc_info(Session *thread, const char *message)
1004
1004
macro/function.
1006
1006
void set_proc_info(const char *info) { proc_info= info; }
1365
1365
can not continue. In particular, disables activation of
1366
1366
CONTINUE or EXIT handlers of stored routines.
1367
1367
Reset in the end of processing of the current user request, in
1368
@see mysql_reset_thd_for_next_command().
1368
@see mysql_reset_session_for_next_command().
1370
1370
bool is_fatal_error;
1798
/** A short cut for thd->main_da.set_ok_status(). */
1798
/** A short cut for session->main_da.set_ok_status(). */
1801
my_ok(Session *thd, ha_rows affected_rows= 0, uint64_t id= 0,
1801
my_ok(Session *session, ha_rows affected_rows= 0, uint64_t id= 0,
1802
1802
const char *message= NULL)
1804
thd->main_da.set_ok_status(thd, affected_rows, id, message);
1804
session->main_da.set_ok_status(session, affected_rows, id, message);
1808
/** A short cut for thd->main_da.set_eof_status(). */
1808
/** A short cut for session->main_da.set_eof_status(). */
1811
my_eof(Session *thd)
1811
my_eof(Session *session)
1813
thd->main_da.set_eof_status(thd);
1813
session->main_da.set_eof_status(session);
1816
1816
#define tmp_disable_binlog(A) \
2031
2031
/* lock data for tmp table */
2032
2032
DRIZZLE_LOCK *m_lock;
2033
/* m_lock or thd->extra_lock */
2033
/* m_lock or session->extra_lock */
2034
2034
DRIZZLE_LOCK **m_plock;
2036
2036
select_create (TableList *table_arg,
2055
2055
virtual bool can_rollback_data() { return 1; }
2057
// Needed for access from local class MY_HOOKS in prepare(), since thd is proteted.
2058
const Session *get_thd(void) { return thd; }
2057
// Needed for access from local class MY_HOOKS in prepare(), since session is proteted.
2058
const Session *get_session(void) { return session; }
2059
2059
const HA_CREATE_INFO *get_create_info() { return create_info; };
2060
2060
int prepare2(void) { return 0; }
2142
2142
bool send_eof();
2144
2144
void cleanup();
2145
bool create_result_table(Session *thd, List<Item> *column_types,
2145
bool create_result_table(Session *session, List<Item> *column_types,
2146
2146
bool is_distinct, uint64_t options,
2147
2147
const char *alias, bool bit_fields_as_long);
2225
2225
LEX_STRING table;
2226
2226
SELECT_LEX_UNIT *sel;
2227
inline Table_ident(Session *thd, LEX_STRING db_arg, LEX_STRING table_arg,
2227
inline Table_ident(Session *session, LEX_STRING db_arg, LEX_STRING table_arg,
2229
2229
:table(table_arg), sel((SELECT_LEX_UNIT *)0)
2231
if (!force && (thd->client_capabilities & CLIENT_NO_SCHEMA))
2231
if (!force && (session->client_capabilities & CLIENT_NO_SCHEMA))