mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge 5.2->5.3
- Re-commit Monty's merge, partially fixed by Igor and SergeyP, but still broken
This commit is contained in:
121
sql/sql_class.h
121
sql/sql_class.h
@ -156,9 +156,10 @@ enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
|
||||
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
|
||||
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
|
||||
DELAY_KEY_WRITE_ALL };
|
||||
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
|
||||
SLAVE_EXEC_MODE_IDEMPOTENT,
|
||||
SLAVE_EXEC_MODE_LAST_BIT};
|
||||
|
||||
#define SLAVE_EXEC_MODE_STRICT (1U << 0)
|
||||
#define SLAVE_EXEC_MODE_IDEMPOTENT (1U << 1)
|
||||
|
||||
enum enum_mark_columns
|
||||
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
|
||||
|
||||
@ -365,6 +366,9 @@ struct system_variables
|
||||
When attempting to access a dynamic variable, if the session version
|
||||
is out of date, then the session version is updated and realloced if
|
||||
neccessary and bytes copied from global to make up for missing data.
|
||||
|
||||
Note that one should use my_bool instead of bool here, as the variables
|
||||
are used with my_getopt.c
|
||||
*/
|
||||
ulong dynamic_variables_version;
|
||||
char* dynamic_variables_ptr;
|
||||
@ -500,7 +504,11 @@ struct system_variables
|
||||
};
|
||||
|
||||
|
||||
/* per thread status variables */
|
||||
/**
|
||||
Per thread status variables.
|
||||
Must be long/ulong up to last_system_status_var so that
|
||||
add_to_status/add_diff_to_status can work.
|
||||
*/
|
||||
|
||||
typedef struct system_status_var
|
||||
{
|
||||
@ -568,17 +576,15 @@ typedef struct system_status_var
|
||||
Number of statements sent from the client
|
||||
*/
|
||||
ulong questions;
|
||||
ulong empty_queries;
|
||||
ulong access_denied_errors; /* Can only be 0 or 1 */
|
||||
ulong lost_connections;
|
||||
/*
|
||||
IMPORTANT!
|
||||
SEE last_system_status_var DEFINITION BELOW.
|
||||
Below 'last_system_status_var' are all variables which doesn't make any
|
||||
sense to add to the /global/ status variable counter.
|
||||
Status variables which it does not make sense to add to
|
||||
global status variable counter
|
||||
Below 'last_system_status_var' are all variables that cannot be handled
|
||||
automatically by add_to_status()/add_diff_to_status().
|
||||
*/
|
||||
ulong empty_queries;
|
||||
ulong access_denied_errors; /* Can only be 0 or 1 */
|
||||
ulong lost_connections;
|
||||
ulonglong bytes_received;
|
||||
ulonglong bytes_sent;
|
||||
ulonglong binlog_bytes_written;
|
||||
@ -1842,8 +1848,15 @@ public:
|
||||
*/
|
||||
ha_rows sent_row_count;
|
||||
|
||||
/*
|
||||
number of rows we read, sent or not, including in create_sort_index()
|
||||
/**
|
||||
Number of rows read and/or evaluated for a statement. Used for
|
||||
slow log reporting.
|
||||
|
||||
An examined row is defined as a row that is read and/or evaluated
|
||||
according to a statement condition, including in
|
||||
create_sort_index(). Rows may be counted more than once, e.g., a
|
||||
statement including ORDER BY could possibly evaluate the row in
|
||||
filesort() before reading it for e.g. update.
|
||||
*/
|
||||
ha_rows examined_row_count;
|
||||
|
||||
@ -1977,7 +1990,7 @@ public:
|
||||
bool no_warnings_for_error; /* no warnings on call to my_error() */
|
||||
/* set during loop of derived table processing */
|
||||
bool derived_tables_processing;
|
||||
my_bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */
|
||||
bool tablespace_op; /* This is TRUE in DISCARD/IMPORT TABLESPACE */
|
||||
|
||||
sp_rcontext *spcont; // SP runtime context
|
||||
sp_cache *sp_proc_cache;
|
||||
@ -2170,6 +2183,11 @@ public:
|
||||
start_time= user_time= t;
|
||||
start_utime= utime_after_lock= my_micro_time();
|
||||
}
|
||||
/*TODO: this will be obsolete when we have support for 64 bit my_time_t */
|
||||
inline bool is_valid_time()
|
||||
{
|
||||
return (start_time < (time_t) MY_TIME_T_MAX);
|
||||
}
|
||||
void set_time_after_lock() { utime_after_lock= my_micro_time(); }
|
||||
ulonglong current_utime() { return my_micro_time(); }
|
||||
inline ulonglong found_rows(void)
|
||||
@ -2476,6 +2494,39 @@ public:
|
||||
Protected with LOCK_thd_data mutex.
|
||||
*/
|
||||
void set_query(char *query_arg, uint32 query_length_arg);
|
||||
void set_current_user_used() { current_user_used= TRUE; }
|
||||
bool is_current_user_used() { return current_user_used; }
|
||||
void clean_current_user_used() { current_user_used= FALSE; }
|
||||
void get_definer(LEX_USER *definer);
|
||||
void set_invoker(const LEX_STRING *user, const LEX_STRING *host)
|
||||
{
|
||||
invoker_user= *user;
|
||||
invoker_host= *host;
|
||||
}
|
||||
LEX_STRING get_invoker_user() { return invoker_user; }
|
||||
LEX_STRING get_invoker_host() { return invoker_host; }
|
||||
bool has_invoker() { return invoker_user.length > 0; }
|
||||
|
||||
private:
|
||||
/*
|
||||
This reference points to the table arena when the expression
|
||||
for a virtual column is being evaluated
|
||||
*/
|
||||
Query_arena *arena_for_cached_items;
|
||||
|
||||
public:
|
||||
void reset_arena_for_cached_items(Query_arena *new_arena)
|
||||
{
|
||||
arena_for_cached_items= new_arena;
|
||||
}
|
||||
Query_arena *switch_to_arena_for_cached_items(Query_arena *backup)
|
||||
{
|
||||
if (!arena_for_cached_items)
|
||||
return 0;
|
||||
set_n_backup_active_arena(arena_for_cached_items, backup);
|
||||
return backup;
|
||||
}
|
||||
|
||||
private:
|
||||
/** The current internal error handler for this thread, or NULL. */
|
||||
Internal_error_handler *m_internal_handler;
|
||||
@ -2495,6 +2546,25 @@ private:
|
||||
tree itself is reused between executions and thus is stored elsewhere.
|
||||
*/
|
||||
MEM_ROOT main_mem_root;
|
||||
|
||||
/**
|
||||
It will be set TURE if CURRENT_USER() is called in account management
|
||||
statements or default definer is set in CREATE/ALTER SP, SF, Event,
|
||||
TRIGGER or VIEW statements.
|
||||
|
||||
Current user will be binlogged into Query_log_event if current_user_used
|
||||
is TRUE; It will be stored into invoker_host and invoker_user by SQL thread.
|
||||
*/
|
||||
bool current_user_used;
|
||||
|
||||
/**
|
||||
It points to the invoker in the Query_log_event.
|
||||
SQL thread use it as the default definer in CREATE/ALTER SP, SF, Event,
|
||||
TRIGGER or VIEW statements or current user in account management
|
||||
statements if it is not NULL.
|
||||
*/
|
||||
LEX_STRING invoker_user;
|
||||
LEX_STRING invoker_host;
|
||||
};
|
||||
|
||||
/** A short cut for thd->main_da.set_ok_status(). */
|
||||
@ -2553,7 +2623,7 @@ class select_result :public Sql_alloc {
|
||||
protected:
|
||||
THD *thd;
|
||||
SELECT_LEX_UNIT *unit;
|
||||
uint nest_level;
|
||||
int nest_level;
|
||||
public:
|
||||
select_result();
|
||||
virtual ~select_result() {};
|
||||
@ -2694,7 +2764,7 @@ public:
|
||||
Creates a select_export to represent INTO OUTFILE <filename> with a
|
||||
defined level of subquery nesting.
|
||||
*/
|
||||
select_export(sql_exchange *ex, uint nest_level_arg) :select_to_file(ex)
|
||||
select_export(sql_exchange *ex, int nest_level_arg) :select_to_file(ex)
|
||||
{
|
||||
nest_level= nest_level_arg;
|
||||
}
|
||||
@ -2711,7 +2781,7 @@ public:
|
||||
Creates a select_export to represent INTO DUMPFILE <filename> with a
|
||||
defined level of subquery nesting.
|
||||
*/
|
||||
select_dump(sql_exchange *ex, uint nest_level_arg) :
|
||||
select_dump(sql_exchange *ex, int nest_level_arg) :
|
||||
select_to_file(ex)
|
||||
{
|
||||
nest_level= nest_level_arg;
|
||||
@ -2787,7 +2857,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
|
||||
#if defined(WITH_ARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES)
|
||||
#include <maria.h>
|
||||
#define ENGINE_COLUMNDEF MARIA_COLUMNDEF
|
||||
#else
|
||||
@ -3162,10 +3232,10 @@ class user_var_entry
|
||||
Item_result type;
|
||||
bool unsigned_flag;
|
||||
|
||||
double val_real(my_bool *null_value);
|
||||
longlong val_int(my_bool *null_value) const;
|
||||
String *val_str(my_bool *null_value, String *str, uint decimals);
|
||||
my_decimal *val_decimal(my_bool *null_value, my_decimal *result);
|
||||
double val_real(bool *null_value);
|
||||
longlong val_int(bool *null_value) const;
|
||||
String *val_str(bool *null_value, String *str, uint decimals);
|
||||
my_decimal *val_decimal(bool *null_value, my_decimal *result);
|
||||
DTCollation collation;
|
||||
};
|
||||
|
||||
@ -3210,13 +3280,16 @@ public:
|
||||
ulonglong max_in_memory_size)
|
||||
{
|
||||
register ulonglong max_elems_in_tree=
|
||||
(1 + max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
|
||||
max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size);
|
||||
return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
|
||||
}
|
||||
|
||||
void reset();
|
||||
bool walk(tree_walk_action action, void *walk_action_arg);
|
||||
|
||||
uint get_size() const { return size; }
|
||||
ulonglong get_max_in_memory_size() const { return max_in_memory_size; }
|
||||
|
||||
friend int unique_write_to_file(uchar* key, element_count count, Unique *unique);
|
||||
friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique);
|
||||
};
|
||||
@ -3325,7 +3398,7 @@ public:
|
||||
Creates a select_dumpvar to represent INTO <variable> with a defined
|
||||
level of subquery nesting.
|
||||
*/
|
||||
select_dumpvar(uint nest_level_arg)
|
||||
select_dumpvar(int nest_level_arg)
|
||||
{
|
||||
var_list.empty();
|
||||
row_count= 0;
|
||||
|
Reference in New Issue
Block a user