summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-12-19 16:25:50 +0200
committerunknown <monty@mysql.com>2003-12-19 16:25:50 +0200
commit9c2a63e35eec7a1af94dde1f10331361124a69f4 (patch)
tree87e8ff9b43e2e71fc79bfa2e296018b89b08a9e1 /sql
parent0fb88806e44f48aba363bfda5ebedaaa3b05b975 (diff)
downloadmariadb-git-9c2a63e35eec7a1af94dde1f10331361124a69f4.tar.gz
Fixes after merge with 4.0
Cleaned up embedded library access and query cache handling Changed min stack size to 128K (to allow longer MyISAM keys) Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work) client/mysqldump.c: Fixed bugs found after merge include/mysql_embed.h: Disable query cache when using embedded version myisam/mi_check.c: Removed not used variable mysql-test/r/auto_increment.result: Fixed bugs found after merge mysql-test/r/bdb.result: Fixed bugs found after merge mysql-test/r/func_group.result: Fixed bugs found after merge mysql-test/r/func_str.result: Fixed bugs found after merge mysql-test/r/func_time.result: Fixed bugs found after merge mysql-test/r/group_by.result: Fixed bugs found after merge mysql-test/r/innodb.result: Fixed bugs found after merge mysql-test/r/insert.result: Fixed bugs found after merge mysql-test/r/join_outer.result: Fixed bugs found after merge mysql-test/r/loaddata.result: Fixed bugs found after merge mysql-test/r/multi_update.result: Fixed bugs found after merge mysql-test/r/mysqldump.result: Update results mysql-test/r/rpl_EE_error.result: Fixed bugs found after merge mysql-test/r/rpl_multi_update.result: Fixed bugs found after merge mysql-test/r/symlink.result: Update results mysql-test/r/type_blob.result: Update results mysql-test/r/type_datetime.result: Update results mysql-test/r/type_decimal.result: Update results mysql-test/r/type_enum.result: Fixed bugs found after merge mysql-test/r/type_timestamp.result: Update results mysql-test/r/union.result: Update results mysql-test/r/warnings.result: Update results mysql-test/t/bdb.test: Fix test for 4.1 mysql-test/t/innodb.test: Fix test for 4.1 mysql-test/t/multi_update.test: Fix test for 4.1 mysql-test/t/mysqldump.test: Fix test for 4.1 mysql-test/t/rpl_EE_error.test: Fix test for 4.1 mysql-test/t/rpl_multi_update.test: Fix test for 4.1 mysql-test/t/union.test: Cleanup mysys/charset.c: Check results from my_once_alloc() mysys/my_handler.c: part of 4.0 merge sql-common/client.c: Part of 4.0 merge sql/field.cc: After merge fixes sql/field.h: After merge fixes sql/ha_innodb.cc: Remove duplicate include files sql/item.cc: Changed automatic int conversion to be of type binary sql/item.h: After merge fixes sql/item_func.cc: Changed automatic int conversion to be of type binary sql/item_func.h: After merge fixes sql/item_strfunc.cc: Added comments sql/item_subselect.cc: Indentation fixes sql/item_sum.cc: Changed automatic int conversion to be of type binary sql/item_sum.h: After merge fixes sql/mysql_priv.h: Cleanup embedded library access checks sql/mysqld.cc: Changed min stack size to 128K (to allow longer MyISAM keys) sql/set_var.cc: Fixed compiler warnings sql/share/czech/errmsg.txt: Better error message sql/share/danish/errmsg.txt: Better error message sql/share/dutch/errmsg.txt: Better error message sql/share/english/errmsg.txt: Better error message sql/share/estonian/errmsg.txt: Better error message sql/share/french/errmsg.txt: Better error message sql/share/greek/errmsg.txt: Better error message sql/share/hungarian/errmsg.txt: Better error message sql/share/italian/errmsg.txt: Better error message sql/share/japanese/errmsg.txt: Better error message sql/share/korean/errmsg.txt: Better error message sql/share/norwegian-ny/errmsg.txt: Better error message sql/share/norwegian/errmsg.txt: Better error message sql/share/polish/errmsg.txt: Better error message sql/share/romanian/errmsg.txt: Better error message sql/share/russian/errmsg.txt: Better error message sql/share/serbian/errmsg.txt: Better error message sql/share/slovak/errmsg.txt: Better error message sql/share/spanish/errmsg.txt: Better error message sql/share/swedish/errmsg.txt: Better error message sql/share/ukrainian/errmsg.txt: Better error message sql/sql_acl.h: Cleaned up embedded library acccess checks sql/sql_base.cc: After merge fixes sql/sql_client.cc: After merge fixes sql/sql_parse.cc: After merge fixes Changed access check code for embedded library (needed to make code shorter and ensure that check_table_access() is called) Recoded create-table handling for CREATE TABLE ... SELECT to make code shorter and faster sql/sql_prepare.cc: Add missing arguments sql/sql_select.cc: After merge fixes sql/sql_update.cc: After merge fixes sql/sql_yacc.yy: Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work) sql/table.cc: After merge fixes
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc7
-rw-r--r--sql/field.h11
-rw-r--r--sql/ha_innodb.cc2
-rw-r--r--sql/item.cc4
-rw-r--r--sql/item.h1
-rw-r--r--sql/item_func.cc31
-rw-r--r--sql/item_func.h3
-rw-r--r--sql/item_strfunc.cc8
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/item_sum.cc12
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/set_var.cc6
-rw-r--r--sql/share/czech/errmsg.txt4
-rw-r--r--sql/share/danish/errmsg.txt4
-rw-r--r--sql/share/dutch/errmsg.txt4
-rw-r--r--sql/share/english/errmsg.txt4
-rw-r--r--sql/share/estonian/errmsg.txt4
-rw-r--r--sql/share/french/errmsg.txt4
-rw-r--r--sql/share/greek/errmsg.txt4
-rw-r--r--sql/share/hungarian/errmsg.txt4
-rw-r--r--sql/share/italian/errmsg.txt4
-rw-r--r--sql/share/japanese/errmsg.txt4
-rw-r--r--sql/share/korean/errmsg.txt4
-rw-r--r--sql/share/norwegian-ny/errmsg.txt4
-rw-r--r--sql/share/norwegian/errmsg.txt4
-rw-r--r--sql/share/polish/errmsg.txt4
-rw-r--r--sql/share/romanian/errmsg.txt4
-rw-r--r--sql/share/russian/errmsg.txt4
-rw-r--r--sql/share/serbian/errmsg.txt4
-rw-r--r--sql/share/slovak/errmsg.txt4
-rw-r--r--sql/share/spanish/errmsg.txt4
-rw-r--r--sql/share/swedish/errmsg.txt4
-rw-r--r--sql/share/ukrainian/errmsg.txt4
-rw-r--r--sql/sql_acl.h12
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_client.cc3
-rw-r--r--sql/sql_parse.cc275
-rw-r--r--sql/sql_prepare.cc4
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_update.cc3
-rw-r--r--sql/sql_yacc.yy2
-rw-r--r--sql/table.cc3
44 files changed, 210 insertions, 295 deletions
diff --git a/sql/field.cc b/sql/field.cc
index c54e27360b5..4c7e219ab43 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -2910,6 +2910,7 @@ static longlong fix_datetime(longlong nr, TIME *time_res,
return nr;
err:
+ THD *thd= current_thd;
if (thd->count_cuted_fields)
{
thd->cuted_fields++;
@@ -2948,9 +2949,7 @@ int Field_timestamp::store(longlong nr)
err:
longstore(ptr,(uint32) 0);
- if (current_thd->count_cuted_fields)
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED,
- field_name, 0);
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED);
return 1;
}
@@ -5189,7 +5188,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
{
uint tmp=(uint) Field_enum::val_int();
if (!tmp || tmp > typelib->count)
- val_ptr->set((char*)"",0);
+ val_ptr->set("", 0, field_charset);
else
val_ptr->set((const char*) typelib->type_names[tmp-1],
(uint) strlen(typelib->type_names[tmp-1]),
diff --git a/sql/field.h b/sql/field.h
index 223ff4135d4..e3b4bf29fb8 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -874,7 +874,9 @@ public:
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, cs)
{}
- Field_varstring(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
+ Field_varstring(uint32 len_arg,bool maybe_null_arg,
+ const char *field_name_arg,
+ struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, cs)
{}
@@ -925,10 +927,9 @@ public:
:Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, cs),
geom_flag(true), packlength(4)
- {
- flags|= BLOB_FLAG;
- }
- }
+ {
+ flags|= BLOB_FLAG;
+ }
enum_field_types type() const { return FIELD_TYPE_BLOB;}
enum ha_base_keytype key_type() const
{ return binary() ? HA_KEYTYPE_VARBINARY : HA_KEYTYPE_VARTEXT; }
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 4e42d629a0f..419eac6d1c3 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -33,11 +33,9 @@ InnoDB */
#include "mysql_priv.h"
#include "slave.h"
-#include "sql_cache.h"
#ifdef HAVE_INNOBASE_DB
#include <m_ctype.h>
-#include <assert.h>
#include <hash.h>
#include <myisampack.h>
diff --git a/sql/item.cc b/sql/item.cc
index 9a9b8fe26a8..301d2990e0b 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -654,10 +654,10 @@ String *Item_param::val_str(String* str)
{
switch (item_result_type) {
case INT_RESULT:
- str->set(int_value, default_charset());
+ str->set(int_value, &my_charset_bin);
return str;
case REAL_RESULT:
- str->set(real_value, 2, default_charset());
+ str->set(real_value, 2, &my_charset_bin);
return str;
default:
return (String*) &str_value;
diff --git a/sql/item.h b/sql/item.h
index 90a0a706073..c6258518213 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -240,6 +240,7 @@ public:
st_select_lex *depended_from;
Item_ident(const char *db_name_par,const char *table_name_par,
const char *field_name_par);
+ Item_ident::Item_ident(THD *thd, Item_ident &item);
const char *full_name() const;
bool remove_dependence_processor(byte * arg);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 7495987856a..b9cbb38db1a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -317,6 +317,7 @@ void Item_func::print_op(String *str)
str->append(')');
}
+
bool Item_func::eq(const Item *item, bool binary_cmp) const
{
/* Assume we don't have rtti */
@@ -372,7 +373,7 @@ String *Item_real_func::val_str(String *str)
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
@@ -385,16 +386,16 @@ String *Item_num_func::val_str(String *str)
if (null_value)
return 0; /* purecov: inspected */
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
}
else
{
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
}
return str;
}
@@ -421,9 +422,9 @@ String *Item_int_func::val_str(String *str)
if (null_value)
return 0;
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
return str;
}
@@ -450,16 +451,16 @@ String *Item_num_op::val_str(String *str)
if (null_value)
return 0; /* purecov: inspected */
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
}
else
{
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
}
return str;
}
@@ -1030,9 +1031,9 @@ String *Item_func_min_max::val_str(String *str)
if (null_value)
return 0;
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
return str;
}
case REAL_RESULT:
@@ -1040,7 +1041,7 @@ String *Item_func_min_max::val_str(String *str)
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
return str;
}
case STRING_RESULT:
@@ -1668,7 +1669,7 @@ String *Item_func_udf_float::val_str(String *str)
double nr=val();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals,&my_charset_bin);
return str;
}
@@ -1689,9 +1690,9 @@ String *Item_func_udf_int::val_str(String *str)
if (null_value)
return 0;
if (!unsigned_flag)
- str->set(nr,default_charset());
+ str->set(nr,&my_charset_bin);
else
- str->set((ulonglong) nr,default_charset());
+ str->set((ulonglong) nr,&my_charset_bin);
return str;
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 739110fd81f..ac67b5a4065 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -717,9 +717,10 @@ public:
Item_func_bit_neg(Item *a) :Item_func_bit(a) {}
longlong val_int();
const char *func_name() const { return "~"; }
- void print(String *str) { Item_func_int::print(str); }
+ void print(String *str) { Item_func::print(str); }
};
+
class Item_func_set_last_insert_id :public Item_int_func
{
public:
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 16c886b558e..3cb03d7ea49 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1582,6 +1582,11 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org)
}
+/*
+ TODO: This needs to be fixed for multi-byte character set where numbers
+ are stored in more than one byte
+*/
+
String *Item_func_format::val_str(String *str)
{
double nr =args[0]->val();
@@ -1590,7 +1595,8 @@ String *Item_func_format::val_str(String *str)
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
dec= decimals ? decimals+1 : 0;
- str->set(nr,decimals,default_charset());
+ /* Here default_charset() is right as this is not an automatic conversion */
+ str->set(nr,decimals, default_charset());
#ifdef HAVE_ISNAN
if (isnan(nr))
return str;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 7b401b50d4c..bc16fe87c2a 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -344,7 +344,7 @@ void Item_singlerow_subselect::bring_value()
exec();
}
-double Item_singlerow_subselect::val ()
+double Item_singlerow_subselect::val()
{
if (!exec() && !value->null_value)
{
@@ -358,7 +358,7 @@ double Item_singlerow_subselect::val ()
}
}
-longlong Item_singlerow_subselect::val_int ()
+longlong Item_singlerow_subselect::val_int()
{
if (!exec() && !value->null_value)
{
@@ -466,7 +466,7 @@ void Item_exists_subselect::fix_length_and_dec()
max_columns= engine->cols();
}
-double Item_exists_subselect::val ()
+double Item_exists_subselect::val()
{
if (exec())
{
@@ -476,7 +476,7 @@ double Item_exists_subselect::val ()
return (double) value;
}
-longlong Item_exists_subselect::val_int ()
+longlong Item_exists_subselect::val_int()
{
if (exec())
{
@@ -493,11 +493,11 @@ String *Item_exists_subselect::val_str(String *str)
reset();
return 0;
}
- str->set(value,default_charset());
+ str->set(value,&my_charset_bin);
return str;
}
-double Item_in_subselect::val ()
+double Item_in_subselect::val()
{
if (exec())
{
@@ -510,7 +510,7 @@ double Item_in_subselect::val ()
return (double) value;
}
-longlong Item_in_subselect::val_int ()
+longlong Item_in_subselect::val_int()
{
if (exec())
{
@@ -536,7 +536,7 @@ String *Item_in_subselect::val_str(String *str)
null_value= 1;
return 0;
}
- str->set(value,default_charset());
+ str->set(value, &my_charset_bin);
return str;
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 8d9973e78f8..a31374a3fc3 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -140,7 +140,7 @@ Item_sum_num::val_str(String *str)
double nr=val();
if (null_value)
return 0;
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
@@ -477,13 +477,13 @@ Item_sum_hybrid::val_str(String *str)
case STRING_RESULT:
return &value;
case REAL_RESULT:
- str->set(sum,decimals,default_charset());
+ str->set(sum,decimals, &my_charset_bin);
break;
case INT_RESULT:
if (unsigned_flag)
- str->set((ulonglong) sum_int,default_charset());
+ str->set((ulonglong) sum_int, &my_charset_bin);
else
- str->set((longlong) sum_int,default_charset());
+ str->set((longlong) sum_int, &my_charset_bin);
break;
case ROW_RESULT:
default:
@@ -958,7 +958,7 @@ String *Item_avg_field::val_str(String *str)
double nr=Item_avg_field::val();
if (null_value)
return 0;
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
@@ -1006,7 +1006,7 @@ String *Item_variance_field::val_str(String *str)
double nr=val();
if (null_value)
return 0;
- str->set(nr,decimals,default_charset());
+ str->set(nr,decimals, &my_charset_bin);
return str;
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 3fe40ca4c68..8065218df97 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -468,6 +468,7 @@ public:
void clear();
longlong val_int();
void reset_field();
+ void update_field();
void fix_length_and_dec()
{ decimals=0; max_length=21; unsigned_flag=1; maybe_null=null_value=0; }
};
@@ -500,7 +501,6 @@ class Item_sum_xor :public Item_sum_bit
Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
Item_sum_xor(THD *thd, Item_sum_xor &item) :Item_sum_bit(thd, item) {}
bool add();
- void update_field();
const char *func_name() const { return "bit_xor"; }
Item *copy_or_same(THD* thd);
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index bff9ed94a23..8aa59b4d5d0 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -437,17 +437,11 @@ void kill_mysql(void);
void close_connection(THD *thd, uint errcode, bool lock);
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
bool no_grant, bool no_errors);
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
bool no_errors);
bool check_global_access(THD *thd, ulong want_access);
-#else
-#define check_access(thd, access, db, save_priv, no_grant, no_errors) false
-#define check_table_access(thd, want_access, tables, no_errors) false
-#define check_global_access(thd, want_access) false
-#endif
int mysql_backup_table(THD* thd, TABLE_LIST* table_list);
int mysql_restore_table(THD* thd, TABLE_LIST* table_list);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 36fa744e328..2bebec0d3db 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4595,7 +4595,7 @@ The minimum value for this variable is 4096.",
{"thread_stack", OPT_THREAD_STACK,
"The stack size for each thread.", (gptr*) &thread_stack,
(gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
- 1024*32, ~0L, 0, 1024, 0},
+ 1024L*128L, ~0L, 0, 1024, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
"Allocation block size for transactions to be stored in binary log",
(gptr*) &global_system_variables.trans_alloc_block_size,
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 66f8c3327a2..88b5d7bfdf0 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -787,9 +787,8 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
/* If the string is "", delete old init command */
if (var && (new_length= var->value->str_value.length()))
{
- if (!(res= my_strdup_with_length(var->value->str_value.ptr(),
- new_length,
- MYF(0))))
+ if (!(res= my_strdup_with_length((byte*) var->value->str_value.ptr(),
+ new_length, MYF(0))))
return 1;
}
/*
@@ -2501,6 +2500,7 @@ bool sys_var_thd_table_type::check(THD *thd, set_var *var)
}
return 0;
}
+ value= "unknown";
err:
my_error(ER_UNKNOWN_TABLE_ENGINE, MYF(0), value);
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index d6a0c51bdff..4470739cbdd 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -272,8 +272,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 1d889e6258e..d005150cb89 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -266,8 +266,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 4798ea55b42..3fd44f9ec69 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -274,8 +274,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 920ec433da0..6400093a6cf 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"ZLIB: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 0c9b5c96308..eb7e6d0508b 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -268,8 +268,8 @@ character-set=latin7
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index a9d3f9b049a..d5a4874a49d 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 5dfd1173467..5472e824e61 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -263,8 +263,8 @@ character-set=greek
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index d454c51caba..463aaed5760 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 18715b4930b..204e1f980cc 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index b034c8f657f..b8b9688fd38 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -265,8 +265,8 @@ character-set=ujis
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index df15d77c075..055d1a0a2c7 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -263,8 +263,8 @@ character-set=euckr
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index b46a52ae2de..735a2583685 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 3727e49d2ad..2c434da271e 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 1cb5b384e4b..78fcb2a7993 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -267,8 +267,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 519f86e284c..528a0d081ff 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -267,8 +267,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index ae186929898..5224f19b001 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -265,8 +265,8 @@ character-set=koi8r
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt
index 0719b88bec0..904c8f0c8b9 100644
--- a/sql/share/serbian/errmsg.txt
+++ b/sql/share/serbian/errmsg.txt
@@ -258,8 +258,8 @@ character-set=cp1250
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index cb5957fb892..0f5a70fa2c6 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -271,8 +271,8 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 0e95efff5aa..845a7da36eb 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -265,8 +265,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 5edf41e0202..9da0a511ddb 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -263,8 +263,8 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d rad(er) kapades av group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 8dbc2b582c9..7186e0550b2 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -268,8 +268,8 @@ character-set=koi8u
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
-"Record count is fewer than the column count at row %ld",
-"Record count is more than the column count at row %ld",
+"Row %ld doesn't contain data for all columns",
+"Row %ld was truncated; It contained more data than there where input columns",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 8b8115b10db..7b66a851d33 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -58,8 +58,6 @@
#define EXTRA_ACL (1L << 29)
#define NO_ACCESS (1L << 30)
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-
/*
Defines to change the above bits to how things are stored in tables
This is needed as the 'host' and 'db' table is missing a few privileges
@@ -127,8 +125,6 @@ public:
char *user,*db;
};
-
-
/* prototypes */
bool hostname_requires_resolving(const char *hostname);
@@ -152,7 +148,7 @@ my_bool grant_init(THD *thd);
void grant_free(void);
void grant_reload(THD *thd);
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
- uint show_command=0, bool dont_print_error=0);
+ uint show_command, bool dont_print_error);
bool check_grant_column (THD *thd,TABLE *table, const char *name, uint length,
uint show_command=0);
bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table);
@@ -165,5 +161,7 @@ void get_mqh(const char *user, const char *host, USER_CONN *uc);
int mysql_drop_user(THD *thd, List <LEX_USER> &list);
int mysql_revoke_all(THD *thd, List <LEX_USER> &list);
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
-
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+#define check_grant(A,B,C,D,E) 0
+#define check_grant_db(A,B) 0
+#endif
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index ebb94e11d9d..0101037da85 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1762,7 +1762,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
'name' of the item which may be used in the select list
*/
strmake(name_buff, db, sizeof(name_buff)-1);
- casedn_str(name_buff);
+ my_casedn_str(files_charset_info, name_buff);
db= name_buff;
}
diff --git a/sql/sql_client.cc b/sql/sql_client.cc
index 1ae9a23a924..905c32a42d9 100644
--- a/sql/sql_client.cc
+++ b/sql/sql_client.cc
@@ -39,7 +39,8 @@ void my_net_local_init(NET *net)
}
extern "C" {
-void mysql_once_init(void)
+int mysql_once_init(void)
{
+ return 0;
}
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6e6ec025a1f..f6a3308efb7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -51,14 +51,9 @@ extern "C" int gethostname(char *name, int namelen);
static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables);
static bool single_table_command_access(THD *thd, ulong privilege,
TABLE_LIST *tables, int *res);
-#else
-#define check_merge_table_access(thd, db, tables) false
-#define single_table_command_access(thd, privilege, tables, res) false
-#endif
static void remove_escape(char *name);
static void refresh_status(void);
static bool append_file_to_dir(THD *thd, char **filename_ptr,
@@ -177,7 +172,6 @@ end:
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check if user exist and password supplied is correct.
@@ -210,6 +204,11 @@ int check_user(THD *thd, enum enum_server_command command,
{
DBUG_ENTER("check_user");
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ thd->master_access= GLOBAL_ACLS; // Full rights
+ return 0;
+#else
+
my_bool opt_secure_auth_local;
pthread_mutex_lock(&LOCK_global_system_variables);
opt_secure_auth_local= opt_secure_auth;
@@ -333,7 +332,8 @@ int check_user(THD *thd, enum enum_server_command command,
DBUG_RETURN(-1);
}
}
- send_ok(thd);
+ else
+ send_ok(thd);
thd->password= test(passwd_len); // remember for error messages
/* Ready to handle queries */
DBUG_RETURN(0);
@@ -354,11 +354,9 @@ int check_user(THD *thd, enum enum_server_command command,
thd->host_or_ip,
passwd_len ? ER(ER_YES) : ER(ER_NO));
DBUG_RETURN(-1);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
-
-
/*
Check for maximum allowable user connections, if the mysqld server is
started with corresponding variable that is greater then 0.
@@ -509,7 +507,6 @@ bool is_update_query(enum enum_sql_command command)
return uc_update_queries[command];
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check if maximum queries per hour limit has been reached
returns 0 if OK.
@@ -528,6 +525,9 @@ static bool check_mqh(THD *thd, uint check_command)
DBUG_ENTER("check_mqh");
DBUG_ASSERT(uc != 0);
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ DBUG_RETURN(0);
+#else
/* If more than a hour since last check, reset resource checking */
if (check_time - uc->intime >= 3600)
{
@@ -561,12 +561,13 @@ static bool check_mqh(THD *thd, uint check_command)
}
end:
DBUG_RETURN(error);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
{
-
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
(void) pthread_mutex_lock(&LOCK_user_conn);
if (lu) // for GRANT
{
@@ -590,7 +591,8 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
{
for (uint idx=0;idx < hash_user_connections.records; idx++)
{
- USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections, idx);
+ USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections,
+ idx);
if (get_them)
get_mqh(uc->user,uc->host,uc);
uc->questions=0;
@@ -599,8 +601,8 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
}
}
(void) pthread_mutex_unlock(&LOCK_user_conn);
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
/*
Perform handshake, authorize client and update thd ACL variables.
@@ -1065,7 +1067,6 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
thd->query[length] = '\0';
thd->query_id=query_id++;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (mqh_used && thd->user_connect && check_mqh(thd, SQLCOM_END))
{
thd->net.error = 0;
@@ -1073,7 +1074,6 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC));
break;
}
-#endif
mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables
if (thd->is_fatal_error)
@@ -1137,12 +1137,10 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
if (!(table=open_ltable(thd, table_list, TL_READ_NO_INSERT)))
DBUG_RETURN(1);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd, SELECT_ACL, db, &table_list->grant.privilege,0,0))
goto err;
- if (grant_option && check_grant(thd, SELECT_ACL, table_list))
+ if (grant_option && check_grant(thd, SELECT_ACL, table_list, 0, 0))
goto err;
-#endif
thd->free_list = 0;
thd->query_length=(uint) strlen(tbl_name);
thd->query = tbl_name;
@@ -1446,13 +1444,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
my_casedn_str(files_charset_info, table_list.real_name);
remove_escape(table_list.real_name); // This can't have wildcards
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL,table_list.db,&thd->col_access,0,0))
break;
table_list.grant.privilege=thd->col_access;
- if (grant_option && check_grant(thd,SELECT_ACL,&table_list,2))
+ if (grant_option && check_grant(thd,SELECT_ACL,&table_list,2,0))
break;
-#endif /*DONT_ALLOW_SHOW_COMMANDS*/
mysqld_list_fields(thd,&table_list,fields);
free_items(thd->free_list);
break;
@@ -1598,19 +1594,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
case COM_PROCESS_INFO:
statistic_increment(com_stat[SQLCOM_SHOW_PROCESSLIST],&LOCK_status);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!thd->priv_user[0] && check_global_access(thd,PROCESS_ACL))
break;
-#endif
mysql_log.write(thd,command,NullS);
mysqld_list_processes(thd,
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->master_access & PROCESS_ACL ?
- NullS : thd->priv_user
-#else
- NullS
-#endif
- ,0);
+ NullS : thd->priv_user, 0);
break;
case COM_PROCESS_KILL:
{
@@ -1814,29 +1803,17 @@ mysql_execute_command(THD *thd)
}
}
}
- if (&lex->select_lex != lex->all_selects_list)
- {
- byte *save= lex->select_lex.table_list.first;
- if (lex->sql_command == SQLCOM_CREATE_TABLE)
- {
- /* Skip first table, which is the table we are creating */
- lex->select_lex.table_list.first= (byte*) (((TABLE_LIST *) save)->next);
- }
- if (lex->unit.create_total_list(thd, lex, &tables, 0))
- DBUG_VOID_RETURN;
- lex->select_lex.table_list.first= save;
- }
+ if (&lex->select_lex != lex->all_selects_list &&
+ lex->sql_command != SQLCOM_CREATE_TABLE &&
+ lex->unit.create_total_list(thd, lex, &tables, 0))
+ DBUG_VOID_RETURN;
/*
When option readonly is set deny operations which change tables.
Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
- !(thd->slave_thread
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- || (thd->master_access & SUPER_ACL)
-#endif
- ) &&
+ !(thd->slave_thread || (thd->master_access & SUPER_ACL)) &&
(uc_update_queries[lex->sql_command] > 0))
{
send_error(thd, ER_CANT_UPDATE_WITH_READLOCK);
@@ -1848,7 +1825,6 @@ mysql_execute_command(THD *thd)
case SQLCOM_SELECT:
{
select_result *result=lex->result;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (tables)
{
res=check_table_access(thd,
@@ -1864,7 +1840,6 @@ mysql_execute_command(THD *thd)
res=0;
break; // Error message is given
}
-#endif
/*
In case of single SELECT unit->global_parameters points on first SELECT
TODO: move counters to SELECT_LEX
@@ -2101,7 +2076,6 @@ mysql_execute_command(THD *thd)
{
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,CREATE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
if (grant_option)
@@ -2109,12 +2083,11 @@ mysql_execute_command(THD *thd)
/* Check that the first table has CREATE privilege */
TABLE_LIST *tmp_table_list=tables->next;
tables->next=0;
- bool error=check_grant(thd,CREATE_ACL,tables);
+ bool error=check_grant(thd,CREATE_ACL,tables,0,0);
tables->next=tmp_table_list;
if (error)
goto error;
}
-#endif
if (strlen(tables->real_name) > NAME_LEN)
{
net_printf(thd,ER_WRONG_TABLE_NAME, tables->real_name);
@@ -2137,43 +2110,34 @@ mysql_execute_command(THD *thd)
case SQLCOM_CREATE_TABLE:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ /* Skip first table, which is the table we are creating */
+ TABLE_LIST *create_table= tables;
+ tables= tables->next;
+ lex->select_lex.table_list.first= (byte*) (tables);
+ create_table->next= 0;
+ if (&lex->select_lex != lex->all_selects_list &&
+ lex->unit.create_total_list(thd, lex, &tables, 0))
+ DBUG_VOID_RETURN;
+
ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
CREATE_TMP_ACL : CREATE_ACL);
-#endif
- if (!tables->db)
- tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (check_access(thd,want_priv,tables->db,&tables->grant.privilege,0,0) ||
- check_merge_table_access(thd, tables->db,
+ if (check_access(thd, want_priv, create_table->db,
+ &create_table->grant.privilege, 0, 0) ||
+ check_merge_table_access(thd, create_table->db,
(TABLE_LIST *)
lex->create_info.merge_list.first))
goto error; /* purecov: inspected */
- if (grant_option && want_priv != CREATE_TMP_ACL)
- {
- /* Check that the first table has CREATE privilege */
- TABLE_LIST *tmp_table_list=tables->next;
- tables->next=0;
- bool error=check_grant(thd, want_priv, tables);
- tables->next=tmp_table_list;
- if (error)
+ if (grant_option && want_priv != CREATE_TMP_ACL &&
+ check_grant(thd, want_priv, create_table,0,0))
goto error;
- }
-#endif
- if (strlen(tables->real_name) > NAME_LEN)
- {
- net_printf(thd, ER_WRONG_TABLE_NAME, tables->alias);
- res=0;
- break;
- }
#ifndef HAVE_READLINK
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
#else
/* Fix names if symlinked tables */
if (append_file_to_dir(thd, &lex->create_info.data_file_name,
- tables->real_name) ||
+ create_table->real_name) ||
append_file_to_dir(thd,&lex->create_info.index_file_name,
- tables->real_name))
+ create_table->real_name))
{
res=-1;
break;
@@ -2197,49 +2161,42 @@ mysql_execute_command(THD *thd)
select_result *result;
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
- find_real_table_in_list(tables->next, tables->db, tables->real_name))
+ find_real_table_in_list(tables, create_table->db,
+ create_table->real_name))
{
- net_printf(thd,ER_UPDATE_TABLE_USED,tables->real_name);
+ net_printf(thd,ER_UPDATE_TABLE_USED, create_table->real_name);
DBUG_VOID_RETURN;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (tables->next)
- {
- if (check_table_access(thd, SELECT_ACL, tables->next,0))
- goto error; // Error message is given
- }
-#endif
+ if (tables && check_table_access(thd, SELECT_ACL, tables,0))
+ goto error; // Error message is given
select_lex->options|= SELECT_NO_UNLOCK;
unit->offset_limit_cnt= select_lex->offset_limit;
unit->select_limit_cnt= select_lex->select_limit+
select_lex->offset_limit;
if (unit->select_limit_cnt < select_lex->select_limit)
- unit->select_limit_cnt= HA_POS_ERROR; // No limit
+ unit->select_limit_cnt= HA_POS_ERROR; // No limit
- /* Skip first table, which is the table we are creating */
- lex->select_lex.table_list.first=
- (byte*) (((TABLE_LIST *) lex->select_lex.table_list.first)->next);
- if (!(res=open_and_lock_tables(thd,tables->next)))
+ if (!(res=open_and_lock_tables(thd,tables)))
{
- if ((result=new select_create(tables->db ? tables->db : thd->db,
- tables->real_name, &lex->create_info,
+ res= -1; // If error
+ if ((result=new select_create(create_table->db,
+ create_table->real_name,
+ &lex->create_info,
lex->create_list,
lex->key_list,
select_lex->item_list,lex->duplicates)))
res=handle_select(thd, lex, result);
- else
- res= -1;
}
}
else // regular create
{
if (lex->name)
- res= mysql_create_like_table(thd, tables, &lex->create_info,
+ res= mysql_create_like_table(thd, create_table, &lex->create_info,
(Table_ident *)lex->name);
else
{
- res= mysql_create_table(thd,tables->db ? tables->db : thd->db,
- tables->real_name, &lex->create_info,
+ res= mysql_create_table(thd,create_table->db,
+ create_table->real_name, &lex->create_info,
lex->create_list,
lex->key_list,0,0,0); // do logging
}
@@ -2251,12 +2208,10 @@ mysql_execute_command(THD *thd)
case SQLCOM_CREATE_INDEX:
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,INDEX_ACL,tables))
+ if (grant_option && check_grant(thd,INDEX_ACL,tables,0,0))
goto error;
-#endif
thd->slow_command=TRUE;
if (end_active_trans(thd))
res= -1;
@@ -2324,10 +2279,9 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option)
{
- if (check_grant(thd,ALTER_ACL,tables))
+ if (check_grant(thd,ALTER_ACL,tables,0,0))
goto error;
if (lex->name && !test_all_bits(priv,INSERT_ACL | CREATE_ACL))
{ // Rename of table
@@ -2336,11 +2290,10 @@ mysql_execute_command(THD *thd)
tmp_table.real_name=lex->name;
tmp_table.db=select_lex->db;
tmp_table.grant.privilege=priv;
- if (check_grant(thd,INSERT_ACL | CREATE_ACL,tables))
+ if (check_grant(thd,INSERT_ACL | CREATE_ACL,tables,0,0))
goto error;
}
}
-#endif
/* Don't yet allow changing of symlinks with ALTER TABLE */
lex->create_info.data_file_name=lex->create_info.index_file_name=0;
/* ALTER TABLE ends previous transaction */
@@ -2368,7 +2321,6 @@ mysql_execute_command(THD *thd)
TABLE_LIST *table;
if (check_db_used(thd,tables))
goto error;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
for (table=tables ; table ; table=table->next->next)
{
if (check_access(thd, ALTER_ACL | DROP_ACL, table->db,
@@ -2382,14 +2334,13 @@ mysql_execute_command(THD *thd)
old_list=table[0];
new_list=table->next[0];
old_list.next=new_list.next=0;
- if (check_grant(thd,ALTER_ACL,&old_list) ||
+ if (check_grant(thd,ALTER_ACL,&old_list,0,0) ||
(!test_all_bits(table->next->grant.privilege,
INSERT_ACL | CREATE_ACL) &&
- check_grant(thd,INSERT_ACL | CREATE_ACL, &new_list)))
+ check_grant(thd,INSERT_ACL | CREATE_ACL, &new_list,0,0)))
goto error;
}
}
-#endif
query_cache_invalidate3(thd, tables, 0);
if (end_active_trans(thd))
res= -1;
@@ -2543,12 +2494,10 @@ mysql_execute_command(THD *thd)
res= -1;
break;
case SQLCOM_UPDATE_MULTI:
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error;
- if (grant_option && check_grant(thd,UPDATE_ACL,tables))
+ if (grant_option && check_grant(thd,UPDATE_ACL,tables,0,0))
goto error;
-#endif
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2578,16 +2527,12 @@ mysql_execute_command(THD *thd)
case SQLCOM_REPLACE:
case SQLCOM_INSERT:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
my_bool update=(lex->value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (single_table_command_access(thd, privilege, tables, &res))
goto error;
-#else
- my_bool update=(lex->value_list.elements ? 1 : 0);
-#endif
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2607,7 +2552,6 @@ mysql_execute_command(THD *thd)
Check that we have modify privileges for the first table and
select privileges for the rest
*/
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
{
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL);
@@ -2615,18 +2559,17 @@ mysql_execute_command(THD *thd)
tables->next=0;
if (check_access(thd, privilege,
tables->db,&tables->grant.privilege,0,0) ||
- (grant_option && check_grant(thd, privilege, tables)))
+ (grant_option && check_grant(thd, privilege, tables,0,0)))
goto error;
tables->next=save_next;
if ((res=check_table_access(thd, SELECT_ACL, save_next,0)))
goto error;
}
-#endif
/* Fix lock for first table */
if (tables->lock_type == TL_WRITE_DELAYED)
- tables->lock_type == TL_WRITE;
+ tables->lock_type = TL_WRITE;
/* Don't unlock tables until command is written to binary log */
select_lex->options|= SELECT_NO_UNLOCK;
@@ -2661,12 +2604,10 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_TRUNCATE:
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,DELETE_ACL,tables))
+ if (grant_option && check_grant(thd,DELETE_ACL,tables,0,0))
goto error;
-#endif
/*
Don't allow this within a transaction because we want to use
re-generate table
@@ -2680,12 +2621,10 @@ mysql_execute_command(THD *thd)
break;
case SQLCOM_DELETE:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (single_table_command_access(thd, DELETE_ACL, tables, &res))
goto error;
// Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
-#endif
res = mysql_delete(thd,tables, select_lex->where,
(ORDER*) select_lex->order_list.first,
select_lex->select_limit, select_lex->options);
@@ -2807,12 +2746,10 @@ mysql_execute_command(THD *thd)
case SQLCOM_DROP_INDEX:
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,INDEX_ACL,tables->db,&tables->grant.privilege,0,0))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,INDEX_ACL,tables))
+ if (grant_option && check_grant(thd,INDEX_ACL,tables,0,0))
goto error;
-#endif
if (end_active_trans(thd))
res= -1;
else
@@ -2830,18 +2767,11 @@ mysql_execute_command(THD *thd)
break;
#endif
case SQLCOM_SHOW_PROCESSLIST:
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!thd->priv_user[0] && check_global_access(thd,PROCESS_ACL))
break;
-#endif
mysqld_list_processes(thd,
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->master_access & PROCESS_ACL ? NullS :
- thd->priv_user
-#else
- NullS
-#endif
- ,lex->verbose);
+ thd->priv_user,lex->verbose);
break;
case SQLCOM_SHOW_TABLE_TYPES:
res= mysqld_show_table_types(thd);
@@ -2867,10 +2797,8 @@ mysql_execute_command(THD *thd)
DBUG_VOID_RETURN;
#else
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (grant_option && check_access(thd, FILE_ACL, any_db,0,0,0))
goto error;
-#endif
res= mysqld_show_logs(thd);
break;
}
@@ -2894,7 +2822,6 @@ mysql_execute_command(THD *thd)
net_printf(thd,ER_WRONG_DB_NAME, db);
goto error;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
if (!thd->col_access && check_grant_db(thd,db))
@@ -2905,7 +2832,6 @@ mysql_execute_command(THD *thd)
db);
goto error;
}
-#endif
/* grant is checked in mysqld_show_tables */
if (select_lex->options & SELECT_DESCRIBE)
res= mysqld_extend_show_tables(thd,db,
@@ -2939,13 +2865,11 @@ mysql_execute_command(THD *thd)
}
remove_escape(db); // Fix escaped '_'
remove_escape(tables->real_name);
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
- if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
+ if (grant_option && check_grant(thd,SELECT_ACL,tables,2,0))
goto error;
-#endif
res= mysqld_show_fields(thd,tables,
(lex->wild ? lex->wild->ptr() : NullS),
lex->verbose);
@@ -2968,13 +2892,11 @@ mysql_execute_command(THD *thd)
remove_escape(tables->real_name);
if (!tables->db)
tables->db=thd->db;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
goto error; /* purecov: inspected */
tables->grant.privilege=thd->col_access;
- if (grant_option && check_grant(thd,SELECT_ACL,tables,2))
+ if (grant_option && check_grant(thd,SELECT_ACL,tables,2,0))
goto error;
-#endif
res= mysqld_show_keys(thd,tables);
break;
}
@@ -2985,7 +2907,6 @@ mysql_execute_command(THD *thd)
case SQLCOM_LOAD:
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL);
@@ -3002,11 +2923,11 @@ mysql_execute_command(THD *thd)
send_error(thd,ER_NOT_ALLOWED_COMMAND);
goto error;
}
- if (check_access(thd,privilege,tables->db,&tables->grant.privilege,0,0) ||
- grant_option && check_grant(thd,privilege,tables))
+ if (check_access(thd,privilege,tables->db,&tables->grant.privilege,0,
+ 0) ||
+ grant_option && check_grant(thd,privilege,tables,0,0))
goto error;
}
-#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
res=mysql_load(thd, lex->exchange, tables, lex->field_list,
lex->duplicates, (bool) lex->local_file, lex->lock_option);
break;
@@ -3250,7 +3171,7 @@ mysql_execute_command(THD *thd)
if (grant_option && check_grant(thd,
(lex->grant | lex->grant_tot_col |
GRANT_ACL),
- tables))
+ tables,0,0))
goto error;
if (!(res = mysql_table_grant(thd,tables,lex->users_list, lex->columns,
lex->grant,
@@ -3458,7 +3379,6 @@ error:
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
Check grants for commands which work only with one table and all other
tables belong to subselects.
@@ -3479,23 +3399,23 @@ static bool single_table_command_access(THD *thd, ulong privilege,
TABLE_LIST *tables, int *res)
{
- if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0))
- return 1;
+ if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0))
+ return 1;
- // Show only 1 table for check_grant
- TABLE_LIST *subselects_tables= tables->next;
- tables->next= 0;
- if (grant_option && check_grant(thd, privilege, tables))
- return 1;
+ // Show only 1 table for check_grant
+ TABLE_LIST *subselects_tables= tables->next;
+ tables->next= 0;
+ if (grant_option && check_grant(thd, privilege, tables, 0, 0))
+ return 1;
- // check rights on tables of subselect (if exists)
- if (subselects_tables)
- {
- tables->next= subselects_tables;
- if ((*res= check_table_access(thd, SELECT_ACL, subselects_tables,0)))
- return 1;
- }
- return 0;
+ // check rights on tables of subselect (if exists)
+ if (subselects_tables)
+ {
+ tables->next= subselects_tables;
+ if ((*res= check_table_access(thd, SELECT_ACL, subselects_tables,0)))
+ return 1;
+ }
+ return 0;
}
@@ -3538,6 +3458,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_RETURN(TRUE); /* purecov: tested */
}
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ DBUG_RETURN(0);
+#else
if ((thd->master_access & want_access) == want_access)
{
/*
@@ -3587,6 +3510,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
thd->priv_host,
db ? db : thd->db ? thd->db : "unknown"); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
@@ -3611,6 +3535,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
bool check_global_access(THD *thd, ulong want_access)
{
+#ifdef NO_EMBEDDED_ACCESS_CHECKS
+ return 0;
+#else
char command[128];
if ((thd->master_access & want_access))
return 0;
@@ -3618,6 +3545,7 @@ bool check_global_access(THD *thd, ulong want_access)
net_printf(thd,ER_SPECIFIC_ACCESS_DENIED_ERROR,
command);
return 1;
+#endif /* NO_EMBEDDED_ACCESS_CHECKS */
}
@@ -3682,7 +3610,6 @@ static bool check_merge_table_access(THD *thd, char *db,
return error;
}
-#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/
static bool check_db_used(THD *thd,TABLE_LIST *tables)
{
@@ -3941,9 +3868,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
else
{
mysql_execute_command(thd);
-#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_end_of_result(&thd->net);
-#endif
}
}
}
@@ -3951,9 +3876,7 @@ mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->is_fatal_error));
-#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_abort(&thd->net);
-#endif
}
thd->proc_info="freeing items";
free_items(thd->free_list); /* Free strings used by items */
@@ -4005,7 +3928,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
{
if (type == FIELD_TYPE_TIMESTAMP)
{
- net_printf(&thd->net, ER_INVALID_DEFAULT, field_name);
+ net_printf(thd, ER_INVALID_DEFAULT, field_name);
DBUG_RETURN(1);
}
else if (default_value->type() == Item::NULL_ITEM)
@@ -4674,10 +4597,8 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
UNLOCK_ACTIVE_MI;
}
#endif
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (options & REFRESH_USER_RESOURCES)
reset_mqh(thd,(LEX_USER *) NULL);
-#endif
if (write_to_binlog)
*write_to_binlog= tmp_write_to_binlog;
return result;
@@ -4712,18 +4633,14 @@ void kill_one_thread(THD *thd, ulong id)
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (tmp)
{
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
if ((thd->master_access & SUPER_ACL) ||
!strcmp(thd->user,tmp->user))
-#endif
{
tmp->awake(1 /*prepare to die*/);
error=0;
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
else
error=ER_KILL_DENIED_ERROR;
-#endif
pthread_mutex_unlock(&tmp->LOCK_delete);
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 790b80eb127..58e6dbff1ed 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -544,7 +544,7 @@ static bool mysql_test_insert_fields(PREP_STMT *stmt,
if (check_access(thd,privilege,table_list->db,
&table_list->grant.privilege,0,0) ||
- (grant_option && check_grant(thd,privilege,table_list)))
+ (grant_option && check_grant(thd,privilege,table_list,0,0)))
DBUG_RETURN(1);
#endif
if (open_and_lock_tables(thd, table_list))
@@ -599,7 +599,7 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (check_access(thd,UPDATE_ACL,table_list->db,
&table_list->grant.privilege,0,0) ||
- (grant_option && check_grant(thd,UPDATE_ACL,table_list)))
+ (grant_option && check_grant(thd,UPDATE_ACL,table_list,0,0)))
DBUG_RETURN(1);
#endif
if (open_and_lock_tables(thd, table_list))
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b2224d3ca9d..16b9a341ee5 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1134,8 +1134,6 @@ JOIN::exec()
simple_order= simple_group;
skip_sort_order= 0;
}
- if (!order && !no_order)
- order=group_list;
if (order &&
(const_tables == tables ||
((simple_order || skip_sort_order) &&
@@ -2487,8 +2485,6 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
join_tab[i].table->map);
}
}
- if (my_init_dynamic_array(keyuse,sizeof(KEYUSE),20,64))
- return TRUE;
/* fill keyuse with found key parts */
for ( ; field != end ; field++)
add_key_part(keyuse,field);
@@ -3255,7 +3251,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, KEYUSE *org_keyuse,
if (j->type == JT_CONST)
j->table->const_table= 1;
else if (((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY |
- HA_END_SPACE_KEY)) != HA_NOSAME) ||
+ HA_END_SPACE_KEY)) != HA_NOSAME) ||
keyparts != keyinfo->key_parts || null_ref_key)
{
/* Must read with repeat */
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 9f54b838e41..7dc537768f3 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -596,7 +596,8 @@ int multi_update::prepare(List<Item> &not_used_values,
{
TABLE *table=table_ref->table;
if (!(tables_to_update & table->map) &&
- check_dup(table_ref->db, table_ref->real_name, update_tables))
+ find_real_table_in_list(update_tables, table_ref->db,
+ table_ref->real_name))
table->no_cache= 1; // Disable row cache
}
DBUG_RETURN(thd->is_fatal_error != 0);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index ef71036206a..c847c6958a0 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -579,9 +579,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%left SHIFT_LEFT SHIFT_RIGHT
%left '-' '+'
%left '*' '/' '%' DIV_SYM MOD_SYM
-%left NEG '~'
%left XOR
%left '^'
+%left NEG '~'
%right NOT
%right BINARY COLLATE_SYM
diff --git a/sql/table.cc b/sql/table.cc
index fc1b8a13497..bc437f250b9 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1234,11 +1234,12 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
char *get_field(MEM_ROOT *mem, Field *field)
{
- char buff[MAX_FIELD_WIDTH] *to;
+ char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff),&my_charset_bin);
uint length;
field->val_str(&str,&str);
+ length= str.length();
if (!length || !(to= (char*) alloc_root(mem,length+1)))
return NullS;
memcpy(to,str.ptr(),(uint) length);