My Project
|
Modules | |
Event Scheduler | |
Stored Routines | |
Defines | |
#define | SP_TYPE_STRING(LP) ((LP)->sphead->m_type == SP_TYPE_FUNCTION ? "FUNCTION" : "PROCEDURE") |
#define | SP_COM_STRING(LP) |
#define | used_stack(A, B) (long) (B - A) |
#define | MY_YACC_INIT 1000 |
#define | MY_YACC_MAX 32000 |
Functions | |
Slow_log_throttle log_throttle_qni & | opt_log_throttle_queries_not_using_indexes (s) suppressed." |
bool | stmt_causes_implicit_commit (const THD *thd, uint mask) |
void | init_update_queries (void) |
bool | sqlcom_can_generate_row_events (const THD *thd) |
bool | is_update_query (enum enum_sql_command command) |
bool | is_explainable_query (enum enum_sql_command command) |
bool | is_log_table_write_query (enum enum_sql_command command) |
void | execute_init_command (THD *thd, LEX_STRING *init_command, mysql_rwlock_t *var_lock) |
pthread_handler_t | handle_bootstrap (void *arg) |
void | do_handle_bootstrap (THD *thd) |
void | free_items (Item *item) |
void | cleanup_items (Item *item) |
bool | do_command (THD *thd) |
bool | dispatch_command (enum enum_server_command command, THD *thd, char *packet, uint packet_length) |
bool | log_slow_applicable (THD *thd) |
void | log_slow_do (THD *thd) |
void | log_slow_statement (THD *thd) |
int | prepare_schema_table (THD *thd, LEX *lex, Table_ident *table_ident, enum enum_schema_tables schema_table_idx) |
bool | alloc_query (THD *thd, const char *packet, uint packet_length) |
int | mysql_execute_command (THD *thd) |
bool | check_single_table_access (THD *thd, ulong privilege, TABLE_LIST *all_tables, bool no_errors) |
bool | check_one_table_access (THD *thd, ulong privilege, TABLE_LIST *all_tables) |
bool | check_access (THD *thd, ulong want_access, const char *db, ulong *save_priv, GRANT_INTERNAL_INFO *grant_internal_info, bool dont_check_global_grants, bool no_errors) |
Compare requested privileges with the privileges acquired from the User- and Db-tables. | |
bool | check_table_access (THD *thd, ulong requirements, TABLE_LIST *tables, bool any_combination_of_privileges_will_do, uint number, bool no_errors) |
Check if the requested privileges exists in either User-, Host- or Db-tables. | |
bool | check_routine_access (THD *thd, ulong want_access, char *db, char *name, bool is_proc, bool no_errors) |
bool | check_some_routine_access (THD *thd, const char *db, const char *name, bool is_proc) |
bool | check_some_access (THD *thd, ulong want_access, TABLE_LIST *table) |
bool | check_global_access (THD *thd, ulong want_access) |
bool | check_fk_parent_table_access (THD *thd, HA_CREATE_INFO *create_info, Alter_info *alter_info) |
bool | check_stack_overrun (THD *thd, long margin, uchar *buf __attribute__((unused))) |
bool | my_yyoverflow (short **yyss, YYSTYPE **yyvs, ulong *yystacksize) |
void | mysql_reset_thd_for_next_command (THD *thd) |
void | mysql_init_select (LEX *lex) |
bool | mysql_new_select (LEX *lex, bool move_down) |
void | create_select_for_variable (const char *var_name) |
void | mysql_init_multi_delete (LEX *lex) |
void | mysql_parse (THD *thd, char *rawbuf, uint length, Parser_state *parser_state) |
bool | add_field_to_list (THD *thd, LEX_STRING *field_name, enum_field_types type, char *length, char *decimals, uint type_modifier, Item *default_value, Item *on_update_value, LEX_STRING *comment, char *change, List< String > *interval_list, const CHARSET_INFO *cs, uint uint_geom_type) |
void | store_position_for_column (const char *name) |
bool | add_to_list (THD *thd, SQL_I_List< ORDER > &list, Item *item, bool asc) |
void | add_join_natural (TABLE_LIST *a, TABLE_LIST *b, List< String > *using_fields, SELECT_LEX *lex) |
uint | kill_one_thread (THD *thd, ulong id, bool only_kill_query) |
bool | append_file_to_dir (THD *thd, const char **filename_ptr, const char *table_name) |
bool | check_simple_select () |
Comp_creator * | comp_eq_creator (bool invert) |
Comp_creator * | comp_ge_creator (bool invert) |
Comp_creator * | comp_gt_creator (bool invert) |
Comp_creator * | comp_le_creator (bool invert) |
Comp_creator * | comp_lt_creator (bool invert) |
Comp_creator * | comp_ne_creator (bool invert) |
Item * | all_any_subquery_creator (Item *left_expr, chooser_compare_func_creator cmp, bool all, SELECT_LEX *select_lex) |
bool | select_precheck (THD *thd, LEX *lex, TABLE_LIST *tables, TABLE_LIST *first_table) |
bool | multi_update_precheck (THD *thd, TABLE_LIST *tables) |
bool | multi_delete_precheck (THD *thd, TABLE_LIST *tables) |
bool | multi_delete_set_locks_and_link_aux_tables (LEX *lex) |
bool | update_precheck (THD *thd, TABLE_LIST *tables) |
bool | delete_precheck (THD *thd, TABLE_LIST *tables) |
bool | insert_precheck (THD *thd, TABLE_LIST *tables) |
void | create_table_set_open_action_and_adjust_tables (LEX *lex) |
bool | create_table_precheck (THD *thd, TABLE_LIST *tables, TABLE_LIST *create_table) |
Item * | negate_expression (THD *thd, Item *expr) |
void | get_default_definer (THD *thd, LEX_USER *definer) |
LEX_USER * | create_default_definer (THD *thd) |
LEX_USER * | create_definer (THD *thd, LEX_STRING *user_name, LEX_STRING *host_name) |
LEX_USER * | get_current_user (THD *thd, LEX_USER *user) |
bool | check_string_byte_length (LEX_STRING *str, const char *err_msg, uint max_byte_length) |
bool | check_string_char_length (LEX_STRING *str, const char *err_msg, uint max_char_length, const CHARSET_INFO *cs, bool no_error) |
C_MODE_START int | test_if_data_home_dir (const char *dir) |
C_MODE_END bool | check_host_name (LEX_STRING *str) |
int | MYSQLparse (class THD *thd) |
bool | parse_sql (THD *thd, Parser_state *parser_state, Object_creation_ctx *creation_ctx) |
Variables | |
const char * | any_db = "*any*" |
const LEX_STRING | command_name [] |
const char * | xa_state_names [] |
uint | sql_command_flags [SQLCOM_END+1] |
uint | server_command_flags [COM_END+1] |
long | max_stack_used |
#define SP_COM_STRING | ( | LP | ) |
((LP)->sql_command == SQLCOM_CREATE_SPFUNCTION || \ (LP)->sql_command == SQLCOM_ALTER_FUNCTION || \ (LP)->sql_command == SQLCOM_SHOW_CREATE_FUNC || \ (LP)->sql_command == SQLCOM_DROP_FUNCTION ? \ "FUNCTION" : "PROCEDURE")
bool add_field_to_list | ( | THD * | thd, |
LEX_STRING * | field_name, | ||
enum_field_types | type, | ||
char * | length, | ||
char * | decimals, | ||
uint | type_modifier, | ||
Item * | default_value, | ||
Item * | on_update_value, | ||
LEX_STRING * | comment, | ||
char * | change, | ||
List< String > * | interval_list, | ||
const CHARSET_INFO * | cs, | ||
uint | uint_geom_type | ||
) |
Store field definition for create.
void add_join_natural | ( | TABLE_LIST * | a, |
TABLE_LIST * | 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 thd_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 st_select_lex_unit::add_fake_select_lex(THD *thd_arg) { SELECT_LEX *first_sl= first_select(); DBUG_ENTER("add_fake_select_lex"); DBUG_ASSERT(!fake_select_lex); if (!(fake_select_lex= new (thd_arg->mem_root) SELECT_LEX())) DBUG_RETURN(1); fake_select_lex->include_standalone(this, (SELECT_LEX_NODE**)&fake_select_lex); fake_select_lex->select_number= INT_MAX; fake_select_lex->parent_lex= thd_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; thd_arg->lex->current_select= fake_select_lex; } thd_arg->lex->pop_context(); DBUG_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 thd pointer to current thread @param left_op left operand of the JOIN @param right_op rigth operand of the JOIN @todo Research if we should set the "outer_context" member of the new ON context. @retval FALSE if all is OK @retval TRUE if a memory allocation error occured */ bool push_new_name_resolution_context(THD *thd, TABLE_LIST *left_op, TABLE_LIST *right_op) { Name_resolution_context *on_context; if (!(on_context= new (thd->mem_root) Name_resolution_context)) return TRUE; 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(); on_context->select_lex= thd->lex->current_select; // Save join nest's context in right_op, to find it later in view merging. DBUG_ASSERT(right_op->context_of_embedding == NULL); right_op->context_of_embedding= on_context; return thd->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 */ void add_join_on(TABLE_LIST *b, Item *expr) { if (expr) { if (!b->join_cond()) b->set_join_cond(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->set_join_cond(new Item_cond_and(b->join_cond(), expr)); } b->join_cond()->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->join_cond(), 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 |
bool add_to_list | ( | THD * | thd, |
SQL_I_List< ORDER > & | list, | ||
Item * | item, | ||
bool | asc | ||
) |
save order by and tables in own lists.
Item* all_any_subquery_creator | ( | Item * | left_expr, |
chooser_compare_func_creator | cmp, | ||
bool | all, | ||
SELECT_LEX * | select_lex | ||
) |
bool alloc_query | ( | THD * | thd, |
const char * | packet, | ||
uint | packet_length | ||
) |
Read query from packet and store in thd->query. Used in COM_QUERY and COM_STMT_PREPARE.
Sets the following THD variables:
FALSE | ok |
TRUE | error; In this case thd->fatal_error is set |
bool append_file_to_dir | ( | THD * | thd, |
const char ** | filename_ptr, | ||
const char * | table_name | ||
) |
If pointer is not a null pointer, append filename to it.
bool check_access | ( | THD * | thd, |
ulong | want_access, | ||
const char * | db, | ||
ulong * | save_priv, | ||
GRANT_INTERNAL_INFO * | grant_internal_info, | ||
bool | dont_check_global_grants, | ||
bool | no_errors | ||
) |
Compare requested privileges with the privileges acquired from the User- and Db-tables.
thd | Thread handler | |
want_access | The requested access privileges. | |
db | A pointer to the Db name. | |
[out] | save_priv | A pointer to the granted privileges will be stored. |
grant_internal_info | A pointer to the internal grant cache. | |
dont_check_global_grants | True if no global grants are checked. | |
no_error | True if no errors should be sent to the client. |
'save_priv' is used to save the User-table (global) and Db-table grants for the supplied db name. Note that we don't store db level grants if the global grants is enough to satisfy the request AND the global grants contains a SELECT grant.
For internal databases (INFORMATION_SCHEMA, PERFORMANCE_SCHEMA), additional rules apply, see ACL_internal_schema_access.
FALSE | Access can't exclusively be denied by Db- and User-table access unless Column- and Table-grants are checked too. |
TRUE | Access denied. |
bool check_fk_parent_table_access | ( | THD * | thd, |
HA_CREATE_INFO * | create_info, | ||
Alter_info * | alter_info | ||
) |
Checks foreign key's parent table access.
thd | [in] Thread handler |
create_info | [in] Create information (like MAX_ROWS, ENGINE or temporary table flag) |
alter_info | [in] Initial list of columns and indexes for the table to be created |
false | ok. |
true | error or access denied. Error is sent to client in this case. |
bool check_global_access | ( | THD * | thd, |
ulong | want_access | ||
) |
check for global access and give descriptive error message if it fails.
thd | Thread handler |
want_access | Use should have any of these global rights |
0 | ok |
1 | Access denied. In this case an error is sent to the client |
C_MODE_END bool check_host_name | ( | LEX_STRING * | str | ) |
Check that host name string is valid.
[in] | str | string to be checked |
FALSE | host name is ok |
TRUE | host name string is longer than max_length or has invalid symbols |
bool check_one_table_access | ( | THD * | thd, |
ulong | privilege, | ||
TABLE_LIST * | all_tables | ||
) |
Check grants for commands which work only with one table and all other tables belonging to subselects or implicitly opened tables.
thd | Thread handler |
privilege | requested privilege |
all_tables | global table list of query |
0 | OK |
1 | access denied, error is sent to client |
bool select_dumpvar::check_simple_select | ( | ) |
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 |
bool check_single_table_access | ( | THD * | thd, |
ulong | privilege, | ||
TABLE_LIST * | all_tables, | ||
bool | no_errors | ||
) |
Check grants for commands which work only with one table.
thd | Thread handler |
privilege | requested privilege |
all_tables | global table list of query |
no_errors | FALSE/TRUE - report/don't report error to the client (using my_error() call). |
0 | OK |
1 | access denied, error is sent to client |
bool check_some_access | ( | THD * | thd, |
ulong | want_access, | ||
TABLE_LIST * | table | ||
) |
Check if the given table has any of the asked privileges
thd | Thread handler |
want_access | Bitmap of possible privileges to check for |
0 | ok |
1 | error |
bool check_some_routine_access | ( | THD * | thd, |
const char * | db, | ||
const char * | name, | ||
bool | is_proc | ||
) |
Check if the routine has any of the routine privileges.
thd | Thread handler |
db | Database name |
name | Routine name |
0 | ok |
1 | error |
bool check_stack_overrun | ( | THD * | thd, |
long | margin, | ||
uchar *buf | __attribute__(unused) | ||
) |
bool check_string_byte_length | ( | LEX_STRING * | str, |
const char * | err_msg, | ||
uint | max_byte_length | ||
) |
Check that byte length of a string does not exceed some limit.
str | string to be checked |
err_msg | error message to be displayed if the string is too long |
max_length | max length |
FALSE | the passed string is not longer than max_length |
TRUE | the passed string is longer than max_length |
NOTE The function is not used in existing code but can be useful later?
bool check_table_access | ( | THD * | thd, |
ulong | requirements, | ||
TABLE_LIST * | tables, | ||
bool | any_combination_of_privileges_will_do, | ||
uint | number, | ||
bool | no_errors | ||
) |
Check if the requested privileges exists in either User-, Host- or Db-tables.
thd | Thread context |
want_access | Privileges requested |
tables | List of tables to be compared against |
no_errors | Don't report error to the client (using my_error() call). |
any_combination_of_privileges_will_do | TRUE if any privileges on any column combination is enough. |
number | Only the first 'number' tables in the linked list are relevant. |
The suppled table list contains cached privileges. This functions calls the help functions check_access and check_grant to verify the first three steps in the privileges check queue: 1. Global privileges 2. OR (db privileges AND host privileges) 3. OR table privileges 4. OR column privileges (not checked by this function!) 5. OR routine privileges (not checked by this function!)
FALSE | OK |
TRUE | Access denied; But column or routine privileges might need to be checked also. |
void cleanup_items | ( | Item * | item | ) |
This works because items are allocated with sql_alloc().
LEX_USER* create_default_definer | ( | THD * | thd | ) |
Create default definer for the specified THD.
[in] | thd | thread handler |
LEX_USER* create_definer | ( | THD * | thd, |
LEX_STRING * | user_name, | ||
LEX_STRING * | host_name | ||
) |
Create definer with the given user and host names.
[in] | thd | thread handler |
[in] | user_name | user name |
[in] | host_name | host name |
void create_select_for_variable | ( | 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 |
bool create_table_precheck | ( | THD * | thd, |
TABLE_LIST * | tables, | ||
TABLE_LIST * | create_table | ||
) |
CREATE TABLE query pre-check.
thd | Thread handler |
tables | Global table list |
create_table | Table which will be created |
FALSE | OK |
TRUE | Error |
void create_table_set_open_action_and_adjust_tables | ( | LEX * | lex | ) |
Set proper open mode and table type for element representing target table of CREATE TABLE statement, also adjust statement table list if necessary.
bool delete_precheck | ( | THD * | thd, |
TABLE_LIST * | tables | ||
) |
simple DELETE query pre-check.
thd | Thread handler |
tables | Global table list |
FALSE | OK |
TRUE | error |
bool dispatch_command | ( | enum enum_server_command | command, |
THD * | thd, | ||
char * | packet, | ||
uint | packet_length | ||
) |
Perform one connection-level (COM_XXXX) command.
command | type of command to perform |
thd | 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 thd->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 |
Clear the set of flags that are expected to be cleared at the beginning of each command.
Enforce password expiration for all RPC commands, except the following:
COM_QUERY does a more fine-grained check later. COM_STMT_CLOSE and COM_STMT_SEND_LONG_DATA don't return anything. COM_PING only discloses information that the server is running, and that's available through other means. COM_QUIT should work even for expired statements.
bool do_command | ( | THD * | thd | ) |
Read one command from connection and execute it (query or simple command). This function is called in loop from thread function.
For profiling to work, it must never be called recursively.
0 | success |
1 | request of thread shutdown (see dispatch_command() description) |
LEX_USER* get_current_user | ( | THD * | thd, |
LEX_USER * | user | ||
) |
Retuns information about user or current user.
[in] | thd | thread handler |
[in] | user | user |
void get_default_definer | ( | THD * | thd, |
LEX_USER * | definer | ||
) |
Set the specified definer to the default value, which is the current user in the thread.
[in] | thd | thread handler |
[out] | definer | definer |
pthread_handler_t handle_bootstrap | ( | void * | arg | ) |
Execute commands from bootstrap_file.
Used when creating the initial grant tables.
bool insert_precheck | ( | THD * | thd, |
TABLE_LIST * | tables | ||
) |
simple INSERT query pre-check.
thd | Thread handler |
tables | Global table list |
FALSE | OK |
TRUE | error |
bool is_log_table_write_query | ( | enum enum_sql_command | command | ) |
Check if a sql command is allowed to write to log tables.
command | The SQL command |
uint kill_one_thread | ( | THD * | thd, |
ulong | id, | ||
bool | only_kill_query | ||
) |
kill on thread.
thd | Thread class |
id | Thread id |
only_kill_query | Should it kill the query or the connection |
bool log_slow_applicable | ( | THD * | thd | ) |
Check whether we need to write the current statement (or its rewritten version if it exists) to the slow query log. As a side-effect, a digest of suppressed statements may be written.
thd | thread handle |
true | statement needs to be logged |
false | statement does not need to be logged |
void log_slow_do | ( | THD * | thd | ) |
Unconditionally the current statement (or its rewritten version if it exists) to the slow query log.
thd | thread handle |
void log_slow_statement | ( | THD * | thd | ) |
Check whether we need to write the current statement to the slow query log. If so, do so. This is a wrapper for the two functions above; most callers should use this wrapper. Only use the above functions directly if you have expensive rewriting that you only need to do if the query actually needs to be logged (e.g. SP variables / NAME_CONST substitution when executing a PROCEDURE). A digest of suppressed statements may be logged instead of the current statement.
thd | thread handle |
bool multi_delete_precheck | ( | THD * | thd, |
TABLE_LIST * | tables | ||
) |
Multi delete query pre-check.
thd | Thread handler |
tables | Global/local table list |
FALSE | OK |
TRUE | error |
bool multi_delete_set_locks_and_link_aux_tables | ( | LEX * | lex | ) |
Link tables in auxilary table list of multi-delete with corresponding elements in main table list, and set proper locks for them.
lex | pointer to LEX representing multi-delete |
FALSE | success |
TRUE | error |
bool multi_update_precheck | ( | THD * | thd, |
TABLE_LIST * | tables | ||
) |
Multi update query pre-check.
thd | Thread handler |
tables | Global/local table list (have to be the same) |
FALSE | OK |
TRUE | Error |
int mysql_execute_command | ( | THD * | thd | ) |
Execute command saved in thd and lex->sql_command.
thd | Thread handle |
: this is workaround. right way will be move invalidating in the unlock procedure.
FALSE | OK |
TRUE | Error |
NO_EMBEDDED_ACCESS_CHECKS
void mysql_init_select | ( | LEX * | lex | ) |
Resets the lex->current_select object.
This function is a wrapper around select_lex->init_select() with an added check for the special situation when using INTO OUTFILE and LOAD DATA.
bool mysql_new_select | ( | LEX * | lex, |
bool | move_down | ||
) |
Used to allocate a new SELECT_LEX object on the current thd mem_root and link it into the relevant lists.
This function is always followed by mysql_init_select.
TRUE | An error occurred |
FALSE | The new SELECT_LEX was successfully allocated. |
void mysql_parse | ( | THD * | thd, |
char * | rawbuf, | ||
uint | length, | ||
Parser_state * | parser_state | ||
) |
Parse a query.
thd | Current thread | |
rawbuf | Begining of the query text | |
length | Length of the query text | |
[out] | found_semicolon | For multi queries, position of the character of the next query in the query text. |
void mysql_reset_thd_for_next_command | ( | THD * | thd | ) |
Reset the part of THD responsible for the state of command processing.
This needs to be called before execution of every statement (prepared or conventional). It is not called by substatements of routines.
Item* negate_expression | ( | THD * | thd, |
Item * | expr | ||
) |
negate given expression.
thd | thread handler |
expr | expression for negation |
bool parse_sql | ( | THD * | thd, |
Parser_state * | parser_state, | ||
Object_creation_ctx * | creation_ctx | ||
) |
This is a wrapper of MYSQLparse(). All the code should call parse_sql() instead of MYSQLparse().
thd | Thread context. |
parser_state | Parser state. |
creation_ctx | Object creation context. |
FALSE | on success. |
TRUE | on parsing error. |
int prepare_schema_table | ( | THD * | thd, |
LEX * | lex, | ||
Table_ident * | table_ident, | ||
enum enum_schema_tables | schema_table_idx | ||
) |
Create a TABLE_LIST 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 TABLE_LIST object to represent the given command as a SELECT parse tree.
thd | thread handle |
lex | current lex |
table_ident | table alias if it's used |
schema_table_idx | the type 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. |
bool select_precheck | ( | THD * | thd, |
LEX * | lex, | ||
TABLE_LIST * | tables, | ||
TABLE_LIST * | first_table | ||
) |
Perform first stage of privilege checking for SELECT statement.
thd | Thread context. |
lex | LEX for SELECT statement. |
tables | List of tables used by statement. |
first_table | First table in the main SELECT of the SELECT statement. |
FALSE | - Success (column-level privilege checks might be required). |
TRUE | - Failure, privileges are insufficient. |
void store_position_for_column | ( | const char * | name | ) |
Store position for column in ALTER TABLE .. ADD column.
bool update_precheck | ( | THD * | thd, |
TABLE_LIST * | tables | ||
) |
simple UPDATE query pre-check.
thd | Thread handler |
tables | Global table list |
FALSE | OK |
TRUE | Error |
uint 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
const char* xa_state_names[] |
{ "NON-EXISTING", "ACTIVE", "IDLE", "PREPARED", "ROLLBACK ONLY" }