#include <sp_head.h>
Inheritance diagram for sp_instr_stmt:


Public Member Functions | |
| sp_instr_stmt (uint ip, sp_pcontext *ctx, LEX *lex) | |
| virtual | ~sp_instr_stmt () |
| virtual int | execute (THD *thd, uint *nextp) |
| virtual int | exec_core (THD *thd, uint *nextp) |
| virtual void | print (String *str) |
Public Attributes | |
| LEX_STRING | m_query |
Private Member Functions | |
| sp_instr_stmt (const sp_instr_stmt &) | |
| void | operator= (sp_instr_stmt &) |
Private Attributes | |
| sp_lex_keeper | m_lex_keeper |
Definition at line 598 of file sp_head.h.
| sp_instr_stmt::sp_instr_stmt | ( | const sp_instr_stmt & | ) | [private] |
| sp_instr_stmt::sp_instr_stmt | ( | uint | ip, | |
| sp_pcontext * | ctx, | |||
| LEX * | lex | |||
| ) | [inline] |
Definition at line 607 of file sp_head.h.
References LEX_STRING::length, m_query, and LEX_STRING::str.
00608 : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE) 00609 { 00610 m_query.str= 0; 00611 m_query.length= 0; 00612 }
| virtual sp_instr_stmt::~sp_instr_stmt | ( | ) | [inline, virtual] |
| int sp_instr_stmt::exec_core | ( | THD * | thd, | |
| uint * | nextp | |||
| ) | [virtual] |
Reimplemented from sp_instr.
Definition at line 2532 of file sp_head.cc.
References sp_instr::m_ip, and mysql_execute_command().
02533 { 02534 int res= mysql_execute_command(thd); 02535 *nextp= m_ip+1; 02536 return res; 02537 }
Here is the call graph for this function:

| int sp_instr_stmt::execute | ( | THD * | thd, | |
| uint * | nextp | |||
| ) | [virtual] |
Implements sp_instr.
Definition at line 2462 of file sp_head.cc.
References alloc_query(), COM_QUERY, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, FALSE, general_log_print(), LEX_STRING::length, log_slow_statement(), sp_instr::m_ip, m_lex_keeper, m_query, OPTION_LOG_OFF, query_cache_end_of_result(), sp_lex_keeper::reset_lex_and_exec_core(), sp_lex_keeper::sql_command(), LEX_STRING::str, subst_spvars(), and unlikely.
02463 { 02464 char *query; 02465 uint32 query_length; 02466 int res; 02467 DBUG_ENTER("sp_instr_stmt::execute"); 02468 DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command())); 02469 02470 query= thd->query; 02471 query_length= thd->query_length; 02472 if (!(res= alloc_query(thd, m_query.str, m_query.length+1)) && 02473 !(res=subst_spvars(thd, this, &m_query))) 02474 { 02475 /* 02476 (the order of query cache and subst_spvars calls is irrelevant because 02477 queries with SP vars can't be cached) 02478 */ 02479 if (unlikely((thd->options & OPTION_LOG_OFF)==0)) 02480 general_log_print(thd, COM_QUERY, "%s", thd->query); 02481 02482 if (query_cache_send_result_to_client(thd, 02483 thd->query, thd->query_length) <= 0) 02484 { 02485 res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this); 02486 if (!res && unlikely(thd->enable_slow_log)) 02487 log_slow_statement(thd); 02488 query_cache_end_of_result(thd); 02489 } 02490 else 02491 *nextp= m_ip+1; 02492 thd->query= query; 02493 thd->query_length= query_length; 02494 } 02495 DBUG_RETURN(res); 02496 }
Here is the call graph for this function:

| void sp_instr_stmt::operator= | ( | sp_instr_stmt & | ) | [private] |
| void sp_instr_stmt::print | ( | String * | str | ) | [virtual] |
Implements sp_instr.
Definition at line 2500 of file sp_head.cc.
References LEX_STRING::length, m_lex_keeper, m_query, String::qs_append(), String::reserve(), SP_INSTR_UINT_MAXLEN, SP_STMT_PRINT_MAXLEN, sp_lex_keeper::sql_command(), LEX_STRING::str, and STRING_WITH_LEN.
02501 { 02502 uint i, len; 02503 02504 /* stmt CMD "..." */ 02505 if (str->reserve(SP_STMT_PRINT_MAXLEN+SP_INSTR_UINT_MAXLEN+8)) 02506 return; 02507 str->qs_append(STRING_WITH_LEN("stmt ")); 02508 str->qs_append((uint)m_lex_keeper.sql_command()); 02509 str->qs_append(STRING_WITH_LEN(" \"")); 02510 len= m_query.length; 02511 /* 02512 Print the query string (but not too much of it), just to indicate which 02513 statement it is. 02514 */ 02515 if (len > SP_STMT_PRINT_MAXLEN) 02516 len= SP_STMT_PRINT_MAXLEN-3; 02517 /* Copy the query string and replace '\n' with ' ' in the process */ 02518 for (i= 0 ; i < len ; i++) 02519 { 02520 char c= m_query.str[i]; 02521 if (c == '\n') 02522 c= ' '; 02523 str->qs_append(c); 02524 } 02525 if (m_query.length > SP_STMT_PRINT_MAXLEN) 02526 str->qs_append(STRING_WITH_LEN("...")); /* Indicate truncated string */ 02527 str->qs_append('"'); 02528 }
Here is the call graph for this function:

sp_lex_keeper sp_instr_stmt::m_lex_keeper [private] |
1.4.7

