268
int thd_in_lock_tables(const Session *thd)
268
int session_in_lock_tables(const Session *session)
270
return test(thd->in_lock_tables);
270
return test(session->in_lock_tables);
275
int thd_tablespace_op(const Session *thd)
275
int session_tablespace_op(const Session *session)
277
return test(thd->tablespace_op);
277
return test(session->tablespace_op);
287
287
@see Session::set_proc_info
290
set_thd_proc_info(Session *thd, const char *info)
292
thd->set_proc_info(info);
296
const char *get_thd_proc_info(Session *thd)
298
return thd->get_proc_info();
302
void **thd_ha_data(const Session *thd, const struct handlerton *hton)
304
return (void **) &thd->ha_data[hton->slot].ha_ptr;
308
int64_t thd_test_options(const Session *thd, int64_t test_options)
310
return thd->options & test_options;
314
int thd_sql_command(const Session *thd)
316
return (int) thd->lex->sql_command;
320
int thd_tx_isolation(const Session *thd)
322
return (int) thd->variables.tx_isolation;
326
void thd_inc_row_count(Session *thd)
290
set_session_proc_info(Session *session, const char *info)
292
session->set_proc_info(info);
296
const char *get_session_proc_info(Session *session)
298
return session->get_proc_info();
302
void **session_ha_data(const Session *session, const struct handlerton *hton)
304
return (void **) &session->ha_data[hton->slot].ha_ptr;
308
int64_t session_test_options(const Session *session, int64_t test_options)
310
return session->options & test_options;
314
int session_sql_command(const Session *session)
316
return (int) session->lex->sql_command;
320
int session_tx_isolation(const Session *session)
322
return (int) session->variables.tx_isolation;
326
void session_inc_row_count(Session *session)
328
session->row_count++;
360
Diagnostics_area::set_ok_status(Session *thd, ha_rows affected_rows_arg,
360
Diagnostics_area::set_ok_status(Session *session, ha_rows affected_rows_arg,
361
361
uint64_t last_insert_id_arg,
362
362
const char *message_arg)
371
371
/** Only allowed to report success if has not yet reported an error */
373
m_server_status= thd->server_status;
374
m_total_warn_count= thd->total_warn_count;
373
m_server_status= session->server_status;
374
m_total_warn_count= session->total_warn_count;
375
375
m_affected_rows= affected_rows_arg;
376
376
m_last_insert_id= last_insert_id_arg;
399
399
if (is_error() || is_disabled())
402
m_server_status= thd->server_status;
402
m_server_status= session->server_status;
404
404
If inside a stored procedure, do not return the total
405
405
number of warnings, since they are not available to the client
408
m_total_warn_count= thd->total_warn_count;
408
m_total_warn_count= session->total_warn_count;
410
410
m_status= DA_EOF;
600
void *thd_alloc(Session *thd, unsigned int size)
602
return thd->alloc(size);
606
void *thd_calloc(Session *thd, unsigned int size)
608
return thd->calloc(size);
612
char *thd_strdup(Session *thd, const char *str)
614
return thd->strdup(str);
618
char *thd_strmake(Session *thd, const char *str, unsigned int size)
620
return thd->strmake(str, size);
624
LEX_STRING *thd_make_lex_string(Session *thd, LEX_STRING *lex_str,
600
void *session_alloc(Session *session, unsigned int size)
602
return session->alloc(size);
606
void *session_calloc(Session *session, unsigned int size)
608
return session->calloc(size);
612
char *session_strdup(Session *session, const char *str)
614
return session->strdup(str);
618
char *session_strmake(Session *session, const char *str, unsigned int size)
620
return session->strmake(str, size);
624
LEX_STRING *session_make_lex_string(Session *session, LEX_STRING *lex_str,
625
625
const char *str, unsigned int size,
626
626
int allocate_lex_string)
628
return thd->make_lex_string(lex_str, str, size,
628
return session->make_lex_string(lex_str, str, size,
629
629
(bool) allocate_lex_string);
633
void *thd_memdup(Session *thd, const void* str, unsigned int size)
633
void *session_memdup(Session *session, const void* str, unsigned int size)
635
return thd->memdup(str, size);
635
return session->memdup(str, size);
639
void thd_get_xid(const Session *thd, DRIZZLE_XID *xid)
639
void session_get_xid(const Session *session, DRIZZLE_XID *xid)
641
*xid = *(DRIZZLE_XID *) &thd->transaction.xid_state.xid;
641
*xid = *(DRIZZLE_XID *) &session->transaction.xid_state.xid;
648
648
void Session::init(void)
650
650
pthread_mutex_lock(&LOCK_global_system_variables);
651
plugin_thdvar_init(this);
651
plugin_sessionvar_init(this);
652
652
variables.time_format= date_time_format_copy((Session*) 0,
653
653
variables.time_format);
654
654
variables.date_format= date_time_format_copy((Session*) 0,
663
663
variables.pseudo_thread_id= thread_id;
664
664
pthread_mutex_unlock(&LOCK_global_system_variables);
665
665
server_status= SERVER_STATUS_AUTOCOMMIT;
666
options= thd_startup_options;
666
options= session_startup_options;
668
668
if (variables.max_join_size == HA_POS_ERROR)
669
669
options |= OPTION_BIG_SELECTS;
702
702
variables.trans_alloc_block_size,
703
703
variables.trans_prealloc_size);
704
704
transaction.xid_state.xid.null();
705
transaction.xid_state.in_thd=1;
705
transaction.xid_state.in_session=1;
869
869
current_cond and current_mutex are 0), then the victim will not get
870
870
a signal and it may wait "forever" on the cond (until
871
871
we issue a second KILL or the status it's waiting for happens).
872
It's true that we have set its thd->killed but it may not
872
It's true that we have set its session->killed but it may not
873
873
see it immediately and so may have time to reach the cond_wait().
875
875
if (mysys_var->current_cond && mysys_var->current_mutex)
1212
1212
Register an item tree tree transformation, performed by the query
1213
1213
optimizer. We need a pointer to runtime_memroot because it may be !=
1214
thd->mem_root (this may no longer be a true statement)
1214
session->mem_root (this may no longer be a true statement)
1217
1217
void Session::nocheck_register_item_tree_change(Item **place, Item *old_value,
1298
1298
bool select_send::send_fields(List<Item> &list, uint32_t flags)
1301
if (!(res= thd->protocol->send_fields(&list, flags)))
1301
if (!(res= session->protocol->send_fields(&list, flags)))
1302
1302
is_result_set_started= 1;
1334
1334
We may be passing the control from mysqld to the client: release the
1335
1335
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
1338
ha_release_temporary_latches(thd);
1338
ha_release_temporary_latches(session);
1340
1340
List_iterator_fast<Item> li(items);
1341
Protocol *protocol= thd->protocol;
1341
Protocol *protocol= session->protocol;
1342
1342
char buff[MAX_FIELD_WIDTH];
1343
1343
String buffer(buff, sizeof(buff), &my_charset_bin);
1370
1370
We may be passing the control from mysqld to the client: release the
1371
1371
InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved
1374
ha_release_temporary_latches(thd);
1374
ha_release_temporary_latches(session);
1376
1376
/* Unlock tables before sending packet to gain some speed */
1379
mysql_unlock_tables(thd, thd->lock);
1379
mysql_unlock_tables(session, session->lock);
1383
1383
is_result_set_started= 0;
1484
1484
if (!dirname_length(exchange->file_name))
1486
strxnmov(path, FN_REFLEN-1, mysql_real_data_home, thd->db ? thd->db : "",
1486
strxnmov(path, FN_REFLEN-1, mysql_real_data_home, session->db ? session->db : "",
1488
1488
(void) fn_format(path, exchange->file_name, path, "", option);
1530
1530
if ((uint) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN)
1531
1531
strmake(path,exchange->file_name,FN_REFLEN-1);
1533
if ((file= create_file(thd, path, exchange, &cache)) < 0)
1533
if ((file= create_file(session, path, exchange, &cache)) < 0)
1535
1535
/* Check if there is any blobs in data */
1573
1573
(exchange->opt_enclosed && non_string_results &&
1574
1574
field_term_length && strchr(NUMERIC_CHARS, field_term_char)))
1576
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1576
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1577
1577
ER_AMBIGUOUS_FIELD_TERM, ER(ER_AMBIGUOUS_FIELD_TERM));
1578
1578
is_ambiguous_field_term= true;
2090
2090
if (mv->local == 0)
2092
2092
Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
2093
suv->fix_fields(thd, 0);
2093
suv->fix_fields(session, 0);
2098
return(thd->is_error());
2098
return(session->is_error());
2101
2101
bool select_dumpvar::send_eof()
2103
2103
if (! row_count)
2104
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2104
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2105
2105
ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
2107
2107
In order to remember the value of affected rows for ROW_COUNT()
2108
2108
function, SELECT INTO has to have an own SQLCOM.
2109
2109
TODO: split from SQLCOM_SELECT
2111
::my_ok(thd,row_count);
2111
::my_ok(session,row_count);
2131
void thd_increment_bytes_sent(ulong length)
2131
void session_increment_bytes_sent(ulong length)
2133
Session *thd=current_thd;
2134
if (likely(thd != 0))
2135
{ /* current_thd==0 when close_connection() calls net_send_error() */
2136
thd->status_var.bytes_sent+= length;
2133
Session *session=current_session;
2134
if (likely(session != 0))
2135
{ /* current_session==0 when close_connection() calls net_send_error() */
2136
session->status_var.bytes_sent+= length;
2141
void thd_increment_bytes_received(ulong length)
2141
void session_increment_bytes_received(ulong length)
2143
current_thd->status_var.bytes_received+= length;
2143
current_session->status_var.bytes_received+= length;
2147
void thd_increment_net_big_packet_count(ulong length)
2147
void session_increment_net_big_packet_count(ulong length)
2149
current_thd->status_var.net_big_packet_count+= length;
2149
current_session->status_var.net_big_packet_count+= length;
2152
2152
void Session::send_kill_message() const
2224
2224
Check the killed state of a user thread
2225
@param thd user thread
2225
@param session user thread
2226
2226
@retval 0 the user thread is active
2227
2227
@retval 1 the user thread has been killed
2229
extern "C" int thd_killed(const Session *thd)
2229
extern "C" int session_killed(const Session *session)
2231
return(thd->killed);
2231
return(session->killed);
2235
2235
Return the thread id of a user thread
2236
@param thd user thread
2236
@param session user thread
2237
2237
@return thread id
2239
extern "C" unsigned long thd_get_thread_id(const Session *thd)
2239
extern "C" unsigned long session_get_thread_id(const Session *session)
2241
return((unsigned long)thd->thread_id);
2241
return((unsigned long)session->thread_id);
2245
2245
#ifdef INNODB_COMPATIBILITY_HOOKS
2246
extern "C" const struct charset_info_st *thd_charset(Session *thd)
2248
return(thd->charset());
2251
extern "C" char **thd_query(Session *thd)
2253
return(&thd->query);
2256
extern "C" int thd_slave_thread(const Session *thd)
2258
return(thd->slave_thread);
2261
extern "C" int thd_non_transactional_update(const Session *thd)
2263
return(thd->transaction.all.modified_non_trans_table);
2266
extern "C" int thd_binlog_format(const Session *thd)
2268
return (int) thd->variables.binlog_format;
2271
extern "C" void thd_mark_transaction_to_rollback(Session *thd, bool all)
2273
mark_transaction_to_rollback(thd, all);
2246
extern "C" const struct charset_info_st *session_charset(Session *session)
2248
return(session->charset());
2251
extern "C" char **session_query(Session *session)
2253
return(&session->query);
2256
extern "C" int session_slave_thread(const Session *session)
2258
return(session->slave_thread);
2261
extern "C" int session_non_transactional_update(const Session *session)
2263
return(session->transaction.all.modified_non_trans_table);
2266
extern "C" int session_binlog_format(const Session *session)
2268
return (int) session->variables.binlog_format;
2271
extern "C" void session_mark_transaction_to_rollback(Session *session, bool all)
2273
mark_transaction_to_rollback(session, all);
2275
2275
#endif // INNODB_COMPATIBILITY_HOOKS */
2279
2279
Mark transaction to rollback and mark error as fatal to a sub-statement.
2281
@param thd Thread handle
2281
@param session Thread handle
2282
2282
@param all true <=> rollback main transaction.
2285
void mark_transaction_to_rollback(Session *thd, bool all)
2285
void mark_transaction_to_rollback(Session *session, bool all)
2289
thd->is_fatal_sub_stmt_error= true;
2290
thd->transaction_rollback_request= all;
2289
session->is_fatal_sub_stmt_error= true;
2290
session->transaction_rollback_request= all;
2293
2293
/***************************************************************************
2392
2392
- Events of type 'RowEventT' have the type code 'type_code'.
2394
2394
POST CONDITION:
2395
If a non-NULL pointer is returned, the pending event for thread 'thd' will
2395
If a non-NULL pointer is returned, the pending event for thread 'session' will
2396
2396
be an event of type 'RowEventT' (which have the type code 'type_code')
2397
2397
will either empty or have enough space to hold 'needed' bytes. In
2398
2398
addition, the columns bitmap will be correct for the row, meaning that