MCPcopy Create free account
hub / github.com/MariaDB/server / create_embedded_thd

Function create_embedded_thd

libmysqld/lib_sql.cc:705–736  ·  view source on GitHub ↗

@brief Initialize a new THD for a connection in the embedded server @param client_flag Client capabilities which this thread supports @return pointer to the created THD object @todo This function copies code from several places in the server, including create_new_thread(), and prepare_new_connection_state(). This should be refactored to avoid code duplication. */

Source from the content-addressed store, hash-verified

703 be refactored to avoid code duplication.
704*/
705void *create_embedded_thd(ulong client_flag)
706{
707 THD * thd= new THD(next_thread_id());
708
709 thd->thread_stack= (char*) &thd;
710 thd->store_globals();
711 lex_start(thd);
712
713 /* TODO - add init_connect command execution */
714
715 if (thd->variables.max_join_size == HA_POS_ERROR)
716 thd->variables.option_bits |= OPTION_BIG_SELECTS;
717 thd->mark_connection_idle();
718 thd->set_time();
719 thd->init_for_queries();
720 thd->client_capabilities= client_flag | MARIADB_CLIENT_EXTENDED_METADATA;
721 thd->real_id= pthread_self();
722
723 thd->db= null_clex_str;
724#ifndef NO_EMBEDDED_ACCESS_CHECKS
725 thd->security_ctx->db_access= DB_ACLS;
726 thd->security_ctx->master_access= ALL_KNOWN_ACL;
727#endif
728 thd->cur_data= 0;
729 thd->first_data= 0;
730 thd->data_tail= &thd->first_data;
731 bzero((char*) &thd->net, sizeof(thd->net));
732 server_threads.insert(thd);
733 thd->mysys_var= 0;
734 thd->reset_globals();
735 return thd;
736}
737
738
739THD *embedded_get_current_thd()

Callers 1

libmysqld.cFile · 0.85

Calls 8

next_thread_idFunction · 0.85
lex_startFunction · 0.85
mark_connection_idleMethod · 0.80
init_for_queriesMethod · 0.80
store_globalsMethod · 0.45
set_timeMethod · 0.45
insertMethod · 0.45
reset_globalsMethod · 0.45

Tested by

no test coverage detected