summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-12-20 14:58:27 +0200
committerunknown <monty@mashka.mysql.fi>2002-12-20 14:58:27 +0200
commit791e9fb37ea10f3e91e56e15c869906d90313c06 (patch)
tree1cf172e757bfa6aca7ae5af20ed7b0c727016120
parent172d5acb6d2fc29517a70e069ae89ea67951555c (diff)
downloadmariadb-git-791e9fb37ea10f3e91e56e15c869906d90313c06.tar.gz
Changed thd variables max_join_size and select_limit to type ha_rows.
This fixed some optimization problems when using -DBIG_TABLES Portabilty fixes for OpenUnix and HPUX Added C and C++ version numbers to mysqlbug Docs/mysqld_error.txt: Added new error message acinclude.m4: Fix for configure problem on OpenUnix configure.in: Fix for OpenUnix Added C and C++ versions to mysqlbug mysql-test/r/variables.result: Update of max_join_size handling mysql-test/t/variables.test: Update of max_join_size handling mysys/Makefile.am: Removed duplicate row mysys/my_alloc.c: Safety fixes (not fatal) scripts/Makefile.am: Added C and C++ compiler versions to mysqlbug scripts/mysqlbug.sh: Added C and C++ compiler versions to mysqlbug sql/item_func.cc: Fixed that user variables that changes are not threated as constants. sql/item_func.h: Fixed that user variables that changes are not threated as constants. sql/mysqld.cc: Changed thd variables max_join_size and select_limit to type ha_rows sql/repl_failsafe.cc: Removed not needed cast sql/set_var.cc: Changed thd variables max_join_size and select_limit to type ha_rows sql/set_var.h: Changed thd variables max_join_size and select_limit to type ha_rows sql/slave.cc: Removed not needed cast sql/sql_class.h: Changed thd variables max_join_size and select_limit to type ha_rows sql/sql_parse.cc: Removed not needed cast Fixed security problem with mysql_drop_db() sql/sql_show.cc: Changed thd variables max_join_size and select_limit to type ha_rows sql/structs.h: Changed thd variables max_join_size and select_limit to type ha_rows
-rw-r--r--Docs/mysqld_error.txt26
-rw-r--r--acinclude.m49
-rw-r--r--configure.in8
-rw-r--r--mysql-test/r/variables.result4
-rw-r--r--mysql-test/t/variables.test3
-rw-r--r--mysys/Makefile.am1
-rw-r--r--mysys/my_alloc.c4
-rw-r--r--scripts/Makefile.am2
-rw-r--r--scripts/mysqlbug.sh2
-rw-r--r--sql/item_func.cc7
-rw-r--r--sql/item_func.h7
-rw-r--r--sql/mysqld.cc16
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/set_var.cc69
-rw-r--r--sql/set_var.h18
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_parse.cc6
-rw-r--r--sql/sql_show.cc3
-rw-r--r--sql/structs.h2
20 files changed, 157 insertions, 38 deletions
diff --git a/Docs/mysqld_error.txt b/Docs/mysqld_error.txt
index db663e3d1f5..aeb3a12c263 100644
--- a/Docs/mysqld_error.txt
+++ b/Docs/mysqld_error.txt
@@ -300,7 +300,7 @@
#define ER_NOT_ALLOWED_COMMAND 1148
"The used command is not allowed with this MySQL version",
#define ER_SYNTAX_ERROR 1149
-"You have an error in your SQL syntax",
+"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use",
#define ER_DELAYED_CANT_CHANGE_LOCK 1150
"Delayed insert thread couldn't get requested lock for table %-.64s",
#define ER_TOO_MANY_DELAYED_THREADS 1151
@@ -358,7 +358,7 @@
#define ER_CHECK_NO_SUCH_TABLE 1177
"Can't open table",
#define ER_CHECK_NOT_IMPLEMENTED 1178
-"The handler for the table doesn't support check/repair",
+"The handler for the table doesn't support %s",
#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
"You are not allowed to execute this command in a transaction",
#define ER_ERROR_DURING_COMMIT 1180
@@ -454,4 +454,24 @@
#define ER_DUP_ARGUMENT 1225
"Option '%s' used twice in statement",
#define ER_USER_LIMIT_REACHED 1226
-"User '%-64s' has exceeded the '%s' resource (current value: %ld)",
+"User '%-.64s' has exceeded the '%s' resource (current value: %ld)",
+#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
+"Access denied. You need the %-.128s privilege for this operation",
+#define ER_LOCAL_VARIABLE 1228
+"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL",
+#define ER_GLOBAL_VARIABLE 1229
+"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL",
+#define ER_NO_DEFAULT 1230
+"Variable '%-.64s' doesn't have a default value",
+#define ER_WRONG_VALUE_FOR_VAR 1231
+"Variable '%-.64s' can't be set to the value of '%-.64s'",
+#define ER_WRONG_TYPE_FOR_VAR 1232
+"Wrong argument type to variable '%-.64s'",
+#define ER_VAR_CANT_BE_READ 1233
+"Variable '%-.64s' can only be set, not read",
+#define ER_CANT_USE_OPTION_HERE 1234
+"Wrong usage/placement of '%s'",
+#define 1235
+"This version of MySQL doesn't yet support '%s'",
+#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
+"Got fatal error %d: '%-.128s' from master when reading data from binary log",
diff --git a/acinclude.m4 b/acinclude.m4
index fda4f4bf7d5..7436b5136a5 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1211,7 +1211,9 @@ changequote(, )dnl
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
changequote([, ])dnl
if test "$GCC" = yes; then
- ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
+ case `$CC --version 2>/dev/null` in
+ 2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;;
+ esac
fi
;;
# IRIX 6.2 and later require cc -n32.
@@ -1326,7 +1328,7 @@ AC_DEFUN(MYSQL_SYS_LARGEFILE,
# Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
-# include #stdlib.h as this breaks things on Solaris
+# include #stdlib.h as default as this breaks things on Solaris
# (Conflicts with pthreads and big file handling)
m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
@@ -1336,7 +1338,8 @@ m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
- 'void exit (int);'
+ 'void exit (int);' \
+ '#include <stdlib.h>'
do
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h>
$ac_declaration],
diff --git a/configure.in b/configure.in
index 8652bb13154..82eeea20ba4 100644
--- a/configure.in
+++ b/configure.in
@@ -135,13 +135,19 @@ if test $? -eq "0"
then
AC_MSG_CHECKING("C Compiler version");
AC_MSG_RESULT("$CC $CC_VERSION")
+else
+CC_VERSION=""
fi
CXX_VERSION=`$CXX --version`
if test $? -eq "0"
then
AC_MSG_CHECKING("C++ compiler version");
AC_MSG_RESULT("$CXX $CXX_VERSION")
+else
+CXX_VERSION=""
fi
+AC_SUBST(CXX_VERSION)
+AC_SUBST(CC_VERSION)
# Fix for sgi gcc / sgiCC which tries to emulate gcc
if test "$CC" = "sgicc"
@@ -1228,7 +1234,7 @@ then
# CC="$CC -Kthread -DOpenUNIX8";
# CXX="$CXX -Kthread -DOpenUNIX8";
CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
- CXX="$CXX -Kthread -DUNIXWARE_7";
+ CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
fi
AC_MSG_RESULT("yes")
else
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index f8ac13477a9..ed477a8519b 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -50,7 +50,7 @@ Variable_name Value
max_join_size 100
show global variables like 'max_join_size';
Variable_name Value
-max_join_size 4294967295
+max_join_size HA_POS_ERROR
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
Variable_name Value
@@ -62,7 +62,7 @@ max_join_size 2000
set GLOBAL max_join_size=DEFAULT;
show global variables like 'max_join_size';
Variable_name Value
-max_join_size 4294967295
+max_join_size HA_POS_ERROR
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
@@session.max_join_size @@global.max_join_size
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index e21fbd975e6..5863cb97d57 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -34,12 +34,15 @@ drop table t1;
set max_join_size=100;
show variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size';
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
set max_join_size=DEFAULT;
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show variables like 'max_join_size';
set GLOBAL max_join_size=DEFAULT;
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
show global variables like 'max_join_size';
set @@max_join_size=1000, @@global.max_join_size=2000;
select @@local.max_join_size, @@global.max_join_size;
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 6047debcaf5..67bc8feadaa 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -64,7 +64,6 @@ EXTRA_PROGRAMS =
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
- -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
@DEFS@
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index 1ab86476e41..4d3b0604984 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -25,12 +25,13 @@
void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size __attribute__((unused)))
{
- mem_root->free= mem_root->used= 0;
+ mem_root->free= mem_root->used= mem_root->pre_alloc= 0;
mem_root->min_malloc= 32;
mem_root->block_size= block_size-MALLOC_OVERHEAD-sizeof(USED_MEM)-8;
mem_root->error_handler= 0;
mem_root->block_num= 4; /* We shift this with >>2 */
mem_root->first_block_usage= 0;
+
#if !(defined(HAVE_purify) && defined(EXTRA_DEBUG))
if (pre_alloc_size)
{
@@ -137,6 +138,7 @@ static inline void mark_blocks_free(MEM_ROOT* root)
/* Now everything is set; Indicate that nothing is used anymore */
root->used= 0;
+ root->first_block_usage= 0;
}
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 7ecd00f5b39..8f17d8519b8 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -100,6 +100,8 @@ SUFFIXES = .sh
-e 's!@''CC''@!@CC@!'\
-e 's!@''CXX''@!@CXX@!'\
-e 's!@''GXX''@!@GXX@!'\
+ -e 's!@''CC_VERSION''@!@CC_VERSION@!'\
+ -e 's!@''CXX_VERSION''@!@CXX_VERSION@!'\
-e 's!@''PERL''@!@PERL@!' \
-e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\
-e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\
diff --git a/scripts/mysqlbug.sh b/scripts/mysqlbug.sh
index 8dbc931b7f6..49ac08d0013 100644
--- a/scripts/mysqlbug.sh
+++ b/scripts/mysqlbug.sh
@@ -231,6 +231,8 @@ ${ORGANIZATION- $ORGANIZATION_C}
>Class: $CLASS_C
>Release: mysql-${VERSION} ($COMPILATION_COMMENT)
`test -n "$MYSQL_SERVER" && echo ">Server: $MYSQL_SERVER"`
+>C compiler: @CC_VERSION@
+>C++ compiler: @CXX_VERSION@
>Environment:
$ENVIRONMENT_C
`test -n "$SYSTEM" && echo "System: $SYSTEM"`
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c3b1190a4b6..20d7bffce21 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2038,11 +2038,14 @@ void Item_func_get_user_var::fix_length_and_dec()
maybe_null=1;
decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH;
- if ((var_entry= get_variable(&thd->user_vars, name, 0)))
- const_var_flag= thd->query_id != var_entry->update_query_id;
+ var_entry= get_variable(&thd->user_vars, name, 0);
}
+bool Item_func_get_user_var::const_item() const
+{ return var_entry && current_thd->query_id != var_entry->update_query_id; }
+
+
enum Item_result Item_func_get_user_var::result_type() const
{
user_var_entry *entry;
diff --git a/sql/item_func.h b/sql/item_func.h
index 501dcdadc3f..31310ab564e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -902,11 +902,10 @@ class Item_func_get_user_var :public Item_func
{
LEX_STRING name;
user_var_entry *var_entry;
- bool const_var_flag;
public:
Item_func_get_user_var(LEX_STRING a):
- Item_func(), name(a), const_var_flag(1) {}
+ Item_func(), name(a) {}
user_var_entry *get_entry();
double val();
longlong val_int();
@@ -915,9 +914,9 @@ public:
void print(String *str);
enum Item_result result_type() const;
const char *func_name() const { return "get_user_var"; }
- bool const_item() const { return const_var_flag; }
+ bool const_item() const;
table_map used_tables() const
- { return const_var_flag ? 0 : RAND_TABLE_BIT; }
+ { return const_item() ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const;
unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c09255d5dae..61ae07c01e7 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -242,6 +242,12 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO;
#endif
bool opt_large_files= sizeof(my_off_t) > 4;
+#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
+#define GET_HA_ROWS GET_ULL
+#else
+#define GET_HA_ROWS GET_ULONG
+#endif
+
/*
Variables to store startup options
@@ -3562,7 +3568,7 @@ struct my_option my_long_options[] =
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.",
(gptr*) &global_system_variables.max_join_size,
- (gptr*) &max_system_variables.max_join_size, 0, GET_ULONG, REQUIRED_ARG,
+ (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
~0L, 1, ~0L, 0, 1, 0},
{"max_sort_length", OPT_MAX_SORT_LENGTH,
"The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).",
@@ -3949,10 +3955,10 @@ static void set_options(void)
/* Set default values for some variables */
global_system_variables.table_type=DB_TYPE_MYISAM;
global_system_variables.tx_isolation=ISO_REPEATABLE_READ;
- global_system_variables.select_limit= (ulong) HA_POS_ERROR;
- max_system_variables.select_limit= (ulong) HA_POS_ERROR;
- global_system_variables.max_join_size= (ulong) HA_POS_ERROR;
- max_system_variables.max_join_size= (ulong) HA_POS_ERROR;
+ global_system_variables.select_limit= HA_POS_ERROR;
+ max_system_variables.select_limit= HA_POS_ERROR;
+ global_system_variables.max_join_size= HA_POS_ERROR;
+ max_system_variables.max_join_size= HA_POS_ERROR;
#ifdef __WIN__
/* Allow Win32 users to move MySQL anywhere */
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 4ebb2f5b476..471fd62ecb2 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -82,7 +82,7 @@ static int init_failsafe_rpl_thread(THD* thd)
#endif
thd->mem_root.free=thd->mem_root.used=0;
- if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
thd->proc_info="Thread initialized";
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 28222740c14..8e0baa234da 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -149,11 +149,11 @@ sys_var_long_ptr sys_max_delayed_threads("max_delayed_threads",
&max_insert_delayed_threads);
sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size",
&SV::max_heap_table_size);
-sys_var_thd_ulong sys_max_join_size("max_join_size",
+sys_var_thd_ha_rows sys_max_join_size("max_join_size",
&SV::max_join_size,
fix_max_join_size);
#ifndef TO_BE_DELETED /* Alias for max_join_size */
-sys_var_thd_ulong sys_sql_max_join_size("sql_max_join_size",
+sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size",
&SV::max_join_size,
fix_max_join_size);
#endif
@@ -275,7 +275,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks",
/* Local state variables */
-static sys_var_thd_ulong sys_select_limit("sql_select_limit",
+static sys_var_thd_ha_rows sys_select_limit("sql_select_limit",
&SV::select_limit);
static sys_var_timestamp sys_timestamp("timestamp");
static sys_var_last_insert_id sys_last_insert_id("last_insert_id");
@@ -576,7 +576,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
{
- if (thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
else
thd->options&= ~OPTION_BIG_SELECTS;
@@ -723,12 +723,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL)
- {
- /* Lock is needed to make things safe on 32 bit systems */
- pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ulong) tmp;
- pthread_mutex_unlock(&LOCK_global_system_variables);
- }
else
thd->variables.*offset= (ulong) tmp;
return 0;
@@ -755,10 +750,60 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type)
}
+bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
+{
+ ulonglong tmp= var->value->val_int();
+
+ /* Don't use bigger value than given with --maximum-variable-name=.. */
+ if ((ha_rows) tmp > max_system_variables.*offset)
+ tmp= max_system_variables.*offset;
+
+ if (option_limits)
+ tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits);
+ if (var->type == OPT_GLOBAL)
+ {
+ /* Lock is needed to make things safe on 32 bit systems */
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ global_system_variables.*offset= (ha_rows) tmp;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
+ else
+ thd->variables.*offset= (ha_rows) tmp;
+ return 0;
+}
+
+
+void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ {
+ /* We will not come here if option_limits is not set */
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ global_system_variables.*offset= (ha_rows) option_limits->def_value;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
+ else
+ thd->variables.*offset= global_system_variables.*offset;
+}
+
+
+byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ return (byte*) &(global_system_variables.*offset);
+ return (byte*) &(thd->variables.*offset);
+}
+
+
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
+ {
+ /* Lock is needed to make things safe on 32 bit systems */
+ pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= var->value->val_int();
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
else
thd->variables.*offset= var->value->val_int();
return 0;
@@ -768,7 +813,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ulong) option_limits->def_value;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
else
thd->variables.*offset= global_system_variables.*offset;
}
@@ -871,6 +920,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type)
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type));
case SHOW_LONGLONG:
return new Item_int(*(longlong*) value_ptr(thd, var_type));
+ case SHOW_HA_ROWS:
+ return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type));
case SHOW_MY_BOOL:
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1);
case SHOW_CHAR:
diff --git a/sql/set_var.h b/sql/set_var.h
index 3edd0373db9..c74f1e827bd 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -211,6 +211,24 @@ public:
};
+class sys_var_thd_ha_rows :public sys_var_thd
+{
+public:
+ ha_rows SV::*offset;
+ sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg)
+ :sys_var_thd(name_arg), offset(offset_arg)
+ {}
+ sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg,
+ sys_after_update_func func)
+ :sys_var_thd(name_arg,func), offset(offset_arg)
+ {}
+ bool update(THD *thd, set_var *var);
+ void set_default(THD *thd, enum_var_type type);
+ SHOW_TYPE type() { return SHOW_HA_ROWS; }
+ byte *value_ptr(THD *thd, enum_var_type type);
+};
+
+
class sys_var_thd_ulonglong :public sys_var_thd
{
public:
diff --git a/sql/slave.cc b/sql/slave.cc
index a4e0b029bbf..d254221e726 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1548,7 +1548,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
- if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
if (thd_type == SLAVE_THD_SQL)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 241b7d0f87a..8c4a7b83ebf 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -284,13 +284,14 @@ struct system_variables
{
ulonglong myisam_max_extra_sort_file_size;
ulonglong myisam_max_sort_file_size;
+ ha_rows select_limit;
+ ha_rows max_join_size;
ulong bulk_insert_buff_size;
ulong join_buff_size;
ulong long_query_time;
ulong max_allowed_packet;
ulong max_heap_table_size;
ulong max_sort_length;
- ulong max_join_size;
ulong max_tmp_tables;
ulong myisam_sort_buff_size;
ulong net_buffer_length;
@@ -302,7 +303,6 @@ struct system_variables
ulong query_cache_type;
ulong read_buff_size;
ulong read_rnd_buff_size;
- ulong select_limit;
ulong sortbuff_size;
ulong tmp_table_size;
ulong tx_isolation;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index ea9c331af8f..d9f2b9ca70d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -678,7 +678,7 @@ pthread_handler_decl(handle_one_connection,arg)
goto end_thread;
}
- if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
if (thd->client_capabilities & CLIENT_COMPRESS)
net->compress=1; // Use compression
@@ -754,7 +754,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
#endif
- if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
thd->proc_info=0;
@@ -1096,6 +1096,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
if (lower_case_table_names)
casedn_str(db);
+ if (check_access(thd,DROP_ACL,db,0,1))
+ break;
if (thd->locked_tables || thd->active_transaction())
{
send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 02f4655c655..a11abf75506 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1184,6 +1184,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_LONGLONG:
net_store_data(&packet2,(longlong) *(longlong*) value);
break;
+ case SHOW_HA_ROWS:
+ net_store_data(&packet2,(longlong) *(ha_rows*) value);
+ break;
case SHOW_BOOL:
net_store_data(&packet2,(ulong) *(bool*) value ? "ON" : "OFF");
break;
diff --git a/sql/structs.h b/sql/structs.h
index bd058a08e46..be50c8fc24d 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -129,7 +129,7 @@ enum SHOW_TYPE
SHOW_UNDEF,
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL,
SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
- SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS,
+ SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
#ifdef HAVE_OPENSSL
SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD,
SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE,