20 #include <drizzled/item/num.h>
21 #include <drizzled/abort_exception.h>
22 #include <drizzled/error.h>
23 #include <drizzled/nested_join.h>
24 #include <drizzled/transaction_services.h>
25 #include <drizzled/sql_parse.h>
26 #include <drizzled/data_home.h>
27 #include <drizzled/sql_base.h>
29 #include <drizzled/function/time/unix_timestamp.h>
30 #include <drizzled/function/get_system_var.h>
31 #include <drizzled/item/cmpfunc.h>
32 #include <drizzled/item/null.h>
33 #include <drizzled/session.h>
34 #include <drizzled/session/cache.h>
35 #include <drizzled/sql_load.h>
36 #include <drizzled/lock.h>
37 #include <drizzled/select_send.h>
38 #include <drizzled/plugin/client.h>
39 #include <drizzled/statement.h>
40 #include <drizzled/statement/alter_table.h>
41 #include <drizzled/probes.h>
42 #include <drizzled/charset.h>
43 #include <drizzled/plugin/logging.h>
44 #include <drizzled/plugin/query_rewrite.h>
45 #include <drizzled/plugin/query_cache.h>
46 #include <drizzled/plugin/authorization.h>
47 #include <drizzled/optimizer/explain_plan.h>
48 #include <drizzled/pthread_globals.h>
49 #include <drizzled/plugin/event_observer.h>
50 #include <drizzled/display.h>
52 #include <drizzled/kill.h>
53 #include <drizzled/schema.h>
54 #include <drizzled/item/subselect.h>
55 #include <drizzled/diagnostics_area.h>
56 #include <drizzled/table_ident.h>
57 #include <drizzled/statistics_variables.h>
58 #include <drizzled/system_variables.h>
59 #include <drizzled/session/times.h>
60 #include <drizzled/session/transactions.h>
61 #include <drizzled/create_field.h>
62 #include <drizzled/lex_input_stream.h>
68 #include <boost/date_time.hpp>
69 #include <drizzled/internal/my_sys.h>
78 bool my_yyoverflow(
short **a,
ParserType **b, ulong *yystacksize);
79 static bool parse_sql(Session *session, Lex_input_stream *lip);
87 extern size_t my_thread_stack_size;
88 extern const charset_info_st *character_set_filesystem;
90 static atomic<uint64_t> g_query_id;
94 static const std::string command_name[]=
108 const char *xa_state_names[]=
110 "NON-EXISTING",
"ACTIVE",
"IDLE",
"PREPARED"
128 const std::string &getCommandName(
const enum_server_command& command)
130 return command_name[command];
133 void init_update_queries(
void)
135 for (uint32_t x= uint32_t(SQLCOM_SELECT);
136 x <= uint32_t(SQLCOM_END); x++)
196 DRIZZLE_COMMAND_START(session.thread_id, command);
199 session.lex().sql_command= SQLCOM_END;
200 session.times.set_time();
203 if (command != COM_PING)
206 session.status_var.questions++;
211 plugin::Logging::preDo(&session);
212 if (unlikely(plugin::EventObserver::beforeStatement(session)))
217 session.server_status&= ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
225 my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
228 if (not schema::change(session,
identifier::Schema(session.catalog().identifier(), packet)))
238 DRIZZLE_QUERY_START(session.getQueryString()->c_str(), session.thread_id, session.schema()->c_str());
239 parse(session, *session.getQueryString());
251 if (packet.size() != 4)
253 my_error(ER_NO_SUCH_THREAD, MYF(0), 0);
259 memcpy(&kill_id, packet.data(),
sizeof(uint32_t));
261 kill_id= ntohl(kill_id);
262 (void)drizzled::kill(*session.user(), kill_id,
true);
270 session.status_var.com_other++;
279 session.status_var.com_other++;
287 my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
293 TransactionServices::autocommitOrRollback(session, session.
is_error());
296 session.transaction.
stmt.reset();
300 if (session.killed_errno())
302 if (not session.main_da().is_set())
303 session.send_kill_message();
305 if (session.getKilled() == Session::KILL_QUERY || session.getKilled() == Session::KILL_BAD_DATA)
307 session.setKilled(Session::NOT_KILLED);
308 session.setAbort(
false);
312 assert(not session.main_da().
is_sent);
314 switch (session.main_da().status())
316 case Diagnostics_area::DA_ERROR:
318 session.getClient()->sendError(session.main_da().sql_errno(), session.main_da().message());
321 case Diagnostics_area::DA_EOF:
322 session.getClient()->sendEOF();
325 case Diagnostics_area::DA_OK:
326 session.getClient()->sendOK();
329 case Diagnostics_area::DA_DISABLED:
332 case Diagnostics_area::DA_EMPTY:
334 session.getClient()->sendOK();
337 session.main_da().
is_sent=
true;
343 plugin::Logging::postDo(&session);
344 if (unlikely(plugin::EventObserver::afterStatement(session)))
352 session.resetQueryString();
357 if (DRIZZLE_QUERY_DONE_ENABLED() || DRIZZLE_COMMAND_DONE_ENABLED())
359 if (command == COM_QUERY)
361 DRIZZLE_QUERY_DONE(session.
is_error());
363 DRIZZLE_COMMAND_DONE(session.
is_error());
398 bitset<NUM_OF_TABLE_OPTIONS> table_options;
405 return not sel.add_table_to_list(&session,
new Table_ident(db, table), NULL, table_options, TL_READ);
408 int prepare_new_schema_table(Session *session, LEX& lex0,
const string& schema_table_name)
410 Select_Lex& lex= *lex0.current_select;
413 TableList *table_list= (TableList*)lex.table_list.first;
414 table_list->schema_select_lex= NULL;
451 Select_Lex *select_lex= &session->lex().select_lex;
468 session->lex().first_lists_tables_same();
472 TableList* all_tables= session->lex().query_tables;
475 select_lex->context.resolve_in_table_list_only((
TableList*)select_lex->table_list.first);
484 if (all_tables || ! session->lex().is_single_level_stmt())
486 drizzle_reset_errors(*session, 0);
491 if (not (session->server_status & SERVER_STATUS_AUTOCOMMIT)
493 && session->lex().statement->isTransactional())
495 if (not session->startTransaction())
497 my_error(drizzled::ER_UNKNOWN_ERROR, MYF(0));
503 bool res= session->lex().statement->execute();
511 if (not
sql_command_flags[session->lex().sql_command].test(CF_BIT_HAS_ROW_COUNT))
519 bool execute_sqlcom_select(Session *session, TableList *all_tables)
521 LEX *lex= &session->lex();
522 select_result *result=lex->result;
526 Select_Lex *param= lex->unit.global_parameters;
527 if (!param->explicit_limit)
529 new Item_int((uint64_t) session->variables.select_limit);
533 && ! (session->server_status & SERVER_STATUS_AUTOCOMMIT)
534 && ! session->inTransaction()
535 && ! lex->statement->isShow())
537 if (not session->startTransaction())
539 my_error(drizzled::ER_UNKNOWN_ERROR, MYF(0));
544 if (not (res= session->openTablesLock(all_tables)))
554 result=
new select_send();
555 session->send_explain_fields(result);
556 optimizer::ExplainPlan planner;
557 res= planner.explainUnion(session, &session->lex().unit, result);
558 if (lex->describe & DESCRIBE_EXTENDED)
561 String str(buff,(uint32_t)
sizeof(buff), system_charset_info);
563 session->lex().unit.print(&str);
565 push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
578 result=
new select_send();
581 plugin::QueryCache::prepareResultset(session);
584 plugin::QueryCache::setResultset(session);
586 if (result != lex->result)
594 #define MY_YACC_INIT 1000 // Start with big alloc
595 #define MY_YACC_MAX 32000 // Because of 'short'
597 bool my_yyoverflow(
short **yyss,
ParserType **yyvs, ulong *yystacksize)
599 LEX *lex= ¤t_session->lex();
601 if ((uint32_t) *yystacksize >= MY_YACC_MAX)
604 old_info= *yystacksize;
605 *yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX);
606 unsigned char *tmpptr= NULL;
607 if (!(tmpptr= (
unsigned char *)realloc(lex->yacc_yyvs,
608 *yystacksize*
sizeof(**yyvs))))
610 lex->yacc_yyvs= tmpptr;
612 if (!(tmpptr= (
unsigned char*)realloc(lex->yacc_yyss,
613 *yystacksize*
sizeof(**yyss))))
615 lex->yacc_yyss= tmpptr;
618 memcpy(lex->yacc_yyss, *yyss, old_info*
sizeof(**yyss));
619 memcpy(lex->yacc_yyvs, *yyvs, old_info*
sizeof(**yyvs));
621 *yyss=(
short*) lex->yacc_yyss;
628 init_select(LEX *lex)
630 Select_Lex *select_lex= lex->current_select;
631 select_lex->init_select();
633 if (select_lex == &lex->select_lex)
635 assert(lex->result == 0);
641 bool new_select(LEX *lex,
bool move_down)
643 Session* session= lex->session;
644 Select_Lex* select_lex=
new (session->mem_root) Select_Lex;
646 select_lex->select_number= ++session->select_number;
647 select_lex->parent_lex= lex;
648 select_lex->init_query();
649 select_lex->init_select();
652 if (lex->nest_level > (
int) MAX_SELECT_NESTING)
654 my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING);
658 select_lex->nest_level= lex->nest_level;
662 Select_Lex_Unit* unit=
new (session->mem_root) Select_Lex_Unit();
666 unit->session= session;
667 unit->include_down(lex->current_select);
670 unit->return_to= lex->current_select;
671 select_lex->include_down(unit);
676 select_lex->context.outer_context= &select_lex->outer_select()->context;
680 if (lex->current_select->order_list.first && !lex->current_select->braces)
682 my_error(ER_WRONG_USAGE, MYF(0),
"UNION",
"order_st BY");
686 select_lex->include_neighbour(lex->current_select);
687 Select_Lex_Unit *unit= select_lex->master_unit();
689 if (not unit->fake_select_lex && unit->add_fake_select_lex(lex->session))
692 select_lex->context.outer_context= unit->first_select()->context.outer_context;
695 select_lex->master_unit()->global_parameters= select_lex;
696 select_lex->include_global((Select_Lex_Node**)&lex->all_selects_list);
697 lex->current_select= select_lex;
702 select_lex->context.resolve_in_select_list=
true;
719 LEX& lex= session->lex();
721 lex.sql_command= SQLCOM_SELECT;
723 tmp.assign(var_name, strlen(var_name));
728 if (
Item*
var= get_system_var(session, OPT_SESSION, tmp, null_lex_string()))
730 char buff[MAX_SYS_VAR_LENGTH*2+4+8];
732 end+= snprintf(buff,
sizeof(buff),
"@@session.%s", var_name);
733 var->set_name(buff, end-buff);
734 session->add_item_to_list(
var);
749 session.lex().start(&session);
755 if (plugin::QueryCache::isCached(&session) && not plugin::QueryCache::sendCachedResultset(&session))
762 DRIZZLE_QUERY_EXEC_START(session.getQueryString()->c_str(), session.thread_id, session.schema()->c_str());
775 DRIZZLE_QUERY_EXEC_DONE(0);
777 session.lex().unit.cleanup();
781 session.times.set_end_timer(session);
793 const char *length,
const char *decimals,
794 uint32_t type_modifier, column_format_type column_format,
798 LEX *lex= &session->lex();
801 if (check_identifier_name(field_name, ER_TOO_LONG_IDENT))
804 if (type_modifier & PRI_KEY_FLAG)
807 statement->alter_info.key_list.push_back(
new Key(Key::PRIMARY, null_lex_string(), &default_key_create_info, 0, lex->col_list));
808 lex->col_list.clear();
810 if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
813 statement->alter_info.key_list.push_back(
new Key(Key::UNIQUE, null_lex_string(), &default_key_create_info, 0, lex->col_list));
814 lex->col_list.clear();
826 if (default_value->type() == Item::FUNC_ITEM &&
827 !(((
Item_func*)default_value)->functype() == Item_func::NOW_FUNC &&
828 (type == DRIZZLE_TYPE_TIMESTAMP or type == DRIZZLE_TYPE_MICROTIME)))
830 my_error(ER_INVALID_DEFAULT, MYF(0), field_name.data());
833 else if (default_value->type() == Item::NULL_ITEM)
836 if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == NOT_NULL_FLAG)
838 my_error(ER_INVALID_DEFAULT, MYF(0), field_name.data());
842 else if (type_modifier & AUTO_INCREMENT_FLAG)
844 my_error(ER_INVALID_DEFAULT, MYF(0), field_name.data());
849 if (on_update_value && (type != DRIZZLE_TYPE_TIMESTAMP and type != DRIZZLE_TYPE_MICROTIME))
851 my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name.data());
856 if (new_field->
init(session, field_name.data(), type, length, decimals, type_modifier, comment, change, interval_list, cs, 0, column_format)
857 || new_field->setDefaultValue(default_value, on_update_value))
860 statement->alter_info.create_list.push_back(new_field);
861 lex->last_field=new_field;
886 TableList *Select_Lex::add_table_to_list(Session *session,
889 const bitset<NUM_OF_TABLE_OPTIONS>& table_options,
890 thr_lock_type lock_type,
891 List<Index_hint> *index_hints_arg,
892 lex_string_t *option)
894 TableList *previous_table_ref;
895 LEX *lex= &session->lex();
899 const char* alias_str= alias ? alias->data() : table->table.data();
900 if (not table_options.test(TL_OPTION_ALIAS) && check_table_name(table->table))
902 my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.data());
906 if (not table->is_derived_table() && table->db.data())
908 files_charset_info->casedn_str(table->db.str_);
909 if (not schema::check(*session, identifier::Schema(session->catalog().identifier(), table->db)))
911 my_error(ER_WRONG_DB_NAME, MYF(0), table->db.data());
920 my_message(ER_DERIVED_MUST_HAVE_ALIAS, ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0));
923 alias_str= (
char*) session->mem.memdup(alias_str, table->table.size() + 1);
925 TableList *ptr = (TableList *) session->mem.calloc(
sizeof(TableList));
927 if (table->db.data())
929 ptr->setIsFqtn(
true);
930 ptr->setSchemaName(table->db.data());
934 str_ref schema = lex->session->copy_db_to();
937 ptr->setIsFqtn(
false);
938 ptr->setSchemaName(schema.data());
941 ptr->alias= alias_str;
942 ptr->setIsAlias(alias ?
true :
false);
943 ptr->setTableName(table->table.data());
944 ptr->lock_type= lock_type;
945 ptr->force_index= table_options.test(TL_OPTION_FORCE_INDEX);
946 ptr->ignore_leaves= table_options.test(TL_OPTION_IGNORE_LEAVES);
947 ptr->derived= table->sel;
948 ptr->select_lex= lex->current_select;
949 ptr->index_hints= index_hints_arg;
950 ptr->option= option ? option->data() : NULL;
952 if (lock_type != TL_IGNORE)
954 TableList *first_table= (TableList*) table_list.first;
955 for (TableList *tables= first_table; tables; tables= tables->next_local)
957 if (not table_alias_charset->strcasecmp(alias_str, tables->alias) &&
958 not system_charset_info->strcasecmp(ptr->getSchemaName(), tables->getSchemaName()))
960 my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str);
966 if (table_list.size() > 0)
973 previous_table_ref= (TableList*) ((
char*) table_list.next - ((
char*) &(ptr->next_local) - (
char*) ptr));
981 previous_table_ref->next_name_resolution_table= ptr;
990 table_list.link_in_list((
unsigned char*) ptr, (
unsigned char**) &ptr->next_local);
991 ptr->next_name_resolution_table= NULL;
993 lex->add_to_query_tables(ptr);
1017 void Select_Lex::init_nested_join(Session& session)
1019 TableList* ptr= (TableList*) session.mem.calloc(ALIGN_SIZE(
sizeof(TableList)) +
sizeof(NestedJoin));
1020 ptr->setNestedJoin(((NestedJoin*) ((
unsigned char*) ptr + ALIGN_SIZE(
sizeof(TableList)))));
1021 NestedJoin* nested_join= ptr->getNestedJoin();
1022 join_list->push_front(ptr);
1023 ptr->setEmbedding(embedding);
1024 ptr->setJoinList(join_list);
1025 ptr->alias= (
char*)
"(nested_join)";
1027 join_list= &nested_join->join_list;
1046 TableList *Select_Lex::end_nested_join()
1049 TableList* ptr= embedding;
1050 join_list= ptr->getJoinList();
1051 embedding= ptr->getEmbedding();
1052 NestedJoin* nested_join= ptr->getNestedJoin();
1053 if (nested_join->join_list.size() == 1)
1055 TableList *embedded= &nested_join->join_list.front();
1057 embedded->setJoinList(join_list);
1058 embedded->setEmbedding(embedding);
1059 join_list->push_front(embedded);
1062 else if (not nested_join->join_list.size())
1084 TableList *Select_Lex::nest_last_join(Session *session)
1086 TableList* ptr= (TableList*) session->mem.calloc(ALIGN_SIZE(
sizeof(TableList)) +
sizeof(NestedJoin));
1087 ptr->setNestedJoin(((NestedJoin*) ((
unsigned char*) ptr + ALIGN_SIZE(
sizeof(TableList)))));
1088 NestedJoin* nested_join= ptr->getNestedJoin();
1089 ptr->setEmbedding(embedding);
1090 ptr->setJoinList(join_list);
1091 ptr->alias= (
char*)
"(nest_last_join)";
1092 List<TableList>* embedded_list= &nested_join->join_list;
1093 embedded_list->clear();
1095 for (uint32_t i=0; i < 2; i++)
1097 TableList *table= join_list->pop();
1098 table->setJoinList(embedded_list);
1099 table->setEmbedding(ptr);
1100 embedded_list->push_back(table);
1101 if (table->natural_join)
1103 ptr->is_natural_join=
true;
1108 if (prev_join_using)
1109 ptr->join_using_fields= prev_join_using;
1112 join_list->push_front(ptr);
1113 nested_join->used_tables= nested_join->not_null_tables= (table_map) 0;
1132 void Select_Lex::add_joined_table(TableList *table)
1134 join_list->push_front(table);
1135 table->setJoinList(join_list);
1136 table->setEmbedding(embedding);
1171 TableList *Select_Lex::convert_right_join()
1173 TableList *tab2= join_list->pop();
1174 TableList *tab1= join_list->pop();
1176 join_list->push_front(tab2);
1177 join_list->push_front(tab1);
1178 tab1->outer_join|= JOIN_TYPE_RIGHT;
1194 void Select_Lex::set_lock_for_tables(thr_lock_type lock_type)
1196 for (TableList *tables= (TableList*) table_list.first; tables; tables= tables->next_local)
1198 tables->lock_type= lock_type;
1229 bool Select_Lex_Unit::add_fake_select_lex(Session *session_arg)
1231 Select_Lex *first_sl= first_select();
1232 assert(!fake_select_lex);
1234 fake_select_lex=
new (session_arg->mem_root) Select_Lex();
1235 fake_select_lex->include_standalone(
this, (Select_Lex_Node**)&fake_select_lex);
1236 fake_select_lex->select_number= INT_MAX;
1237 fake_select_lex->parent_lex= &session_arg->lex();
1238 fake_select_lex->make_empty_select();
1239 fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE;
1240 fake_select_lex->select_limit= 0;
1242 fake_select_lex->context.outer_context=first_sl->context.outer_context;
1244 fake_select_lex->context.resolve_in_select_list=
true;
1245 fake_select_lex->context.select_lex= fake_select_lex;
1255 global_parameters= fake_select_lex;
1256 fake_select_lex->no_table_names_allowed= 1;
1257 session_arg->lex().current_select= fake_select_lex;
1259 session_arg->lex().pop_context();
1283 void push_new_name_resolution_context(Session& session, TableList& left_op, TableList& right_op)
1285 Name_resolution_context *on_context=
new (session.mem_root) Name_resolution_context;
1287 on_context->first_name_resolution_table= left_op.first_leaf_for_name_resolution();
1288 on_context->last_name_resolution_table= right_op.last_leaf_for_name_resolution();
1289 session.lex().push_context(on_context);
1307 void add_join_on(TableList *b, Item *expr)
1320 b->on_expr=
new Item_cond_and(b->on_expr,expr);
1322 b->on_expr->top_level_item();
1364 lex->prev_join_using= using_fields;
1379 if (session->lex().current_select != &session->lex().select_lex)
1383 strncpy(command, lip->
yylval->symbol.str,
1384 min(lip->
yylval->symbol.length, (uint32_t)(
sizeof(command)-1)));
1385 command[min(lip->
yylval->symbol.length, (uint32_t)(
sizeof(command)-1))]=0;
1386 my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command);
1405 chooser_compare_func_creator cmp,
1407 Select_Lex *select_lex)
1409 if ((cmp == &comp_eq_creator) && !all)
1412 if ((cmp == &comp_ne_creator) && all)
1439 Select_Lex *select_lex= &session->lex().select_lex;
1441 if (session->lex().select_lex.item_list.size() != session->lex().value_list.size())
1443 my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
1447 if (session->lex().select_lex.table_list.size() > 1)
1449 if (select_lex->order_list.size())
1451 else if (select_lex->select_limit)
1455 my_error(ER_WRONG_USAGE, MYF(0),
"UPDATE", msg);
1481 if (session->lex().update_list.size() != session->lex().value_list.size())
1483 my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0));
1503 if (expr->type() == Item::FUNC_ITEM &&
1504 ((
Item_func *) expr)->functype() == Item_func::NOT_FUNC)
1508 enum_parsing_place place= session->lex().current_select->parsing_place;
1509 if (arg->is_bool_func() || place == IN_WHERE || place == IN_HAVING)
1518 if ((negated= expr->neg_transformer(session)) != 0)
1540 bool check_string_char_length(
str_ref str,
const char *err_msg,
1541 uint32_t max_char_length,
const charset_info_st *
const cs,
1544 int well_formed_error;
1545 uint32_t res= cs->cset->well_formed_len(*cs, str, max_char_length, &well_formed_error);
1547 if (!well_formed_error && str.size() == res)
1551 my_error(ER_WRONG_STRING_LENGTH, MYF(0), str.data(), err_msg, max_char_length);
1556 bool check_identifier_name(
str_ref str, error_t err_code)
1558 uint32_t max_char_length= NAME_CHAR_LEN;
1564 const charset_info_st *
const cs= &my_charset_utf8mb4_general_ci;
1566 int well_formed_error;
1567 uint32_t res= cs->cset->well_formed_len(*cs, str, max_char_length, &well_formed_error);
1569 if (well_formed_error)
1571 my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
"identifier", str.data());
1575 if (str.size() == res)
1582 case ER_WRONG_STRING_LENGTH:
1583 my_error(err_code, MYF(0), str.data(),
"", max_char_length);
1585 case ER_TOO_LONG_IDENT:
1586 my_error(err_code, MYF(0), str.data());
1610 assert(session->
m_lip == NULL);
1612 DRIZZLE_QUERY_PARSE_START(session->getQueryString()->c_str());
1616 session->
m_lip= lip;
1620 bool parse_status= base_sql_parse(session) != 0;
1624 assert(!parse_status || session->
is_error());
1628 session->
m_lip= NULL;
1630 DRIZZLE_QUERY_PARSE_DONE(parse_status || session->
is_fatal_error);
void my_ok(ha_rows affected_rows=0, ha_rows found_rows_arg=0, uint64_t passed_id=0, const char *message=NULL)
Item * negate_expression(Session *session, Item *expr)
bool init(Session *, const char *field_name, enum_field_types type, const char *length, const char *decimals, uint32_t type_modifier, str_ref comment, const char *change, List< String > *interval_list, const charset_info_st *, uint32_t uint_geom_type, column_format_type column_format)
void set_proc_info(const char *info)
bitset< CF_BIT_SIZE > sql_command_flags[SQLCOM_END+1]
bool hasModifiedNonTransData() const
void parse(Session &, str_ref)
Item * all_any_subquery_creator(Item *left_expr, chooser_compare_func_creator cmp, bool all, Select_Lex *select_lex)
void readAndStoreQuery(str_ref)
bool add_field_to_list(Session *session, str_ref field_name, enum enum_field_types type, const char *length, const char *decimal, uint32_t type_modifier, enum column_format_type column_format, Item *default_value, Item *on_update_value, str_ref comment, const char *change, List< String > *interval_list, const charset_info_st *const cs)
bool can_overwrite_status
static bool _schema_select(Session &session, Select_Lex &sel, const string &schema_table_name)
void setQueryId(query_id_t in_query_id)
void create_select_for_variable(Session *session, const char *var_name)
void close_thread_tables()
void add_join_natural(TableList *a, TableList *b, List< String > *using_fields, Select_Lex *lex)
lex_string_t * make_lex_string(lex_string_t *, str_ref)
Visibility Control Macros.
bool handle_select(Session *session, LEX *lex, select_result *result, uint64_t setup_tables_done_option)
static int execute_command(Session *session)
bool check_simple_select(Session *session)
static bool parse_sql(Session *session, Lex_input_stream *lip)
void reset_for_next_command()
bool update_precheck(Session *session, TableList *)
bool insert_precheck(Session *session, TableList *)
enum_server_command command
void free_root(myf MyFLAGS)
Deallocate everything used by alloc_root or just move used blocks to free list if called with MY_USED...
bool inTransaction() const
void cleanup_after_query()
bool dispatch_command(enum_server_command command, Session &session, str_ref packet)