265
266
(hash_get_key) get_var_key,
266
267
(hash_free_key) free_user_var, 0);
269
269
protocol= protocol_arg;
270
270
protocol->setSession(this);
272
const Query_id& local_query_id= Query_id::get_query_id();
274
protocol->setRandom(tmp + (uint64_t) &protocol,
275
tmp + (uint64_t)local_query_id.value());
276
272
substitute_null_with_insert_id = false;
277
273
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
278
274
thr_lock_owner_init(&main_lock_id, &lock_info);
360
Init Session for query processing.
361
This has to be called once before we call mysql_parse.
362
See also comments in session.h.
365
void Session::init_for_queries()
368
ha_enable_transaction(this,true);
370
reset_root_defaults(mem_root, variables.query_alloc_block_size,
371
variables.query_prealloc_size);
372
reset_root_defaults(&transaction.mem_root,
373
variables.trans_alloc_block_size,
374
variables.trans_prealloc_size);
375
transaction.xid_state.xid.null();
376
transaction.xid_state.in_session=1;
380
355
/* Do operations that may take a long time */
382
357
void Session::cleanup(void)
567
542
created in another thread
569
544
thr_lock_info_init(&lock_info);
549
Init Session for query processing.
550
This has to be called once before we call mysql_parse.
551
See also comments in session.h.
573
554
void Session::prepareForQueries()
575
556
if (variables.max_join_size == HA_POS_ERROR)
576
557
options |= OPTION_BIG_SELECTS;
577
if (client_capabilities & CLIENT_COMPRESS)
579
protocol->enableCompression();
582
559
version= refresh_version;
583
560
set_proc_info(NULL);
584
561
command= COM_SLEEP;
563
ha_enable_transaction(this,true);
565
reset_root_defaults(mem_root, variables.query_alloc_block_size,
566
variables.query_prealloc_size);
567
reset_root_defaults(&transaction.mem_root,
568
variables.trans_alloc_block_size,
569
variables.trans_prealloc_size);
570
transaction.xid_state.xid.null();
571
transaction.xid_state.in_session=1;
589
574
bool Session::initGlobals()
593
578
disconnect(ER_OUT_OF_RESOURCES, true);
594
579
statistic_increment(aborted_connects, &LOCK_status);
595
Scheduler &thread_scheduler= get_thread_scheduler();
596
thread_scheduler.end_thread(this, 0);
587
if (initGlobals() || authenticate())
595
while (! protocol->haveError() && killed != KILL_CONNECTION)
597
if (! executeStatement())
604
bool Session::schedule()
606
scheduler= get_thread_scheduler();
610
if (connection_count > max_used_connections)
611
max_used_connections= connection_count;
613
thread_id= variables.pseudo_thread_id= global_thread_id++;
615
pthread_mutex_lock(&LOCK_thread_count);
616
session_list.push_back(this);
617
pthread_mutex_unlock(&LOCK_thread_count);
619
if (scheduler->addSession(this))
621
char error_message_buff[DRIZZLE_ERRMSG_SIZE];
623
killed= Session::KILL_CONNECTION;
625
statistic_increment(aborted_connects, &LOCK_status);
627
/* Can't use my_error() since store_globals has not been called. */
628
/* TODO replace will better error message */
629
snprintf(error_message_buff, sizeof(error_message_buff),
630
ER(ER_CANT_CREATE_THREAD), 1);
631
protocol->sendError(ER_CANT_CREATE_THREAD, error_message_buff);
602
638
bool Session::authenticate()
605
641
if (protocol->authenticate())
608
644
statistic_increment(aborted_connects, &LOCK_status);
612
648
bool Session::checkUser(const char *passwd, uint32_t passwd_len, const char *in_db)