MySQL 从接收连接到执行连接命令的一个源码流程

来源:互联网 发布:如何获得淘宝联盟资格 编辑:程序博客网 时间:2024/04/29 13:07

 

 

 

MySQL 从接收连接到执行连接命令的一个源码流程

 

函数从上到下的调用顺序

mysqld_main

 

handle_connections_methods

 

handle_connections_sockets_thread

 

handle_connections_sockets

 

create_new_thread

 

create_thread_to_handle_connection

 

handle_one_connection

 

do_handle_one_connection

 

login_connection

 

prepare_new_connection_state

 

execute_init_command

 

dispatch_command

 

执行命令

switch (command)

{

case COM_INIT_DB:


  case COM_STMT_EXECUTE:

  {

    mysqld_stmt_execute(thd, packet, packet_length);

    break;

  }

}

 

execute_loop

 

execute

 

mysql_execute_command

 

switch (lex->sql_command) {此处就是各种查询命令的执行,该部分代码是非常非常的长了

 

原创粉丝点击