summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <tnurnberg@white.intern.koehntopp.de>2007-12-06 08:46:01 +0100
committerunknown <tnurnberg@white.intern.koehntopp.de>2007-12-06 08:46:01 +0100
commitbfe58b71f26cd791c5f196d843cb00f9752f8349 (patch)
tree7bd1d9278cda643791b895dd34703d19ef6828d2 /sql
parent0f9d3835f88fb858631997b356e85417d42bc667 (diff)
parent4618d68d6d85141cd2422c892ed5053c72aa097a (diff)
downloadmariadb-git-bfe58b71f26cd791c5f196d843cb00f9752f8349.tar.gz
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into mysql.com:/misc/mysql/31177/50-31177 mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/ps_7ndb.result: Auto merged mysql-test/t/variables.test: Auto merged sql/item_func.cc: Auto merged sql/mysqld.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/set_var.cc32
-rw-r--r--sql/set_var.h1
4 files changed, 28 insertions, 9 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 0309c1a17cb..3d584bc0488 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4603,6 +4603,8 @@ void Item_func_get_user_var::fix_length_and_dec()
if (var_entry)
{
+ unsigned_flag= var_entry->unsigned_flag;
+
collation.set(var_entry->collation);
switch (var_entry->type) {
case REAL_RESULT:
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 04afdee2dc2..250a5987168 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5693,7 +5693,7 @@ log and this option does nothing anymore.",
{"bdb_log_buffer_size", OPT_BDB_LOG_BUFFER_SIZE,
"The buffer that is allocated to cache index and rows for BDB tables.",
(gptr*) &berkeley_log_buffer_size, (gptr*) &berkeley_log_buffer_size, 0,
- GET_ULONG, REQUIRED_ARG, 0, 256*1024L, ULONG_MAX, 0, 1024, 0},
+ GET_ULONG, REQUIRED_ARG, 256*1024L, 256*1024L, ULONG_MAX, 0, 1024, 0},
{"bdb_max_lock", OPT_BDB_MAX_LOCK,
"The maximum number of locks you can have active on a BDB table.",
(gptr*) &berkeley_max_lock, (gptr*) &berkeley_max_lock, 0, GET_ULONG,
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 84b3f92c1ca..58b9b93b17f 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -115,6 +115,7 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type);
static void fix_server_id(THD *thd, enum_var_type type);
static ulonglong fix_unsigned(THD *thd, ulonglong num,
const struct my_option *option_limits);
+static bool get_unsigned(THD *thd, set_var *var);
static void throw_bounds_warning(THD *thd, const char *name, ulonglong num);
static KEY_CACHE *create_key_cache(const char *name, uint length);
void fix_sql_mode_var(THD *thd, enum_var_type type);
@@ -1471,6 +1472,18 @@ static ulonglong fix_unsigned(THD *thd, ulonglong num,
return out;
}
+static bool get_unsigned(THD *thd, set_var *var)
+{
+ if (var->value->unsigned_flag)
+ var->save_result.ulonglong_value= (ulonglong) var->value->val_int();
+ else
+ {
+ longlong v= var->value->val_int();
+ var->save_result.ulonglong_value= (ulonglong) ((v < 0) ? 0 : v);
+ }
+ return 0;
+}
+
sys_var_long_ptr::
sys_var_long_ptr(const char *name_arg, ulong *value_ptr_arg,
@@ -1482,9 +1495,7 @@ sys_var_long_ptr(const char *name_arg, ulong *value_ptr_arg,
bool sys_var_long_ptr_global::check(THD *thd, set_var *var)
{
- longlong v= var->value->val_int();
- var->save_result.ulonglong_value= v < 0 ? 0 : v;
- return 0;
+ return get_unsigned(thd, var);
}
bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
@@ -1497,9 +1508,9 @@ bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
{
#if SIZEOF_LONG < SIZEOF_LONG_LONG
/* Avoid overflows on 32 bit systems */
- if (tmp > (ulonglong) ~(ulong) 0)
+ if (tmp > ULONG_MAX)
{
- tmp= ((ulonglong) ~(ulong) 0);
+ tmp= ULONG_MAX;
throw_bounds_warning(thd, name, var->save_result.ulonglong_value);
}
#endif
@@ -1567,7 +1578,7 @@ byte *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
bool sys_var_thd_ulong::check(THD *thd, set_var *var)
{
- return (sys_var_thd::check(thd, var) ||
+ return (get_unsigned(thd, var) ||
(check_func && (*check_func)(thd, var)));
}
@@ -1585,9 +1596,9 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
if (option_limits)
tmp= (ulong) fix_unsigned(thd, tmp, option_limits);
#if SIZEOF_LONG < SIZEOF_LONG_LONG
- else if (tmp > (ulonglong) ~(ulong) 0)
+ else if (tmp > ULONG_MAX)
{
- tmp= ((ulonglong) ~(ulong) 0);
+ tmp= ULONG_MAX;
throw_bounds_warning(thd, name, var->save_result.ulonglong_value);
}
#endif
@@ -1667,6 +1678,11 @@ byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
return (byte*) &(thd->variables.*offset);
}
+bool sys_var_thd_ulonglong::check(THD *thd, set_var *var)
+{
+ return get_unsigned(thd, var);
+}
+
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
{
ulonglong tmp= var->save_result.ulonglong_value;
diff --git a/sql/set_var.h b/sql/set_var.h
index 7b3f864f44c..93402e21258 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -365,6 +365,7 @@ public:
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ bool check(THD *thd, set_var *var);
bool check_default(enum_var_type type)
{
return type == OPT_GLOBAL && !option_limits;