Commit 9b532768 authored by ramil@poseidon.ndb.mysql.com's avatar ramil@poseidon.ndb.mysql.com

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new
parents c1038ded 63a497a1
...@@ -120,7 +120,6 @@ static KEY_CACHE *create_key_cache(const char *name, uint length); ...@@ -120,7 +120,6 @@ static KEY_CACHE *create_key_cache(const char *name, uint length);
void fix_sql_mode_var(THD *thd, enum_var_type type); void fix_sql_mode_var(THD *thd, enum_var_type type);
static byte *get_error_count(THD *thd); static byte *get_error_count(THD *thd);
static byte *get_warning_count(THD *thd); static byte *get_warning_count(THD *thd);
static byte *get_have_innodb(THD *thd);
/* /*
Variable definition list Variable definition list
...@@ -129,6 +128,9 @@ static byte *get_have_innodb(THD *thd); ...@@ -129,6 +128,9 @@ static byte *get_have_innodb(THD *thd);
alphabetic order alphabetic order
*/ */
sys_var *sys_var::first= NULL;
uint sys_var::sys_vars= 0;
sys_var_thd_ulong sys_auto_increment_increment("auto_increment_increment", sys_var_thd_ulong sys_auto_increment_increment("auto_increment_increment",
&SV::auto_increment_increment); &SV::auto_increment_increment);
sys_var_thd_ulong sys_auto_increment_offset("auto_increment_offset", sys_var_thd_ulong sys_auto_increment_offset("auto_increment_offset",
...@@ -552,203 +554,33 @@ sys_var_thd_time_zone sys_time_zone("time_zone"); ...@@ -552,203 +554,33 @@ sys_var_thd_time_zone sys_time_zone("time_zone");
/* Read only variables */ /* Read only variables */
sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE); sys_var_const_str sys_os("version_compile_os", SYSTEM_TYPE);
sys_var_readonly sys_have_innodb("have_innodb", OPT_GLOBAL,
SHOW_CHAR, get_have_innodb);
/* Global read-only variable describing server license */
sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
/* sys_var_have_variable sys_have_archive_db("have_archive", &have_archive_db);
List of all variables for initialisation and storage in hash sys_var_have_variable sys_have_berkeley_db("have_bdb", &have_berkeley_db);
This is sorted in alphabetical order to make it easy to add new variables sys_var_have_variable sys_have_blackhole_db("have_blackhole_engine",
&have_blackhole_db);
If the variable is not in this list, it can't be changed with sys_var_have_variable sys_have_compress("have_compress", &have_compress);
SET variable_name= sys_var_have_variable sys_have_crypt("have_crypt", &have_crypt);
*/ sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db);
sys_var_have_variable sys_have_example_db("have_example_engine",
&have_example_db);
sys_var_have_variable sys_have_federated_db("have_federated_engine",
&have_federated_db);
sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry);
sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb);
sys_var_have_variable sys_have_isam("have_isam", &have_isam);
sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster);
sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl);
sys_var_have_variable sys_have_partition_db("have_partition_engine",
&have_partition_db);
sys_var_have_variable sys_have_query_cache("have_query_cache",
&have_query_cache);
sys_var_have_variable sys_have_raid("have_raid", &have_raid);
sys_var_have_variable sys_have_rtree_keys("have_rtree_keys", &have_rtree_keys);
sys_var_have_variable sys_have_symlink("have_symlink", &have_symlink);
sys_var *sys_variables[]= /* Global read-only variable describing server license */
{ sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
&sys_auto_is_null,
&sys_auto_increment_increment,
&sys_auto_increment_offset,
&sys_autocommit,
&sys_automatic_sp_privileges,
&sys_big_tables,
&sys_big_selects,
&sys_binlog_cache_size,
&sys_buffer_results,
&sys_bulk_insert_buff_size,
&sys_character_set_server,
&sys_character_set_database,
&sys_character_set_client,
&sys_character_set_connection,
&sys_character_set_results,
&sys_charset_system,
&sys_collation_connection,
&sys_collation_database,
&sys_collation_server,
&sys_completion_type,
&sys_concurrent_insert,
&sys_connect_timeout,
&sys_date_format,
&sys_datetime_format,
&sys_div_precincrement,
&sys_default_week_format,
&sys_delay_key_write,
&sys_delayed_insert_limit,
&sys_delayed_insert_timeout,
&sys_delayed_queue_size,
&sys_error_count,
&sys_expire_logs_days,
&sys_flush,
&sys_flush_time,
&sys_ft_boolean_syntax,
&sys_foreign_key_checks,
&sys_group_concat_max_len,
&sys_have_innodb,
&sys_identity,
&sys_init_connect,
&sys_init_slave,
&sys_insert_id,
&sys_interactive_timeout,
&sys_join_buffer_size,
&sys_key_buffer_size,
&sys_key_cache_block_size,
&sys_key_cache_division_limit,
&sys_key_cache_age_threshold,
&sys_last_insert_id,
&sys_license,
&sys_local_infile,
&sys_log_binlog,
&sys_log_off,
&sys_log_update,
&sys_log_warnings,
&sys_long_query_time,
&sys_low_priority_updates,
&sys_max_allowed_packet,
&sys_max_binlog_cache_size,
&sys_max_binlog_size,
&sys_max_connect_errors,
&sys_max_connections,
&sys_max_delayed_threads,
&sys_max_error_count,
&sys_max_insert_delayed_threads,
&sys_max_heap_table_size,
&sys_max_join_size,
&sys_max_length_for_sort_data,
&sys_max_relay_log_size,
&sys_max_seeks_for_key,
&sys_max_sort_length,
&sys_max_tmp_tables,
&sys_max_user_connections,
&sys_max_write_lock_count,
&sys_multi_range_count,
&sys_myisam_data_pointer_size,
&sys_myisam_max_sort_file_size,
&sys_myisam_repair_threads,
&sys_myisam_sort_buffer_size,
&sys_myisam_stats_method,
&sys_net_buffer_length,
&sys_net_read_timeout,
&sys_net_retry_count,
&sys_net_wait_timeout,
&sys_net_write_timeout,
&sys_new_mode,
&sys_old_alter_table,
&sys_old_passwords,
&sys_optimizer_prune_level,
&sys_optimizer_search_depth,
&sys_preload_buff_size,
&sys_pseudo_thread_id,
&sys_query_alloc_block_size,
&sys_query_cache_size,
&sys_query_prealloc_size,
#ifdef HAVE_QUERY_CACHE
&sys_query_cache_limit,
&sys_query_cache_min_res_unit,
&sys_query_cache_type,
&sys_query_cache_wlock_invalidate,
#endif /* HAVE_QUERY_CACHE */
&sys_quote_show_create,
&sys_rand_seed1,
&sys_rand_seed2,
&sys_range_alloc_block_size,
&sys_readonly,
&sys_read_buff_size,
&sys_read_rnd_buff_size,
#ifdef HAVE_REPLICATION
&sys_relay_log_purge,
#endif
&sys_rpl_recovery_rank,
&sys_safe_updates,
&sys_secure_auth,
&sys_select_limit,
&sys_server_id,
#ifdef HAVE_REPLICATION
&sys_slave_compressed_protocol,
&sys_slave_net_timeout,
&sys_slave_trans_retries,
&sys_slave_skip_counter,
#endif
&sys_slow_launch_time,
&sys_sort_buffer,
&sys_sql_big_tables,
&sys_sql_low_priority_updates,
&sys_sql_max_join_size,
&sys_sql_mode,
&sys_sql_warnings,
&sys_sql_notes,
&sys_storage_engine,
#ifdef HAVE_REPLICATION
&sys_sync_binlog_period,
&sys_sync_replication,
&sys_sync_replication_slave_id,
&sys_sync_replication_timeout,
#endif
&sys_sync_frm,
&sys_table_cache_size,
&sys_table_lock_wait_timeout,
&sys_table_type,
&sys_thread_cache_size,
&sys_time_format,
&sys_timed_mutexes,
&sys_timestamp,
&sys_time_zone,
&sys_tmp_table_size,
&sys_trans_alloc_block_size,
&sys_trans_prealloc_size,
&sys_tx_isolation,
&sys_os,
#ifdef HAVE_INNOBASE_DB
&sys_innodb_fast_shutdown,
&sys_innodb_max_dirty_pages_pct,
&sys_innodb_max_purge_lag,
&sys_innodb_table_locks,
&sys_innodb_support_xa,
&sys_innodb_max_purge_lag,
&sys_innodb_autoextend_increment,
&sys_innodb_sync_spin_loops,
&sys_innodb_concurrency_tickets,
&sys_innodb_thread_sleep_delay,
&sys_innodb_thread_concurrency,
&sys_innodb_commit_concurrency,
#endif
&sys_trust_routine_creators,
&sys_engine_condition_pushdown,
#ifdef HAVE_NDBCLUSTER_DB
&sys_ndb_autoincrement_prefetch_sz,
&sys_ndb_cache_check_time,
&sys_ndb_force_send,
&sys_ndb_use_exact_count,
&sys_ndb_use_transactions,
&sys_ndb_index_stat_enable,
&sys_ndb_index_stat_cache_entries,
&sys_ndb_index_stat_update_freq,
#endif
&sys_unique_checks,
&sys_updatable_views_with_limit,
&sys_warning_count
};
/* /*
...@@ -805,24 +637,24 @@ struct show_var_st init_vars[]= { ...@@ -805,24 +637,24 @@ struct show_var_st init_vars[]= {
{"ft_query_expansion_limit",(char*) &ft_query_expansion_limit, SHOW_LONG}, {"ft_query_expansion_limit",(char*) &ft_query_expansion_limit, SHOW_LONG},
{"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR}, {"ft_stopword_file", (char*) &ft_stopword_file, SHOW_CHAR_PTR},
{sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS}, {sys_group_concat_max_len.name, (char*) &sys_group_concat_max_len, SHOW_SYS},
{"have_archive", (char*) &have_archive_db, SHOW_HAVE}, {sys_have_archive_db.name, (char*) &have_archive_db, SHOW_HAVE},
{"have_bdb", (char*) &have_berkeley_db, SHOW_HAVE}, {sys_have_berkeley_db.name, (char*) &have_berkeley_db, SHOW_HAVE},
{"have_blackhole_engine", (char*) &have_blackhole_db, SHOW_HAVE}, {sys_have_blackhole_db.name,(char*) &have_blackhole_db, SHOW_HAVE},
{"have_compress", (char*) &have_compress, SHOW_HAVE}, {sys_have_compress.name, (char*) &have_compress, SHOW_HAVE},
{"have_crypt", (char*) &have_crypt, SHOW_HAVE}, {sys_have_crypt.name, (char*) &have_crypt, SHOW_HAVE},
{"have_csv", (char*) &have_csv_db, SHOW_HAVE}, {sys_have_csv_db.name, (char*) &have_csv_db, SHOW_HAVE},
{"have_example_engine", (char*) &have_example_db, SHOW_HAVE}, {sys_have_example_db.name, (char*) &have_example_db, SHOW_HAVE},
{"have_federated_engine", (char*) &have_federated_db, SHOW_HAVE}, {sys_have_federated_db.name,(char*) &have_federated_db, SHOW_HAVE},
{"have_geometry", (char*) &have_geometry, SHOW_HAVE}, {sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE},
{"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE},
{"have_isam", (char*) &have_isam, SHOW_HAVE}, {sys_have_isam.name, (char*) &have_isam, SHOW_HAVE},
{"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE}, {sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE},
{"have_openssl", (char*) &have_openssl, SHOW_HAVE}, {sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE},
{"have_partition_engine", (char*) &have_partition_db, SHOW_HAVE}, {sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE}, {sys_have_query_cache.name, (char*) &have_query_cache, SHOW_HAVE},
{"have_raid", (char*) &have_raid, SHOW_HAVE}, {sys_have_raid.name, (char*) &have_raid, SHOW_HAVE},
{"have_rtree_keys", (char*) &have_rtree_keys, SHOW_HAVE}, {sys_have_rtree_keys.name, (char*) &have_rtree_keys, SHOW_HAVE},
{"have_symlink", (char*) &have_symlink, SHOW_HAVE}, {sys_have_symlink.name, (char*) &have_symlink, SHOW_HAVE},
{"init_connect", (char*) &sys_init_connect, SHOW_SYS}, {"init_connect", (char*) &sys_init_connect, SHOW_SYS},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
{"init_slave", (char*) &sys_init_slave, SHOW_SYS}, {"init_slave", (char*) &sys_init_slave, SHOW_SYS},
...@@ -2794,12 +2626,6 @@ static byte *get_error_count(THD *thd) ...@@ -2794,12 +2626,6 @@ static byte *get_error_count(THD *thd)
} }
static byte *get_have_innodb(THD *thd)
{
return (byte*) show_comp_option_name[have_innodb];
}
/**************************************************************************** /****************************************************************************
Main handling of variables: Main handling of variables:
- Initialisation - Initialisation
...@@ -2858,17 +2684,15 @@ static byte *get_sys_var_length(const sys_var *var, uint *length, ...@@ -2858,17 +2684,15 @@ static byte *get_sys_var_length(const sys_var *var, uint *length,
void set_var_init() void set_var_init()
{ {
hash_init(&system_variable_hash, system_charset_info, sys_var *var;
array_elements(sys_variables),0,0,
(hash_get_key) get_sys_var_length,0,0); hash_init(&system_variable_hash, system_charset_info, sys_var::sys_vars, 0,
sys_var **var, **end; 0, (hash_get_key) get_sys_var_length, 0, 0);
for (var= sys_variables, end= sys_variables+array_elements(sys_variables) ; for (var= sys_var::first; var; var= var->next)
var < end; {
var++) var->name_length= strlen(var->name);
{ var->option_limits= find_option(my_long_options, var->name);
(*var)->name_length= strlen((*var)->name); my_hash_insert(&system_variable_hash, (byte*) var);
(*var)->option_limits= find_option(my_long_options, (*var)->name);
my_hash_insert(&system_variable_hash, (byte*) *var);
} }
/* /*
Special cases Special cases
......
...@@ -39,6 +39,9 @@ typedef byte *(*sys_value_ptr_func)(THD *thd); ...@@ -39,6 +39,9 @@ typedef byte *(*sys_value_ptr_func)(THD *thd);
class sys_var class sys_var
{ {
public: public:
static sys_var *first;
static uint sys_vars;
sys_var *next;
struct my_option *option_limits; /* Updated by by set_var_init() */ struct my_option *option_limits; /* Updated by by set_var_init() */
uint name_length; /* Updated by by set_var_init() */ uint name_length; /* Updated by by set_var_init() */
const char *name; const char *name;
...@@ -48,12 +51,18 @@ class sys_var ...@@ -48,12 +51,18 @@ class sys_var
sys_var(const char *name_arg) sys_var(const char *name_arg)
:name(name_arg), after_update(0) :name(name_arg), after_update(0)
, no_support_one_shot(1) , no_support_one_shot(1)
{} { add_sys_var(); }
sys_var(const char *name_arg,sys_after_update_func func) sys_var(const char *name_arg,sys_after_update_func func)
:name(name_arg), after_update(func) :name(name_arg), after_update(func)
, no_support_one_shot(1) , no_support_one_shot(1)
{} { add_sys_var(); }
virtual ~sys_var() {} virtual ~sys_var() {}
void add_sys_var()
{
next= first;
first= this;
sys_vars++;
}
virtual bool check(THD *thd, set_var *var); virtual bool check(THD *thd, set_var *var);
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names); bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names); bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
...@@ -701,6 +710,30 @@ class sys_var_readonly: public sys_var ...@@ -701,6 +710,30 @@ class sys_var_readonly: public sys_var
bool is_readonly() const { return 1; } bool is_readonly() const { return 1; }
}; };
class sys_var_have_variable: public sys_var
{
SHOW_COMP_OPTION *have_variable;
public:
sys_var_have_variable(const char *variable_name,
SHOW_COMP_OPTION *have_variable_arg):
sys_var(variable_name),
have_variable(have_variable_arg)
{ }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
{
return (byte*) show_comp_option_name[*have_variable];
}
bool update(THD *thd, set_var *var) { return 1; }
bool check_default(enum_var_type type) { return 1; }
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
bool check_update_type(Item_result type) { return 1; }
SHOW_TYPE type() { return SHOW_CHAR; }
bool is_readonly() const { return 1; }
};
class sys_var_thd_time_zone :public sys_var_thd class sys_var_thd_time_zone :public sys_var_thd
{ {
public: public:
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
We are using pointer to this variable for distinguishing between assignment We are using pointer to this variable for distinguishing between assignment
to NEW row field (when parsing trigger definition) and structured variable. to NEW row field (when parsing trigger definition) and structured variable.
*/ */
sys_var_long_ptr trg_new_row_fake_var(0, 0);
sys_var *trg_new_row_fake_var= (sys_var*) 0x01;
/* Macros to look like lex */ /* Macros to look like lex */
......
...@@ -702,7 +702,7 @@ struct st_trg_chistics ...@@ -702,7 +702,7 @@ struct st_trg_chistics
enum trg_event_type event; enum trg_event_type event;
}; };
extern sys_var_long_ptr trg_new_row_fake_var; extern sys_var *trg_new_row_fake_var;
enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE,
XA_SUSPEND, XA_FOR_MIGRATE}; XA_SUSPEND, XA_FOR_MIGRATE};
......
...@@ -8529,7 +8529,7 @@ sys_option_value: ...@@ -8529,7 +8529,7 @@ sys_option_value:
{ {
LEX *lex=Lex; LEX *lex=Lex;
if ($2.var == &trg_new_row_fake_var) if ($2.var == trg_new_row_fake_var)
{ {
/* We are in trigger and assigning value to field of new row */ /* We are in trigger and assigning value to field of new row */
Item *it; Item *it;
...@@ -8750,7 +8750,7 @@ internal_variable_name: ...@@ -8750,7 +8750,7 @@ internal_variable_name:
YYABORT; YYABORT;
} }
/* This special combination will denote field of NEW row */ /* This special combination will denote field of NEW row */
$$.var= &trg_new_row_fake_var; $$.var= trg_new_row_fake_var;
$$.base_name= $3; $$.base_name= $3;
} }
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment