77
77
bool my_yyoverflow(short **a, ParserType **b, ulong *yystacksize);
78
78
static bool parse_sql(Session *session, Lex_input_stream *lip);
79
void parse(Session *session, const char *inBuf, uint32_t length);
79
void parse(Session&, const char *inBuf, uint32_t length);
82
82
@defgroup Runtime_Environment Runtime Environment
245
245
session->thread_id,
246
246
const_cast<const char *>(session->schema()->c_str()));
248
parse(session, session->getQueryString()->c_str(), session->getQueryString()->length());
248
parse(*session, session->getQueryString()->c_str(), session->getQueryString()->length());
750
750
void create_select_for_variable(Session *session, const char *var_name)
753
LEX_STRING tmp, null_lex_string;
755
char buff[MAX_SYS_VAR_LENGTH*2+4+8];
758
lex= &session->lex();
760
lex->sql_command= SQLCOM_SELECT;
752
LEX& lex= session->lex();
754
lex.sql_command= SQLCOM_SELECT;
761
756
tmp.str= (char*) var_name;
762
757
tmp.length=strlen(var_name);
758
LEX_STRING null_lex_string;
763
759
memset(&null_lex_string.str, 0, sizeof(null_lex_string));
765
761
We set the name of Item to @@session.var_name because that then is used
766
762
as the column name in the output.
768
if ((var= get_system_var(session, OPT_SESSION, tmp, null_lex_string)))
764
if (Item* var= get_system_var(session, OPT_SESSION, tmp, null_lex_string))
766
char buff[MAX_SYS_VAR_LENGTH*2+4+8];
770
768
end+= snprintf(buff, sizeof(buff), "@@session.%s", var_name);
771
769
var->set_name(buff, end-buff, system_charset_info);
772
770
session->add_item_to_list(var);
782
780
@param length Length of the query text
785
void parse(Session *session, const char *inBuf, uint32_t length)
783
void parse(Session& session, const char *inBuf, uint32_t length)
787
session->lex().start(session);
788
session->reset_for_next_command();
785
session.lex().start(&session);
786
session.reset_for_next_command();
789
787
/* Check if the Query is Cached if and return true if yes
790
788
* TODO the plugin has to make sure that the query is cacheble
791
789
* by setting the query_safe_cache param to TRUE
793
if (plugin::QueryCache::isCached(session) && not plugin::QueryCache::sendCachedResultset(session))
791
if (plugin::QueryCache::isCached(&session) && not plugin::QueryCache::sendCachedResultset(&session))
795
Lex_input_stream lip(session, inBuf, length);
796
if (parse_sql(session, &lip))
797
assert(session->is_error());
798
else if (not session->is_error())
793
Lex_input_stream lip(&session, inBuf, length);
794
if (parse_sql(&session, &lip))
795
assert(session.is_error());
796
else if (not session.is_error())
800
DRIZZLE_QUERY_EXEC_START(session->getQueryString()->c_str(), session->thread_id,
801
const_cast<const char *>(session->schema()->c_str()));
798
DRIZZLE_QUERY_EXEC_START(session.getQueryString()->c_str(), session.thread_id,
799
const_cast<const char *>(session.schema()->c_str()));
802
800
// Implement Views here --Brian
803
801
/* Actually execute the query */
806
execute_command(session);
804
execute_command(&session);
814
812
DRIZZLE_QUERY_EXEC_DONE(0);
816
session->lex().unit.cleanup();
817
session->set_proc_info("freeing items");
818
session->end_statement();
819
session->cleanup_after_query();
820
session->times.set_end_timer(*session);
814
session.lex().unit.cleanup();
815
session.set_proc_info("freeing items");
816
session.end_statement();
817
session.cleanup_after_query();
818
session.times.set_end_timer(session);