Macros | |
#define | MY_YACC_INIT 1000 |
#define | MY_YACC_MAX 32000 |
Functions | |
const std::string & | drizzled::getCommandName (const enum_server_command &command) |
void | drizzled::init_update_queries (void) |
bool | drizzled::dispatch_command (enum_server_command command, Session &session, str_ref packet) |
static bool | drizzled::_schema_select (Session &session, Select_Lex &sel, const string &schema_table_name) |
int | drizzled::prepare_new_schema_table (Session *session, LEX &lex0, const string &schema_table_name) |
static int | drizzled::execute_command (Session *session) |
bool | drizzled::execute_sqlcom_select (Session *session, TableList *all_tables) |
bool | drizzled::my_yyoverflow (short **a, ParserType **b, ulong *yystacksize) |
void | drizzled::init_select (LEX *lex) |
bool | drizzled::new_select (LEX *lex, bool move_down) |
void | drizzled::create_select_for_variable (Session *session, const char *var_name) |
void | drizzled::parse (Session &, str_ref) |
bool | drizzled::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) |
void | drizzled::add_join_natural (TableList *a, TableList *b, List< String > *using_fields, Select_Lex *lex) |
bool | drizzled::check_simple_select (Session *session) |
Item * | drizzled::all_any_subquery_creator (Item *left_expr, chooser_compare_func_creator cmp, bool all, Select_Lex *select_lex) |
bool | drizzled::update_precheck (Session *session, TableList *) |
bool | drizzled::insert_precheck (Session *session, TableList *) |
Item * | drizzled::negate_expression (Session *session, Item *expr) |
bool | drizzled::check_string_char_length (str_ref str, const char *err_msg, uint32_t max_char_length, const charset_info_st *const cs, bool no_error) |
bool | drizzled::check_identifier_name (str_ref str, error_t err_code) |
static bool | drizzled::parse_sql (Session *session, Lex_input_stream *lip) |
Variables | |
size_t | drizzled::my_thread_stack_size = 0 |
const charset_info_st * | drizzled::character_set_filesystem |
static atomic< uint64_t > | drizzled::g_query_id |
const char * | drizzled::xa_state_names [] |
bitset< CF_BIT_SIZE > | drizzled::sql_command_flags [SQLCOM_END+1] |
|
static |
Create a TableList object for an INFORMATION_SCHEMA table.
This function is used in the parser to convert a SHOW or DESCRIBE table_name command to a SELECT from INFORMATION_SCHEMA. It prepares a Select_Lex and a TableList object to represent the given command as a SELECT parse tree.
session | thread handle |
lex | current lex |
table_ident | table alias if it's used |
schema_table_name | the name of the INFORMATION_SCHEMA table to be created |
0 | success |
1 | out of memory or SHOW commands are not allowed in this version of the server. |
Definition at line 395 of file sql_parse.cc.
References drizzled::Session::make_lex_string().
bool drizzled::add_field_to_list | ( | Session * | session, |
str_ref | field_name, | ||
enum_field_types | type, | ||
const char * | length, | ||
const char * | decimals, | ||
uint32_t | type_modifier, | ||
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 * | cs | ||
) |
Store field definition for create.
Definition at line 792 of file sql_parse.cc.
References drizzled::CreateField::init().
void drizzled::add_join_natural | ( | TableList * | a, |
TableList * | b, | ||
List< String > * | using_fields, | ||
Select_Lex * | lex | ||
) |
Create a fake Select_Lex for a unit.
The method create a fake Select_Lex object for a unit. This object is created for any union construct containing a union operation and also for any single select union construct of the form
(SELECT ... ORDER BY order_list [LIMIT n]) ORDER BY ... @endvarbatim or of the form @varbatim (SELECT ... ORDER BY LIMIT n) ORDER BY ... @endvarbatim @param session_arg thread handle @note The object is used to retrieve rows from the temporary table where the result on the union is obtained. @retval 1 on failure to create the object @retval 0 on success */ bool Select_Lex_Unit::add_fake_select_lex(Session *session_arg) { Select_Lex *first_sl= first_select(); assert(!fake_select_lex); fake_select_lex= new (session_arg->mem_root) Select_Lex(); fake_select_lex->include_standalone(this, (Select_Lex_Node**)&fake_select_lex); fake_select_lex->select_number= INT_MAX; fake_select_lex->parent_lex= &session_arg->lex(); /* Used in init_query. */ fake_select_lex->make_empty_select(); fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE; fake_select_lex->select_limit= 0; fake_select_lex->context.outer_context=first_sl->context.outer_context; /* allow item list resolving in fake select for ORDER BY */ fake_select_lex->context.resolve_in_select_list= true; fake_select_lex->context.select_lex= fake_select_lex; if (!is_union()) { /* This works only for (SELECT ... ORDER BY list [LIMIT n]) ORDER BY order_list [LIMIT m], (SELECT ... LIMIT n) ORDER BY order_list [LIMIT m] just before the parser starts processing order_list */ global_parameters= fake_select_lex; fake_select_lex->no_table_names_allowed= 1; session_arg->lex().current_select= fake_select_lex; } session_arg->lex().pop_context(); return 0; } /** Push a new name resolution context for a JOIN ... ON clause to the context stack of a query block. Create a new name resolution context for a JOIN ... ON clause, set the first and last leaves of the list of table references to be used for name resolution, and push the newly created context to the stack of contexts of the query. @param session pointer to current thread @param left_op left operand of the JOIN @param right_op rigth operand of the JOIN @retval false if all is OK @retval true if a memory allocation error occured */ void push_new_name_resolution_context(Session& session, TableList& left_op, TableList& right_op) { Name_resolution_context *on_context= new (session.mem_root) Name_resolution_context; on_context->init(); on_context->first_name_resolution_table= left_op.first_leaf_for_name_resolution(); on_context->last_name_resolution_table= right_op.last_leaf_for_name_resolution(); session.lex().push_context(on_context); } /** Add an ON condition to the second operand of a JOIN ... ON. Add an ON condition to the right operand of a JOIN ... ON clause. @param b the second operand of a JOIN ... ON @param expr the condition to be added to the ON clause @retval false if there was some error @retval true if all is OK */ void add_join_on(TableList *b, Item *expr) { if (expr) { if (!b->on_expr) b->on_expr= expr; else { /* If called from the parser, this happens if you have both a right and left join. If called later, it happens if we add more than one condition to the ON clause. */ b->on_expr= new Item_cond_and(b->on_expr,expr); } b->on_expr->top_level_item(); } } /** Mark that there is a NATURAL JOIN or JOIN ... USING between two tables. This function marks that table b should be joined with a either via a NATURAL JOIN or via JOIN ... USING. Both join types are special cases of each other, so we treat them together. The function setup_conds() creates a list of equal condition between all fields of the same name for NATURAL JOIN or the fields in 'using_fields' for JOIN ... USING. The list of equality conditions is stored either in b->on_expr, or in JOIN::conds, depending on whether there was an outer join. EXAMPLE @verbatim SELECT * FROM t1 NATURAL LEFT JOIN t2 <=> SELECT * FROM t1 LEFT JOIN t2 ON (t1.i=t2.i and t1.j=t2.j ... ) SELECT * FROM t1 NATURAL JOIN t2 WHERE <some_cond> <=> SELECT * FROM t1, t2 WHERE (t1.i=t2.i and t1.j=t2.j and <some_cond>) SELECT * FROM t1 JOIN t2 USING(j) WHERE <some_cond> <=> SELECT * FROM t1, t2 WHERE (t1.j=t2.j and <some_cond>)
a | Left join argument |
b | Right join argument |
using_fields | Field names from USING clause |
Definition at line 1360 of file sql_parse.cc.
References drizzled::TableList::natural_join.
Item * drizzled::all_any_subquery_creator | ( | Item * | left_expr, |
chooser_compare_func_creator | cmp, | ||
bool | all, | ||
Select_Lex * | select_lex | ||
) |
Construct ALL/ANY/SOME subquery Item.
left_expr | pointer to left expression |
cmp | compare function creator |
all | true if we create ALL subquery |
select_lex | pointer on parsed subquery structure |
Definition at line 1404 of file sql_parse.cc.
bool drizzled::check_simple_select | ( | Session * | session | ) |
Check if the select is a simple select (not an union).
0 | ok |
1 | error ; In this case the error messege is sent to the client |
Definition at line 1377 of file sql_parse.cc.
References drizzled::Session::m_lip, and drizzled::Lex_input_stream::yylval.
void drizzled::create_select_for_variable | ( | Session * | session, |
const char * | var_name | ||
) |
Create a select to return the same output as 'SELECT @var_name'.
Used for SHOW COUNT(*) [ WARNINGS | ERROR].
This will crash with a core dump if the variable doesn't exists.
var_name | Variable name |
Definition at line 717 of file sql_parse.cc.
bool drizzled::dispatch_command | ( | enum_server_command | command, |
Session & | session, | ||
str_ref | packet | ||
) |
Perform one connection-level (COM_XXXX) command.
command | type of command to perform |
session | connection handle |
packet | data for the command, packet is always null-terminated |
packet_length | length of packet + 1 (to show that data is null-terminated) except for COM_SLEEP, where it can be zero. |
set session->lex().sql_command to SQLCOM_END here.
The following has to be changed to an 8 byte integer
0 | ok |
1 | request of thread shutdown, i. e. if command is COM_QUIT/COM_SHUTDOWN |
Definition at line 192 of file sql_parse.cc.
References drizzled::Diagnostics_area::can_overwrite_status, drizzled::Session::close_thread_tables(), drizzled::Session::command, drizzled::Diagnostics_area::disable_status(), drizzled::memory::Root::free_root(), drizzled::Session::is_error(), drizzled::Diagnostics_area::is_sent, drizzled::kill_drizzle(), drizzled::Session::mem_root, drizzled::Session::my_eof(), drizzled::Session::my_ok(), drizzled::parse(), drizzled::Session::readAndStoreQuery(), drizzled::Session::set_proc_info(), drizzled::Session::setQueryId(), and drizzled::session::Transactions::stmt.
Referenced by drizzled::Session::executeStatement().
|
static |
Execute command saved in session and lex->sql_command.
Before every operation that can request a write lock for a table wait if a global read lock exists. However do not wait if this thread has locked tables already. No new locks can be requested until the other locks are released. The thread that requests the global read lock waits for write locked tables to become unlocked.
Note that wait_if_global_read_lock() sets a protection against a new global read lock when it succeeds. This needs to be released by start_waiting_global_read_lock() after the operation.
session | Thread handle |
false | OK |
true | Error |
Definition at line 448 of file sql_parse.cc.
References drizzled::TransactionContext::hasModifiedNonTransData(), drizzled::Session::inTransaction(), drizzled::Session::is_error(), drizzled::Session::row_count_func, drizzled::Session::set_proc_info(), drizzled::sql_command_flags, and drizzled::session::Transactions::stmt.
Referenced by drizzled::parse().
bool drizzled::insert_precheck | ( | Session * | session, |
TableList * | |||
) |
simple INSERT query pre-check.
session | Thread handler |
tables | Global table list |
false | OK |
true | error |
Definition at line 1475 of file sql_parse.cc.
Referenced by drizzled::statement::Insert::execute(), drizzled::statement::ReplaceSelect::execute(), drizzled::statement::InsertSelect::execute(), and drizzled::statement::Replace::execute().
Item * drizzled::negate_expression | ( | Session * | session, |
Item * | expr | ||
) |
negate given expression.
session | thread handler |
expr | expression for negation |
Definition at line 1500 of file sql_parse.cc.
void drizzled::parse | ( | Session & | , |
str_ref | |||
) |
Parse a query.
session | Current thread |
inBuf | Begining of the query text |
length | Length of the query text |
Definition at line 747 of file sql_parse.cc.
References drizzled::Session::cleanup_after_query(), drizzled::Session::end_statement(), drizzled::execute_command(), drizzled::Session::is_error(), drizzled::parse_sql(), drizzled::Session::reset_for_next_command(), and drizzled::Session::set_proc_info().
Referenced by drizzled::dispatch_command().
|
static |
This is a wrapper of DRIZZLEparse(). All the code should call parse_sql() instead of DRIZZLEparse().
session | Thread context. |
lip | Lexer context. |
false | on success. |
true | on parsing error. |
Definition at line 1608 of file sql_parse.cc.
References drizzled::Session::is_error(), drizzled::Session::is_fatal_error, and drizzled::Session::m_lip.
Referenced by drizzled::parse().
bool drizzled::update_precheck | ( | Session * | session, |
TableList * | |||
) |
Update query pre-check.
session | Thread handler |
tables | Global/local table list (have to be the same) |
false | OK |
true | Error |
Definition at line 1436 of file sql_parse.cc.
Referenced by drizzled::statement::Update::execute().
bitset<CF_BIT_SIZE> drizzled::sql_command_flags[SQLCOM_END+1] |
Mark all commands that somehow changes a table.
This is used to check number of updates / hour.
sql_command is actually set to SQLCOM_END sometimes so we need the +1 to include it in the array.
See COMMAND_FLAG_xxx for different type of commands 2 - query that returns meaningful ROW_COUNT() - a number of modified rows
Definition at line 126 of file sql_parse.cc.
Referenced by drizzled::execute_command().
const char * drizzled::xa_state_names |
Definition at line 108 of file sql_parse.cc.