mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb
This commit is contained in:
commit
adb94fcb2c
49 changed files with 839 additions and 368 deletions
|
@ -19,6 +19,13 @@ BK_STATUS=$BK_STATUS$BK_COMMIT
|
|||
if [ "$BK_STATUS" = OK ]
|
||||
then
|
||||
|
||||
HAS_ACTUAL_CHANGES=`bk cset -r+ -d | grep -v "^#"`
|
||||
if [ "$HAS_ACTUAL_CHANGES" = "" ]
|
||||
then
|
||||
echo ChangeSet had no real changes, not sending emails
|
||||
exit
|
||||
fi
|
||||
|
||||
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
|
||||
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'`
|
||||
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Ww][Ll] *# *\([0-9][0-9]*\).*$/ WL#\1/p'`
|
||||
|
|
|
@ -311,7 +311,7 @@ rl_generic_bind (type, keyseq, data, map)
|
|||
mapped to something, `abc' to be mapped to something else,
|
||||
and the function bound to `a' to be executed when the user
|
||||
types `abx', leaving `bx' in the input queue. */
|
||||
if (k.function /* && k.type == ISFUNC */)
|
||||
if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR))
|
||||
{
|
||||
map[ANYOTHERKEY] = k;
|
||||
k.function = 0;
|
||||
|
|
|
@ -45,54 +45,33 @@ dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
|
|||
dtype_t* dtype_binary = &dtype_binary_val;
|
||||
|
||||
/*************************************************************************
|
||||
Checks if a string type has to be compared by the MySQL comparison functions.
|
||||
InnoDB internally only handles binary byte string comparisons, as well as
|
||||
latin1_swedish_ci strings. For example, UTF-8 strings have to be compared
|
||||
by MySQL. */
|
||||
|
||||
ibool
|
||||
dtype_str_needs_mysql_cmp(
|
||||
/*======================*/
|
||||
/* out: TRUE if a string type that requires
|
||||
comparison with MySQL functions */
|
||||
dtype_t* dtype) /* in: type struct */
|
||||
{
|
||||
if (dtype->mtype == DATA_MYSQL
|
||||
|| dtype->mtype == DATA_VARMYSQL
|
||||
|| (dtype->mtype == DATA_BLOB
|
||||
&& 0 == (dtype->prtype & DATA_BINARY_TYPE)
|
||||
&& dtype_get_charset_coll(dtype->prtype) !=
|
||||
data_mysql_latin1_swedish_charset_coll)) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
For the documentation of this function, see innobase_get_at_most_n_mbchars()
|
||||
in ha_innodb.cc. */
|
||||
Determine how many bytes the first n characters of the given string occupy.
|
||||
If the string is shorter than n characters, returns the number of bytes
|
||||
the characters in the string occupy. */
|
||||
|
||||
ulint
|
||||
dtype_get_at_most_n_mbchars(
|
||||
/*========================*/
|
||||
dtype_t* dtype,
|
||||
ulint prefix_len,
|
||||
ulint data_len,
|
||||
const char* str)
|
||||
/* out: length of the prefix,
|
||||
in bytes */
|
||||
const dtype_t* dtype, /* in: data type */
|
||||
ulint prefix_len, /* in: length of the requested
|
||||
prefix, in characters, multiplied by
|
||||
dtype_get_mbmaxlen(dtype) */
|
||||
ulint data_len, /* in: length of str (in bytes) */
|
||||
const char* str) /* in: the string whose prefix
|
||||
length is being determined */
|
||||
{
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
ut_a(data_len != UNIV_SQL_NULL);
|
||||
ut_a(!(prefix_len % dtype->mbmaxlen));
|
||||
|
||||
if (dtype_str_needs_mysql_cmp(dtype)) {
|
||||
if (dtype->mbminlen != dtype->mbmaxlen) {
|
||||
return(innobase_get_at_most_n_mbchars(
|
||||
dtype_get_charset_coll(dtype->prtype),
|
||||
prefix_len, data_len, str));
|
||||
}
|
||||
|
||||
/* We assume here that the string types that InnoDB itself can compare
|
||||
are single-byte charsets! */
|
||||
|
||||
if (prefix_len < data_len) {
|
||||
|
||||
return(prefix_len);
|
||||
|
|
|
@ -220,6 +220,8 @@ dict_build_table_def_step(
|
|||
const char* path_or_name;
|
||||
ibool is_path;
|
||||
mtr_t mtr;
|
||||
ulint i;
|
||||
ulint row_len;
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
|
@ -231,6 +233,15 @@ dict_build_table_def_step(
|
|||
|
||||
thr_get_trx(thr)->table_id = table->id;
|
||||
|
||||
row_len = 0;
|
||||
for (i = 0; i < table->n_def; i++) {
|
||||
row_len += dtype_get_min_size(dict_col_get_type(
|
||||
&table->cols[i]));
|
||||
}
|
||||
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
|
||||
return(DB_TOO_BIG_RECORD);
|
||||
}
|
||||
|
||||
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
||||
|
||||
cluster_table = dict_table_get_low(table->cluster_name);
|
||||
|
|
|
@ -145,28 +145,22 @@ store the charset-collation number; one byte is left unused, though */
|
|||
#define DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE 6
|
||||
|
||||
/*************************************************************************
|
||||
Checks if a string type has to be compared by the MySQL comparison functions.
|
||||
InnoDB internally only handles binary byte string comparisons, as well as
|
||||
latin1_swedish_ci strings. For example, UTF-8 strings have to be compared
|
||||
by MySQL. */
|
||||
|
||||
ibool
|
||||
dtype_str_needs_mysql_cmp(
|
||||
/*======================*/
|
||||
/* out: TRUE if a string type that requires
|
||||
comparison with MySQL functions */
|
||||
dtype_t* dtype); /* in: type struct */
|
||||
/*************************************************************************
|
||||
For the documentation of this function, see innobase_get_at_most_n_mbchars()
|
||||
in ha_innodb.cc. */
|
||||
Determine how many bytes the first n characters of the given string occupy.
|
||||
If the string is shorter than n characters, returns the number of bytes
|
||||
the characters in the string occupy. */
|
||||
|
||||
ulint
|
||||
dtype_get_at_most_n_mbchars(
|
||||
/*========================*/
|
||||
dtype_t* dtype,
|
||||
ulint prefix_len,
|
||||
ulint data_len,
|
||||
const char* str);
|
||||
/* out: length of the prefix,
|
||||
in bytes */
|
||||
const dtype_t* dtype, /* in: data type */
|
||||
ulint prefix_len, /* in: length of the requested
|
||||
prefix, in characters, multiplied by
|
||||
dtype_get_mbmaxlen(dtype) */
|
||||
ulint data_len, /* in: length of str (in bytes) */
|
||||
const char* str); /* in: the string whose prefix
|
||||
length is being determined */
|
||||
/*************************************************************************
|
||||
Checks if a data main type is a string type. Also a BLOB is considered a
|
||||
string type. */
|
||||
|
@ -306,6 +300,14 @@ dtype_get_fixed_size(
|
|||
/* out: fixed size, or 0 */
|
||||
dtype_t* type); /* in: type */
|
||||
/***************************************************************************
|
||||
Returns the minimum size of a data type. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtype_get_min_size(
|
||||
/*===============*/
|
||||
/* out: minimum size */
|
||||
const dtype_t* type); /* in: type */
|
||||
/***************************************************************************
|
||||
Returns a stored SQL NULL size for a type. For fixed length types it is
|
||||
the fixed length of the type, otherwise 0. */
|
||||
UNIV_INLINE
|
||||
|
|
|
@ -314,6 +314,7 @@ dtype_new_read_for_order_and_null_size(
|
|||
dtype_set_mblen(type);
|
||||
}
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/***************************************************************************
|
||||
Returns the size of a fixed size data type, 0 if not a fixed size type. */
|
||||
UNIV_INLINE
|
||||
|
@ -323,7 +324,6 @@ dtype_get_fixed_size(
|
|||
/* out: fixed size, or 0 */
|
||||
dtype_t* type) /* in: type */
|
||||
{
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
ulint mtype;
|
||||
|
||||
mtype = dtype_get_mtype(type);
|
||||
|
@ -354,6 +354,7 @@ dtype_get_fixed_size(
|
|||
case DATA_INT:
|
||||
case DATA_FLOAT:
|
||||
case DATA_DOUBLE:
|
||||
return(dtype_get_len(type));
|
||||
case DATA_MYSQL:
|
||||
if (type->prtype & DATA_BINARY_TYPE) {
|
||||
return(dtype_get_len(type));
|
||||
|
@ -401,14 +402,67 @@ dtype_get_fixed_size(
|
|||
}
|
||||
|
||||
return(0);
|
||||
#else /* UNIV_HOTBACKUP */
|
||||
/* This function depends on MySQL code that is not included in
|
||||
InnoDB Hot Backup builds. Besides, this function should never
|
||||
be called in InnoDB Hot Backup. */
|
||||
ut_error;
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Returns the size of a fixed size data type, 0 if not a fixed size type. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtype_get_min_size(
|
||||
/*===============*/
|
||||
/* out: minimum size */
|
||||
const dtype_t* type) /* in: type */
|
||||
{
|
||||
switch (type->mtype) {
|
||||
case DATA_SYS:
|
||||
#ifdef UNIV_DEBUG
|
||||
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
|
||||
default:
|
||||
ut_ad(0);
|
||||
return(0);
|
||||
case DATA_ROW_ID:
|
||||
ut_ad(type->len == DATA_ROW_ID_LEN);
|
||||
break;
|
||||
case DATA_TRX_ID:
|
||||
ut_ad(type->len == DATA_TRX_ID_LEN);
|
||||
break;
|
||||
case DATA_ROLL_PTR:
|
||||
ut_ad(type->len == DATA_ROLL_PTR_LEN);
|
||||
break;
|
||||
case DATA_MIX_ID:
|
||||
ut_ad(type->len == DATA_MIX_ID_LEN);
|
||||
break;
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
case DATA_CHAR:
|
||||
case DATA_FIXBINARY:
|
||||
case DATA_INT:
|
||||
case DATA_FLOAT:
|
||||
case DATA_DOUBLE:
|
||||
return(type->len);
|
||||
case DATA_MYSQL:
|
||||
if ((type->prtype & DATA_BINARY_TYPE)
|
||||
|| type->mbminlen == type->mbmaxlen) {
|
||||
return(type->len);
|
||||
}
|
||||
/* this is a variable-length character set */
|
||||
ut_a(type->mbminlen > 0);
|
||||
ut_a(type->mbmaxlen > type->mbminlen);
|
||||
ut_a(type->len % type->mbmaxlen == 0);
|
||||
return(type->len * type->mbminlen / type->mbmaxlen);
|
||||
case DATA_VARCHAR:
|
||||
case DATA_BINARY:
|
||||
case DATA_DECIMAL:
|
||||
case DATA_VARMYSQL:
|
||||
case DATA_BLOB:
|
||||
return(0);
|
||||
default: ut_error;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/***************************************************************************
|
||||
Returns a stored SQL NULL size for a type. For fixed length types it is
|
||||
the fixed length of the type, otherwise 0. */
|
||||
|
|
|
@ -99,6 +99,7 @@ row_mysql_store_col_in_innobase_format(
|
|||
as dfield is used! */
|
||||
ulint col_len, /* in: MySQL column length */
|
||||
ulint type, /* in: data type */
|
||||
bool comp, /* in: TRUE=compact format */
|
||||
ulint is_unsigned); /* in: != 0 if unsigned integer type */
|
||||
/********************************************************************
|
||||
Handles user errors and lock waits detected by the database engine. */
|
||||
|
|
|
@ -67,6 +67,7 @@ row_mysql_store_col_in_innobase_format(
|
|||
as dfield is used! */
|
||||
ulint col_len, /* in: MySQL column length */
|
||||
ulint type, /* in: data type */
|
||||
bool comp, /* in: TRUE=compact format */
|
||||
ulint is_unsigned) /* in: != 0 if unsigned integer type */
|
||||
{
|
||||
byte* ptr = mysql_data;
|
||||
|
@ -113,6 +114,37 @@ row_mysql_store_col_in_innobase_format(
|
|||
col_len--;
|
||||
}
|
||||
}
|
||||
} else if (comp && type == DATA_MYSQL
|
||||
&& dtype_get_mbminlen(dfield_get_type(dfield)) == 1
|
||||
&& dtype_get_mbmaxlen(dfield_get_type(dfield)) > 1) {
|
||||
/* We assume that this CHAR field is encoded in a
|
||||
variable-length character set where spaces have
|
||||
1:1 correspondence to 0x20 bytes, such as UTF-8.
|
||||
|
||||
Consider a CHAR(n) field, a field of n characters.
|
||||
It will contain between n*mbminlen and n*mbmaxlen bytes.
|
||||
We will try to truncate it to n bytes by stripping
|
||||
space padding. If the field contains single-byte
|
||||
characters only, it will be truncated to n characters.
|
||||
Consider a CHAR(5) field containing the string ".a "
|
||||
where "." denotes a 3-byte character represented by
|
||||
the bytes "$%&". After our stripping, the string will
|
||||
be stored as "$%&a " (5 bytes). The string ".abc "
|
||||
will be stored as "$%&abc" (6 bytes).
|
||||
|
||||
The space padding will be restored in row0sel.c, function
|
||||
row_sel_field_store_in_mysql_format(). */
|
||||
|
||||
ulint n_chars;
|
||||
dtype_t* dtype = dfield_get_type(dfield);
|
||||
|
||||
ut_a(!(dtype_get_len(dtype) % dtype_get_mbmaxlen(dtype)));
|
||||
n_chars = dtype_get_len(dtype) / dtype_get_mbmaxlen(dtype);
|
||||
|
||||
/* Strip space padding. */
|
||||
while (col_len > n_chars && ptr[col_len - 1] == 0x20) {
|
||||
col_len--;
|
||||
}
|
||||
} else if (type == DATA_BLOB) {
|
||||
ptr = row_mysql_read_blob_ref(&col_len, mysql_data, col_len);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,8 @@ row_mysql_convert_row_to_innobase(
|
|||
+ templ->mysql_col_offset,
|
||||
mysql_rec + templ->mysql_col_offset,
|
||||
templ->mysql_col_len,
|
||||
templ->type, templ->is_unsigned);
|
||||
templ->type, prebuilt->table->comp,
|
||||
templ->is_unsigned);
|
||||
next_column:
|
||||
;
|
||||
}
|
||||
|
|
|
@ -2137,6 +2137,7 @@ row_sel_convert_mysql_key_to_innobase(
|
|||
row_mysql_store_col_in_innobase_format(
|
||||
dfield, buf, key_ptr + data_offset,
|
||||
data_len, type,
|
||||
index->table->comp,
|
||||
dfield_get_type(dfield)->prtype
|
||||
& DATA_UNSIGNED);
|
||||
buf += data_len;
|
||||
|
@ -2232,17 +2233,17 @@ row_sel_field_store_in_mysql_format(
|
|||
are not in themselves stored here: the caller must
|
||||
allocate and copy the BLOB into buffer before, and pass
|
||||
the pointer to the BLOB in 'data' */
|
||||
ulint col_len,/* in: MySQL column length */
|
||||
const mysql_row_templ_t* templ, /* in: MySQL column template.
|
||||
Its following fields are referenced:
|
||||
type, is_unsigned, mysql_col_len, mbminlen, mbmaxlen */
|
||||
byte* data, /* in: data to store */
|
||||
ulint len, /* in: length of the data */
|
||||
ulint type, /* in: data type */
|
||||
ulint is_unsigned)/* in: != 0 if an unsigned integer type */
|
||||
ulint len) /* in: length of the data */
|
||||
{
|
||||
byte* ptr;
|
||||
|
||||
ut_ad(len != UNIV_SQL_NULL);
|
||||
|
||||
if (type == DATA_INT) {
|
||||
if (templ->type == DATA_INT) {
|
||||
/* Convert integer data from Innobase to a little-endian
|
||||
format, sign bit restored to normal */
|
||||
|
||||
|
@ -2257,31 +2258,58 @@ row_sel_field_store_in_mysql_format(
|
|||
data++;
|
||||
}
|
||||
|
||||
if (!is_unsigned) {
|
||||
if (!templ->is_unsigned) {
|
||||
dest[len - 1] = (byte) (dest[len - 1] ^ 128);
|
||||
}
|
||||
|
||||
ut_ad(col_len == len);
|
||||
} else if (type == DATA_VARCHAR || type == DATA_VARMYSQL
|
||||
|| type == DATA_BINARY) {
|
||||
ut_ad(templ->mysql_col_len == len);
|
||||
} else if (templ->type == DATA_VARCHAR || templ->type == DATA_VARMYSQL
|
||||
|| templ->type == DATA_BINARY) {
|
||||
/* Store the length of the data to the first two bytes of
|
||||
dest; does not do anything yet because MySQL has
|
||||
no real vars! */
|
||||
|
||||
dest = row_mysql_store_var_len(dest, len);
|
||||
ut_memcpy(dest, data, len);
|
||||
|
||||
/* ut_ad(col_len >= len + 2); No real var implemented in
|
||||
MySQL yet! */
|
||||
#if 0
|
||||
/* No real var implemented in MySQL yet! */
|
||||
ut_ad(templ->mysql_col_len >= len + 2);
|
||||
#endif
|
||||
|
||||
} else if (type == DATA_BLOB) {
|
||||
} else if (templ->type == DATA_BLOB) {
|
||||
/* Store a pointer to the BLOB buffer to dest: the BLOB was
|
||||
already copied to the buffer in row_sel_store_mysql_rec */
|
||||
|
||||
row_mysql_store_blob_ref(dest, col_len, data, len);
|
||||
row_mysql_store_blob_ref(dest, templ->mysql_col_len,
|
||||
data, len);
|
||||
} else if (templ->type == DATA_MYSQL) {
|
||||
memcpy(dest, data, len);
|
||||
|
||||
ut_a(templ->mysql_col_len >= len);
|
||||
ut_a(templ->mbmaxlen >= templ->mbminlen);
|
||||
|
||||
ut_a(templ->mbmaxlen > templ->mbminlen
|
||||
|| templ->mysql_col_len == len);
|
||||
ut_a(!templ->mbmaxlen
|
||||
|| !(templ->mysql_col_len % templ->mbmaxlen));
|
||||
ut_a(len * templ->mbmaxlen >= templ->mysql_col_len);
|
||||
|
||||
if (templ->mbminlen != templ->mbmaxlen) {
|
||||
/* Pad with spaces. This undoes the stripping
|
||||
done in row0mysql.ic, function
|
||||
row_mysql_store_col_in_innobase_format(). */
|
||||
memset(dest + len, 0x20, templ->mysql_col_len - len);
|
||||
}
|
||||
} else {
|
||||
ut_memcpy(dest, data, len);
|
||||
ut_ad(col_len == len);
|
||||
ut_a(templ->type == DATA_CHAR
|
||||
|| templ->type == DATA_FIXBINARY
|
||||
/*|| templ->type == DATA_SYS_CHILD
|
||||
|| templ->type == DATA_SYS*/
|
||||
|| templ->type == DATA_FLOAT
|
||||
|| templ->type == DATA_DOUBLE
|
||||
|| templ->type == DATA_DECIMAL);
|
||||
ut_ad(templ->mysql_col_len == len);
|
||||
memcpy(dest, data, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2401,8 +2429,7 @@ row_sel_store_mysql_rec(
|
|||
|
||||
row_sel_field_store_in_mysql_format(
|
||||
mysql_rec + templ->mysql_col_offset,
|
||||
templ->mysql_col_len, data, len,
|
||||
templ->type, templ->is_unsigned);
|
||||
templ, data, len);
|
||||
|
||||
if (templ->type == DATA_VARCHAR
|
||||
|| templ->type == DATA_VARMYSQL
|
||||
|
@ -2487,7 +2514,7 @@ row_sel_store_mysql_rec(
|
|||
len -= 2;
|
||||
}
|
||||
} else {
|
||||
ut_ad(templ->mbminlen == 1);
|
||||
ut_ad(!pad_char || templ->mbminlen == 1);
|
||||
memset(mysql_rec + templ->mysql_col_offset,
|
||||
pad_char, templ->mysql_col_len);
|
||||
}
|
||||
|
@ -2855,9 +2882,11 @@ row_sel_push_cache_row_for_mysql(
|
|||
|
||||
ut_ad(prebuilt->fetch_cache_first == 0);
|
||||
|
||||
ut_a(row_sel_store_mysql_rec(
|
||||
if (!row_sel_store_mysql_rec(
|
||||
prebuilt->fetch_cache[prebuilt->n_fetch_cached],
|
||||
prebuilt, rec, offsets));
|
||||
prebuilt, rec, offsets)) {
|
||||
ut_error;
|
||||
}
|
||||
|
||||
prebuilt->n_fetch_cached++;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ extern my_string mysql_unix_port;
|
|||
CLIENT_TRANSACTIONS | \
|
||||
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION)
|
||||
|
||||
sig_handler pipe_sig_handler(int sig);
|
||||
sig_handler my_pipe_sig_handler(int sig);
|
||||
void read_user_name(char *name);
|
||||
my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
|
||||
|
||||
|
@ -32,7 +32,7 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename);
|
|||
|
||||
#if !defined(__WIN__) && defined(SIGPIPE) && !defined(THREAD)
|
||||
#define init_sigpipe_variables sig_return old_signal_handler=(sig_return) 0;
|
||||
#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE,pipe_sig_handler)
|
||||
#define set_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) old_signal_handler=signal(SIGPIPE, my_pipe_sig_handler)
|
||||
#define reset_sigpipe(mysql) if ((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE) signal(SIGPIPE,old_signal_handler);
|
||||
#else
|
||||
#define init_sigpipe_variables
|
||||
|
|
|
@ -92,7 +92,7 @@ my_bool net_flush(NET *net);
|
|||
#define unsigned_field(A) ((A)->flags & UNSIGNED_FLAG)
|
||||
|
||||
static void append_wild(char *to,char *end,const char *wild);
|
||||
sig_handler pipe_sig_handler(int sig);
|
||||
sig_handler my_pipe_sig_handler(int sig);
|
||||
|
||||
static my_bool mysql_client_init= 0;
|
||||
static my_bool org_my_init_done= 0;
|
||||
|
@ -294,11 +294,11 @@ mysql_debug(const char *debug __attribute__((unused)))
|
|||
**************************************************************************/
|
||||
|
||||
sig_handler
|
||||
pipe_sig_handler(int sig __attribute__((unused)))
|
||||
my_pipe_sig_handler(int sig __attribute__((unused)))
|
||||
{
|
||||
DBUG_PRINT("info",("Hit by signal %d",sig));
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
(void) signal(SIGPIPE,pipe_sig_handler);
|
||||
(void) signal(SIGPIPE, my_pipe_sig_handler);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -91,3 +91,7 @@ sjis_bin 6109
|
|||
sjis_bin 61
|
||||
sjis_bin 6120
|
||||
drop table t1;
|
||||
SET NAMES sjis;
|
||||
SELECT HEX('佐淘 \圭') FROM DUAL;
|
||||
HEX('佐淘 \圭')
|
||||
8DB2939181408C5C
|
||||
|
|
|
@ -125,7 +125,7 @@ Field Type Collation Null Key Default Extra Privileges Comment
|
|||
a int(11) NULL YES MUL NULL select,insert,update,references
|
||||
show full columns from mysql.db like "Insert%";
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
Insert_priv enum('N','Y') utf8_bin NO N select,insert,update,references
|
||||
Insert_priv enum('N','Y') utf8_general_ci NO N select,insert,update,references
|
||||
show full columns from v1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c varchar(64) utf8_general_ci NO select,insert,update,references
|
||||
|
|
|
@ -1718,9 +1718,6 @@ Innodb_rows_deleted 2070
|
|||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 31708
|
||||
show status like "Innodb_rows_read";
|
||||
Variable_name Value
|
||||
Innodb_rows_read 80162
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 29530
|
||||
|
|
|
@ -140,10 +140,10 @@ a b c
|
|||
5 6 130
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT t1 VALUES (1,2,10), (3,4,20);
|
||||
CREATE TABLE t2 (x INT, y INT, z INT, d INT);
|
||||
CREATE TABLE t2 (a INT, b INT, c INT, d INT);
|
||||
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
|
||||
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
|
||||
INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
|
||||
INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
1 2 10
|
||||
|
@ -157,7 +157,7 @@ a b c
|
|||
3 4 120
|
||||
5 0 30
|
||||
8 9 60
|
||||
INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
|
||||
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
|
||||
SELECT *, VALUES(a) FROM t1;
|
||||
a b c VALUES(a)
|
||||
1 2 10 NULL
|
||||
|
|
|
@ -141,3 +141,21 @@ select * from T1;
|
|||
a b
|
||||
1 abc
|
||||
drop table T1;
|
||||
create database mysqltest_LC2;
|
||||
use mysqltest_LC2;
|
||||
create table myUC (i int);
|
||||
insert into myUC values (1),(2),(3);
|
||||
select * from myUC;
|
||||
i
|
||||
1
|
||||
2
|
||||
3
|
||||
use test;
|
||||
drop database mysqltest_LC2;
|
||||
create database mysqltest_LC2;
|
||||
use mysqltest_LC2;
|
||||
create table myUC (i int);
|
||||
select * from myUC;
|
||||
i
|
||||
use test;
|
||||
drop database mysqltest_LC2;
|
||||
|
|
23
mysql-test/r/lowercase_table_grant.result
Normal file
23
mysql-test/r/lowercase_table_grant.result
Normal file
|
@ -0,0 +1,23 @@
|
|||
use mysql;
|
||||
create database MYSQLtest;
|
||||
grant all on MySQLtest.* to mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
select * from db where user = 'mysqltest_1';
|
||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
|
||||
localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y
|
||||
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
select * from db where user = 'mysqltest_1';
|
||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
|
||||
localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y Y Y Y Y Y
|
||||
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
|
||||
flush privileges;
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database MYSQLtest;
|
7
mysql-test/r/skip_name_resolve.result
Normal file
7
mysql-test/r/skip_name_resolve.result
Normal file
|
@ -0,0 +1,7 @@
|
|||
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
|
||||
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
|
||||
Grants for mysqltest_1@127.0.0.1/255.255.255.255
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
|
||||
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
|
||||
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
|
||||
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
|
|
@ -24,23 +24,23 @@ db CREATE TABLE `db` (
|
|||
`Host` char(60) collate utf8_bin NOT NULL default '',
|
||||
`Db` char(64) collate utf8_bin NOT NULL default '',
|
||||
`User` char(16) collate utf8_bin NOT NULL default '',
|
||||
`Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_view_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Show_view_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_routine_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Alter_routine_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`),
|
||||
KEY `User` (`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
|
||||
|
@ -49,20 +49,20 @@ Table Create Table
|
|||
host CREATE TABLE `host` (
|
||||
`Host` char(60) collate utf8_bin NOT NULL default '',
|
||||
`Db` char(64) collate utf8_bin NOT NULL default '',
|
||||
`Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_view_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Show_view_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
PRIMARY KEY (`Host`,`Db`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges'
|
||||
show create table user;
|
||||
|
@ -71,32 +71,32 @@ user CREATE TABLE `user` (
|
|||
`Host` char(60) collate utf8_bin NOT NULL default '',
|
||||
`User` char(16) collate utf8_bin NOT NULL default '',
|
||||
`Password` char(41) collate utf8_bin NOT NULL default '',
|
||||
`Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Reload_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Shutdown_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Process_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`File_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Show_db_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Super_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Repl_slave_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Repl_client_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_view_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Show_view_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Create_routine_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`Alter_routine_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
|
||||
`ssl_type` enum('','ANY','X509','SPECIFIED') collate utf8_bin NOT NULL default '',
|
||||
`Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Reload_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Shutdown_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Process_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`File_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Show_db_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Super_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Repl_slave_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Repl_client_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Show_view_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Create_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`Alter_routine_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
|
||||
`ssl_type` enum('','ANY','X509','SPECIFIED') character set utf8 NOT NULL default '',
|
||||
`ssl_cipher` blob NOT NULL,
|
||||
`x509_issuer` blob NOT NULL,
|
||||
`x509_subject` blob NOT NULL,
|
||||
|
@ -112,7 +112,7 @@ func CREATE TABLE `func` (
|
|||
`name` char(64) collate utf8_bin NOT NULL default '',
|
||||
`ret` tinyint(1) NOT NULL default '0',
|
||||
`dl` char(128) collate utf8_bin NOT NULL default '',
|
||||
`type` enum('function','aggregate') collate utf8_bin NOT NULL default 'function',
|
||||
`type` enum('function','aggregate') character set utf8 NOT NULL default 'function',
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'
|
||||
show create table tables_priv;
|
||||
|
@ -124,8 +124,8 @@ tables_priv CREATE TABLE `tables_priv` (
|
|||
`Table_name` char(64) collate utf8_bin NOT NULL default '',
|
||||
`Grantor` char(77) collate utf8_bin NOT NULL default '',
|
||||
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') collate utf8_bin NOT NULL default '',
|
||||
`Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '',
|
||||
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') character set utf8 NOT NULL default '',
|
||||
`Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'
|
||||
|
@ -138,7 +138,7 @@ columns_priv CREATE TABLE `columns_priv` (
|
|||
`Table_name` char(64) collate utf8_bin NOT NULL default '',
|
||||
`Column_name` char(64) collate utf8_bin NOT NULL default '',
|
||||
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '',
|
||||
`Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
|
||||
show create table procs_priv;
|
||||
|
@ -150,7 +150,7 @@ procs_priv CREATE TABLE `procs_priv` (
|
|||
`Routine_name` char(64) collate utf8_bin NOT NULL default '',
|
||||
`Grantor` char(77) collate utf8_bin NOT NULL default '',
|
||||
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`Proc_priv` set('Execute','Alter Routine','Grant') collate utf8_bin NOT NULL default '',
|
||||
`Proc_priv` set('Execute','Alter Routine','Grant') character set utf8 NOT NULL default '',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
|
||||
|
|
|
@ -515,3 +515,8 @@ SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
|
|||
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
|
||||
Variable_name Value
|
||||
myisam_data_pointer_size 8
|
||||
SET GLOBAL table_cache=-1;
|
||||
SHOW VARIABLES LIKE 'table_cache';
|
||||
Variable_name Value
|
||||
table_cache 1
|
||||
SET GLOBAL table_cache=DEFAULT;
|
||||
|
|
|
@ -68,3 +68,10 @@ SET collation_connection='sjis_japanese_ci';
|
|||
-- source include/ctype_filesort.inc
|
||||
SET collation_connection='sjis_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
|
||||
# Check parsing of string literals in SJIS with multibyte characters that
|
||||
# have an embedded \ in them. (Bug #8303)
|
||||
|
||||
--character_set sjis
|
||||
SET NAMES sjis;
|
||||
SELECT HEX('佐淘 \圭') FROM DUAL;
|
||||
|
|
|
@ -1221,7 +1221,6 @@ show status like "Innodb_buffer_pool_pages_total";
|
|||
show status like "Innodb_page_size";
|
||||
show status like "Innodb_rows_deleted";
|
||||
show status like "Innodb_rows_inserted";
|
||||
show status like "Innodb_rows_read";
|
||||
show status like "Innodb_rows_updated";
|
||||
|
||||
# Test for row locks InnoDB status variables.
|
||||
|
|
|
@ -68,14 +68,15 @@ INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
|
|||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
INSERT t1 VALUES (1,2,10), (3,4,20);
|
||||
CREATE TABLE t2 (x INT, y INT, z INT, d INT);
|
||||
CREATE TABLE t2 (a INT, b INT, c INT, d INT);
|
||||
# column names deliberately clash with columns in t1 (Bug#8147)
|
||||
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
|
||||
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
|
||||
INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
|
||||
INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
|
||||
SELECT * FROM t1;
|
||||
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
|
||||
SELECT * FROM t1;
|
||||
INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
|
||||
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
|
||||
SELECT *, VALUES(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -111,3 +111,20 @@ select * from T1;
|
|||
alter table T1 add index (a);
|
||||
select * from T1;
|
||||
drop table T1;
|
||||
|
||||
#
|
||||
# Bug #8355: Tables not dropped from table cache on drop db
|
||||
#
|
||||
create database mysqltest_LC2;
|
||||
use mysqltest_LC2;
|
||||
create table myUC (i int);
|
||||
insert into myUC values (1),(2),(3);
|
||||
select * from myUC;
|
||||
use test;
|
||||
drop database mysqltest_LC2;
|
||||
create database mysqltest_LC2;
|
||||
use mysqltest_LC2;
|
||||
create table myUC (i int);
|
||||
select * from myUC;
|
||||
use test;
|
||||
drop database mysqltest_LC2;
|
||||
|
|
1
mysql-test/t/lowercase_table_grant-master.opt
Normal file
1
mysql-test/t/lowercase_table_grant-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--lower_case_table_names
|
25
mysql-test/t/lowercase_table_grant.test
Normal file
25
mysql-test/t/lowercase_table_grant.test
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Test of grants when lower_case_table_names is on
|
||||
use mysql;
|
||||
|
||||
# mixed-case database name for testing
|
||||
create database MYSQLtest;
|
||||
|
||||
# check that database name gets forced to lowercase
|
||||
grant all on MySQLtest.* to mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
||||
# now force it to mixed case, but see that it is lowercased in the acl cache
|
||||
select * from db where user = 'mysqltest_1';
|
||||
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
|
||||
flush privileges;
|
||||
show grants for mysqltest_1@localhost;
|
||||
select * from db where user = 'mysqltest_1';
|
||||
|
||||
# clear out the user we created
|
||||
#
|
||||
# can't use REVOKE because of the mixed-case database name
|
||||
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
|
||||
flush privileges;
|
||||
drop user mysqltest_1@localhost;
|
||||
|
||||
drop database MYSQLtest;
|
1
mysql-test/t/skip_name_resolve-master.opt
Normal file
1
mysql-test/t/skip_name_resolve-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--skip-name-resolve
|
5
mysql-test/t/skip_name_resolve.test
Normal file
5
mysql-test/t/skip_name_resolve.test
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Bug #8471: IP address with mask fail when skip-name-resolve is on
|
||||
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
|
||||
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
|
||||
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
|
||||
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
|
|
@ -380,3 +380,11 @@ drop table t1;
|
|||
|
||||
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
|
||||
SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
|
||||
|
||||
#
|
||||
# Bug #6958: negative arguments to integer options wrap around
|
||||
#
|
||||
|
||||
SET GLOBAL table_cache=-1;
|
||||
SHOW VARIABLES LIKE 'table_cache';
|
||||
SET GLOBAL table_cache=DEFAULT;
|
||||
|
|
|
@ -581,6 +581,23 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to,
|
|||
from--;
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
If the next character appears to begin a multi-byte character, we
|
||||
escape that first byte of that apparent multi-byte character. (The
|
||||
character just looks like a multi-byte character -- if it were actually
|
||||
a multi-byte character, it would have been passed through in the test
|
||||
above.)
|
||||
|
||||
Without this check, we can create a problem by converting an invalid
|
||||
multi-byte character into a valid one. For example, 0xbf27 is not
|
||||
a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \)
|
||||
*/
|
||||
if (use_mb_flag && (l= my_mbcharlen(charset_info, *from)) > 1)
|
||||
{
|
||||
*to++= '\\';
|
||||
*to++= *from;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
switch (*from) {
|
||||
case 0: /* Must be escaped for 'mysql' */
|
||||
|
|
|
@ -1246,27 +1246,45 @@ TransporterRegistry::start_clients_thread()
|
|||
if( !connected && t->get_s_port() <= 0) { // Port is dynamic
|
||||
int server_port= 0;
|
||||
struct ndb_mgm_reply mgm_reply;
|
||||
int res= -1;
|
||||
|
||||
if(!ndb_mgm_is_connected(m_mgm_handle))
|
||||
if(ndb_mgm_connect(m_mgm_handle, 0, 0, 0)<0)
|
||||
ndbout_c("Failed to reconnect to management server");
|
||||
ndb_mgm_connect(m_mgm_handle, 0, 0, 0);
|
||||
|
||||
if(ndb_mgm_is_connected(m_mgm_handle))
|
||||
{
|
||||
int res=
|
||||
ndb_mgm_get_connection_int_parameter(m_mgm_handle,
|
||||
t->getRemoteNodeId(),
|
||||
t->getLocalNodeId(),
|
||||
CFG_CONNECTION_SERVER_PORT,
|
||||
&server_port,
|
||||
&mgm_reply);
|
||||
DBUG_PRINT("info",("Got dynamic port %d for %d -> %d (ret: %d)",
|
||||
server_port,t->getRemoteNodeId(),
|
||||
t->getLocalNodeId(),res));
|
||||
if( res >= 0 )
|
||||
{
|
||||
/**
|
||||
* Server_port == 0 just means that that a mgmt server
|
||||
* has not received a new port yet. Keep the old.
|
||||
*/
|
||||
if (server_port)
|
||||
t->set_s_port(server_port);
|
||||
}
|
||||
else
|
||||
res=
|
||||
ndb_mgm_get_connection_int_parameter(m_mgm_handle,
|
||||
t->getRemoteNodeId(),
|
||||
t->getLocalNodeId(),
|
||||
CFG_CONNECTION_SERVER_PORT,
|
||||
&server_port,
|
||||
&mgm_reply);
|
||||
DBUG_PRINT("info",("Got dynamic port %d for %d -> %d (ret: %d)",
|
||||
server_port,t->getRemoteNodeId(),
|
||||
t->getLocalNodeId(),res));
|
||||
|
||||
if(res>=0 && server_port)
|
||||
t->set_s_port(server_port);
|
||||
else
|
||||
ndbout_c("Failed to get dynamic port to connect to: %d", res);
|
||||
{
|
||||
ndbout_c("Failed to get dynamic port to connect to: %d", res);
|
||||
ndb_mgm_disconnect(m_mgm_handle);
|
||||
}
|
||||
}
|
||||
/** else
|
||||
* We will not be able to get a new port unless
|
||||
* the m_mgm_handle is connected. Note that not
|
||||
* being connected is an ok state, just continue
|
||||
* until it is able to connect. Continue using the
|
||||
* old port until we can connect again and get a
|
||||
* new port.
|
||||
*/
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1304,7 +1322,7 @@ TransporterRegistry::stop_clients()
|
|||
if (m_start_clients_thread) {
|
||||
m_run_start_clients_thread= false;
|
||||
void* status;
|
||||
int r= NdbThread_WaitFor(m_start_clients_thread, &status);
|
||||
NdbThread_WaitFor(m_start_clients_thread, &status);
|
||||
NdbThread_Destroy(&m_start_clients_thread);
|
||||
}
|
||||
return true;
|
||||
|
@ -1347,10 +1365,11 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
|
|||
bool
|
||||
TransporterRegistry::start_service(SocketServer& socket_server)
|
||||
{
|
||||
DBUG_ENTER("TransporterRegistry::start_service");
|
||||
if (m_transporter_interface.size() > 0 && !nodeIdSpecified)
|
||||
{
|
||||
ndbout_c("TransporterRegistry::startReceiving: localNodeId not specified");
|
||||
return false;
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
|
||||
for (unsigned i= 0; i < m_transporter_interface.size(); i++)
|
||||
|
@ -1380,14 +1399,14 @@ TransporterRegistry::start_service(SocketServer& socket_server)
|
|||
"(perhaps the node is already running)",
|
||||
t.m_interface ? t.m_interface : "*", t.m_s_service_port);
|
||||
delete transporter_service;
|
||||
return false;
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
}
|
||||
t.m_s_service_port= (t.m_s_service_port<=0)?-port:port; // -`ve if dynamic
|
||||
DBUG_PRINT("info", ("t.m_s_service_port = %d",t.m_s_service_port));
|
||||
transporter_service->setTransporterRegistry(this);
|
||||
}
|
||||
return true;
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
|
||||
#ifdef NDB_SHM_TRANSPORTER
|
||||
|
@ -1439,12 +1458,7 @@ TransporterRegistry::startReceiving()
|
|||
DBUG_PRINT("error",("Install failed"));
|
||||
g_eventLogger.error("Failed to install signal handler for"
|
||||
" SHM transporter errno: %d (%s)", errno,
|
||||
#ifdef HAVE_STRERROR
|
||||
strerror(errno)
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
);
|
||||
strerror(errno));
|
||||
}
|
||||
}
|
||||
#endif // NDB_SHM_TRANSPORTER
|
||||
|
@ -1559,7 +1573,11 @@ NDB_SOCKET_TYPE TransporterRegistry::connect_ndb_mgmd(SocketClient *sc)
|
|||
ndb_mgm_destroy_handle(&h);
|
||||
return NDB_INVALID_SOCKET;
|
||||
}
|
||||
return ndb_mgm_convert_to_transporter(h);
|
||||
|
||||
NDB_SOCKET_TYPE sockfd= ndb_mgm_convert_to_transporter(h);
|
||||
if ( sockfd == NDB_INVALID_SOCKET)
|
||||
ndb_mgm_destroy_handle(&h);
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
template class Vector<TransporterRegistry::Transporter_interface>;
|
||||
|
|
|
@ -123,11 +123,8 @@ SocketServer::setup(SocketServer::Service * service,
|
|||
/* Get the port we bound to */
|
||||
SOCKET_SIZE_TYPE sock_len = sizeof(servaddr);
|
||||
if(getsockname(sock,(struct sockaddr*)&servaddr,&sock_len)<0) {
|
||||
char msg[100];
|
||||
if(!strerror_r(errno,msg,sizeof(msg)))
|
||||
strcpy(msg,"Unknown");
|
||||
ndbout_c("An error occurred while trying to find out what"
|
||||
" port we bound to. Error: %s",msg);
|
||||
" port we bound to. Error: %s",strerror(errno));
|
||||
NDB_CLOSE_SOCKET(sock);
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
|
|
|
@ -1837,12 +1837,8 @@ int Dbtup::interpreterNextLab(Signal* signal,
|
|||
tmpHabitant = attrId;
|
||||
}
|
||||
|
||||
// get type
|
||||
attrId >>= 16;
|
||||
AttributeHeader ah(tmpArea[0]);
|
||||
|
||||
const char* s1 = (char*)&tmpArea[1];
|
||||
const char* s2 = (char*)&TcurrentProgram[TprogramCounter+1];
|
||||
Uint32 attrLen = (4 * ah.getDataSize());
|
||||
Uint32 TattrDescrIndex = tabptr.p->tabDescriptor +
|
||||
(attrId << ZAD_LOG_SIZE);
|
||||
Uint32 TattrDesc1 = tableDescriptor[TattrDescrIndex].tabDescr;
|
||||
|
@ -1855,27 +1851,32 @@ int Dbtup::interpreterNextLab(Signal* signal,
|
|||
cs = tabptr.p->charsetArray[pos];
|
||||
}
|
||||
const NdbSqlUtil::Type& sqlType = NdbSqlUtil::getType(typeId);
|
||||
|
||||
|
||||
// get data
|
||||
AttributeHeader ah(tmpArea[0]);
|
||||
const char* s1 = (char*)&tmpArea[1];
|
||||
const char* s2 = (char*)&TcurrentProgram[TprogramCounter+1];
|
||||
// fixed length in 5.0
|
||||
Uint32 attrLen = AttributeDescriptor::getSizeInBytes(TattrDesc1);
|
||||
|
||||
bool r1_null = ah.isNULL();
|
||||
bool r2_null = argLen == 0;
|
||||
int res;
|
||||
if(r1_null || r2_null)
|
||||
{
|
||||
res = r1_null && r2_null ? 0 : r1_null ? -1 : 1;
|
||||
}
|
||||
else if (cond != Interpreter::LIKE &&
|
||||
cond != Interpreter::NOT_LIKE)
|
||||
{
|
||||
/* --------------------------------------------------------- */
|
||||
// If length of argument rounded to nearest word is
|
||||
// the same as attribute size, use that as argument size
|
||||
/* --------------------------------------------------------- */
|
||||
if ((((argLen + 3) >> 2) << 2) == attrLen) argLen= attrLen;
|
||||
res = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = (*sqlType.m_like)(cs, s1, attrLen, s2, argLen);
|
||||
if (cond != Interpreter::LIKE &&
|
||||
cond != Interpreter::NOT_LIKE) {
|
||||
if (r1_null || r2_null) {
|
||||
// NULL==NULL and NULL<not-NULL
|
||||
res = r1_null && r2_null ? 0 : r1_null ? -1 : 1;
|
||||
} else {
|
||||
res = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true);
|
||||
}
|
||||
} else {
|
||||
if (r1_null || r2_null) {
|
||||
// NULL like NULL is true (has no practical use)
|
||||
res = r1_null && r2_null ? 0 : -1;
|
||||
} else {
|
||||
res = (*sqlType.m_like)(cs, s1, attrLen, s2, argLen);
|
||||
}
|
||||
}
|
||||
|
||||
switch ((Interpreter::BinaryCondition)cond) {
|
||||
|
|
|
@ -2184,8 +2184,8 @@ ndb_mgm_convert_to_transporter(NdbMgmHandle handle)
|
|||
{
|
||||
NDB_SOCKET_TYPE s;
|
||||
|
||||
CHECK_HANDLE(handle, -1);
|
||||
CHECK_CONNECTED(handle, -2);
|
||||
CHECK_HANDLE(handle, NDB_INVALID_SOCKET);
|
||||
CHECK_CONNECTED(handle, NDB_INVALID_SOCKET);
|
||||
|
||||
handle->connected= 0; // we pretend we're disconnected
|
||||
s= handle->socket;
|
||||
|
|
|
@ -1027,13 +1027,15 @@ NdbOperation::branch_col(Uint32 type,
|
|||
}
|
||||
|
||||
Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize;
|
||||
if(len != 0 && len != sizeInBytes)
|
||||
{
|
||||
setErrorCodeAbort(4209);
|
||||
return -1;
|
||||
if (! col->getCharType()) {
|
||||
// prevent assert in NdbSqlUtil on length error
|
||||
if(len != 0 && len != sizeInBytes)
|
||||
{
|
||||
setErrorCodeAbort(4209);
|
||||
return -1;
|
||||
}
|
||||
len = sizeInBytes;
|
||||
}
|
||||
|
||||
len = sizeInBytes;
|
||||
|
||||
if (insertATTRINFO(Interpreter::BranchCol(c, 0, 0, false)) == -1)
|
||||
return -1;
|
||||
|
|
|
@ -55,23 +55,23 @@ then
|
|||
c_d="$c_d Host char(60) binary DEFAULT '' NOT NULL,"
|
||||
c_d="$c_d Db char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_d="$c_d User char(16) binary DEFAULT '' NOT NULL,"
|
||||
c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Alter_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_d="$c_d PRIMARY KEY Host (Host,Db,User),"
|
||||
c_d="$c_d KEY User (User)"
|
||||
c_d="$c_d ) engine=MyISAM"
|
||||
|
@ -91,20 +91,20 @@ then
|
|||
c_h="$c_h CREATE TABLE host ("
|
||||
c_h="$c_h Host char(60) binary DEFAULT '' NOT NULL,"
|
||||
c_h="$c_h Db char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_h="$c_h PRIMARY KEY Host (Host,Db)"
|
||||
c_h="$c_h ) engine=MyISAM"
|
||||
c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin"
|
||||
|
@ -121,32 +121,32 @@ then
|
|||
c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL,"
|
||||
c_u="$c_u User char(16) binary DEFAULT '' NOT NULL,"
|
||||
c_u="$c_u Password char(41) binary DEFAULT '' NOT NULL,"
|
||||
c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Alter_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,"
|
||||
c_u="$c_u Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL,"
|
||||
c_u="$c_u ssl_cipher BLOB NOT NULL,"
|
||||
c_u="$c_u x509_issuer BLOB NOT NULL,"
|
||||
c_u="$c_u x509_subject BLOB NOT NULL,"
|
||||
|
@ -191,7 +191,7 @@ then
|
|||
c_f="$c_f name char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL,"
|
||||
c_f="$c_f dl char(128) DEFAULT '' NOT NULL,"
|
||||
c_f="$c_f type enum ('function','aggregate') NOT NULL,"
|
||||
c_f="$c_f type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL,"
|
||||
c_f="$c_f PRIMARY KEY (name)"
|
||||
c_f="$c_f ) engine=MyISAM"
|
||||
c_f="$c_f CHARACTER SET utf8 COLLATE utf8_bin"
|
||||
|
@ -211,8 +211,8 @@ then
|
|||
c_t="$c_t Table_name char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL,"
|
||||
c_t="$c_t Timestamp timestamp(14),"
|
||||
c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,"
|
||||
c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
|
||||
c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,"
|
||||
c_t="$c_t Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,"
|
||||
c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name),"
|
||||
c_t="$c_t KEY Grantor (Grantor)"
|
||||
c_t="$c_t ) engine=MyISAM"
|
||||
|
@ -233,7 +233,7 @@ then
|
|||
c_c="$c_c Table_name char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_c="$c_c Column_name char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_c="$c_c Timestamp timestamp(14),"
|
||||
c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,"
|
||||
c_c="$c_c Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,"
|
||||
c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)"
|
||||
c_c="$c_c ) engine=MyISAM"
|
||||
c_c="$c_c CHARACTER SET utf8 COLLATE utf8_bin"
|
||||
|
@ -253,7 +253,7 @@ then
|
|||
c_pp="$c_pp Routine_name char(64) binary DEFAULT '' NOT NULL,"
|
||||
c_pp="$c_pp Grantor char(77) DEFAULT '' NOT NULL,"
|
||||
c_pp="$c_pp Timestamp timestamp(14),"
|
||||
c_pp="$c_pp Proc_priv set('Execute','Alter Routine','Grant') DEFAULT '' NOT NULL,"
|
||||
c_pp="$c_pp Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,"
|
||||
c_pp="$c_pp PRIMARY KEY (Host,Db,User,Routine_name),"
|
||||
c_pp="$c_pp KEY Grantor (Grantor)"
|
||||
c_pp="$c_pp ) engine=MyISAM"
|
||||
|
@ -362,7 +362,7 @@ then
|
|||
|
||||
c_tz="$c_tz CREATE TABLE time_zone ("
|
||||
c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment,"
|
||||
c_tz="$c_tz Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,"
|
||||
c_tz="$c_tz Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,"
|
||||
c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)"
|
||||
c_tz="$c_tz ) engine=MyISAM CHARACTER SET utf8"
|
||||
c_tz="$c_tz comment='Time zones';"
|
||||
|
|
|
@ -9,55 +9,23 @@
|
|||
-- this sql script.
|
||||
-- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
|
||||
|
||||
-- Convert all tables to UTF-8 with binary collation
|
||||
-- and reset all char columns to correct width
|
||||
ALTER TABLE user
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
MODIFY Password char(41) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE db
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE host
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE func
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE columns_priv
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
MODIFY Table_name char(64) NOT NULL default '',
|
||||
MODIFY Column_name char(64) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE tables_priv
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
MODIFY Table_name char(64) NOT NULL default '',
|
||||
MODIFY Grantor char(77) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE procs_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE user add File_priv enum('N','Y') NOT NULL;
|
||||
CREATE TABLE IF NOT EXISTS func (
|
||||
name char(64) binary DEFAULT '' NOT NULL,
|
||||
ret tinyint(1) DEFAULT '0' NOT NULL,
|
||||
dl char(128) DEFAULT '' NOT NULL,
|
||||
type enum ('function','aggregate') NOT NULL,
|
||||
type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL,
|
||||
PRIMARY KEY (name)
|
||||
) CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
|
||||
ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
||||
|
||||
-- Detect whether or not we had the Grant_priv column
|
||||
SET @hadGrantPriv:=0;
|
||||
SELECT @hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';
|
||||
|
||||
ALTER TABLE user add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
|
||||
ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
|
||||
ALTER TABLE db add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL;
|
||||
ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
||||
ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
||||
ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
||||
|
||||
--- Fix privileges for old tables
|
||||
UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
||||
|
@ -69,7 +37,7 @@ UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Cr
|
|||
-- Adding columns needed by GRANT .. REQUIRE (openssl)"
|
||||
|
||||
ALTER TABLE user
|
||||
ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL,
|
||||
ADD ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci NOT NULL,
|
||||
ADD ssl_cipher BLOB NOT NULL,
|
||||
ADD x509_issuer BLOB NOT NULL,
|
||||
ADD x509_subject BLOB NOT NULL;
|
||||
|
@ -86,10 +54,17 @@ CREATE TABLE IF NOT EXISTS tables_priv (
|
|||
Table_name char(64) binary DEFAULT '' NOT NULL,
|
||||
Grantor char(77) DEFAULT '' NOT NULL,
|
||||
Timestamp timestamp(14),
|
||||
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,
|
||||
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
|
||||
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (Host,Db,User,Table_name)
|
||||
) CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
-- Fix collation of set fields
|
||||
ALTER TABLE tables_priv
|
||||
modify Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
modify Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
ALTER TABLE procs_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE procs_priv
|
||||
modify Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS columns_priv (
|
||||
Host char(60) DEFAULT '' NOT NULL,
|
||||
|
@ -98,22 +73,25 @@ CREATE TABLE IF NOT EXISTS columns_priv (
|
|||
Table_name char(64) DEFAULT '' NOT NULL,
|
||||
Column_name char(64) DEFAULT '' NOT NULL,
|
||||
Timestamp timestamp(14),
|
||||
Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,
|
||||
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (Host,Db,User,Table_name,Column_name)
|
||||
) CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
-- Fix collation of set fields
|
||||
ALTER TABLE columns_priv
|
||||
MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
|
||||
|
||||
--
|
||||
-- Name change of Type -> Column_priv from MySQL 3.22.12
|
||||
--
|
||||
|
||||
ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL;
|
||||
ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
|
||||
--
|
||||
-- Add the new 'type' column to the func table.
|
||||
--
|
||||
|
||||
ALTER TABLE func add type enum ('function','aggregate') NOT NULL;
|
||||
ALTER TABLE func add type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
|
||||
|
||||
--
|
||||
-- Change the user,db and host tables to MySQL 4.0 format
|
||||
|
@ -124,13 +102,13 @@ SET @hadShowDbPriv:=0;
|
|||
SELECT @hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';
|
||||
|
||||
ALTER TABLE user
|
||||
ADD Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Alter_priv,
|
||||
ADD Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv,
|
||||
ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv,
|
||||
ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,
|
||||
ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
|
||||
ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv,
|
||||
ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;
|
||||
ADD Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_priv,
|
||||
ADD Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_db_priv,
|
||||
ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Super_priv,
|
||||
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,
|
||||
ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
|
||||
ADD Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Execute_priv,
|
||||
ADD Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;
|
||||
|
||||
-- Convert privileges so that users have similar privileges as before
|
||||
|
||||
|
@ -151,11 +129,11 @@ ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates;
|
|||
--
|
||||
|
||||
ALTER TABLE db
|
||||
ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
|
||||
ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
||||
ALTER TABLE host
|
||||
ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
||||
ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
|
||||
ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
||||
|
||||
alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
|
||||
alter table tables_priv add KEY Grantor (Grantor);
|
||||
|
@ -167,6 +145,95 @@ alter table func comment='User defined functions';
|
|||
alter table tables_priv comment='Table privileges';
|
||||
alter table columns_priv comment='Column privileges';
|
||||
|
||||
-- Convert all tables to UTF-8 with binary collation
|
||||
-- and reset all char columns to correct width
|
||||
ALTER TABLE user
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
MODIFY Password char(41) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE user
|
||||
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
ALTER TABLE db
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE db
|
||||
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
||||
ALTER TABLE host
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE host
|
||||
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
||||
ALTER TABLE func
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE func
|
||||
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
|
||||
ALTER TABLE columns_priv
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
MODIFY Table_name char(64) NOT NULL default '',
|
||||
MODIFY Column_name char(64) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE columns_priv
|
||||
MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
ALTER TABLE tables_priv
|
||||
MODIFY Host char(60) NOT NULL default '',
|
||||
MODIFY Db char(64) NOT NULL default '',
|
||||
MODIFY User char(16) NOT NULL default '',
|
||||
MODIFY Table_name char(64) NOT NULL default '',
|
||||
MODIFY Grantor char(77) NOT NULL default '',
|
||||
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
ALTER TABLE tables_priv
|
||||
MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
|
||||
#
|
||||
# Detect whether we had Create_view_priv
|
||||
#
|
||||
|
@ -176,16 +243,16 @@ SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%';
|
|||
#
|
||||
# Create VIEWs privileges (v5.0)
|
||||
#
|
||||
ALTER TABLE db ADD Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
|
||||
ALTER TABLE host ADD Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
|
||||
ALTER TABLE user ADD Create_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
|
||||
ALTER TABLE db ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
|
||||
ALTER TABLE host ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
|
||||
ALTER TABLE user ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
|
||||
|
||||
#
|
||||
# Show VIEWs privileges (v5.0)
|
||||
#
|
||||
ALTER TABLE db ADD Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
||||
ALTER TABLE host ADD Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
||||
ALTER TABLE user ADD Show_view_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
||||
ALTER TABLE db ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
||||
ALTER TABLE host ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
||||
ALTER TABLE user ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
||||
|
||||
#
|
||||
# Assign create/show view privileges to people who have create provileges
|
||||
|
@ -201,16 +268,16 @@ SELECT @hadCreateRoutinePriv:=1 FROM user WHERE Create_routine_priv LIKE '%';
|
|||
#
|
||||
# Create PROCEDUREs privileges (v5.0)
|
||||
#
|
||||
ALTER TABLE db ADD Create_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
||||
ALTER TABLE user ADD Create_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
||||
ALTER TABLE db ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
||||
ALTER TABLE user ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
||||
|
||||
#
|
||||
# Alter PROCEDUREs privileges (v5.0)
|
||||
#
|
||||
ALTER TABLE db ADD Alter_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
||||
ALTER TABLE user ADD Alter_routine_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
||||
ALTER TABLE db ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
||||
ALTER TABLE user ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
||||
|
||||
ALTER TABLE db ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
|
||||
ALTER TABLE db ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
|
||||
|
||||
#
|
||||
# Assign create/alter routine privileges to people who have create privileges
|
||||
|
@ -233,7 +300,7 @@ User char(16) binary DEFAULT '' NOT NULL,
|
|||
Routine_name char(64) binary DEFAULT '' NOT NULL,
|
||||
Grantor char(77) DEFAULT '' NOT NULL,
|
||||
Timestamp timestamp(14),
|
||||
Proc_priv set('Execute','Alter Routine','Grant') DEFAULT '' NOT NULL,
|
||||
Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY (Host,Db,User,Routine_name),
|
||||
KEY Grantor (Grantor)
|
||||
) CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
|
||||
|
@ -282,9 +349,12 @@ PRIMARY KEY Name (Name)
|
|||
|
||||
CREATE TABLE IF NOT EXISTS time_zone (
|
||||
Time_zone_id int unsigned NOT NULL auto_increment,
|
||||
Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,
|
||||
Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
||||
PRIMARY KEY TzId (Time_zone_id)
|
||||
) CHARACTER SET utf8 comment='Time zones';
|
||||
-- Make enum field case-insensitive
|
||||
ALTER TABLE time_zone
|
||||
MODIFY Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS time_zone_transition (
|
||||
Time_zone_id int unsigned NOT NULL,
|
||||
|
|
|
@ -752,7 +752,7 @@ static void cli_flush_use_result(MYSQL *mysql)
|
|||
{
|
||||
if (protocol_41(mysql))
|
||||
{
|
||||
char *pos= (char*) mysql->net.read_pos;
|
||||
char *pos= (char*) mysql->net.read_pos + 1;
|
||||
mysql->warning_count=uint2korr(pos); pos+=2;
|
||||
mysql->server_status=uint2korr(pos); pos+=2;
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ class Item_func_div :public Item_num_op
|
|||
{
|
||||
public:
|
||||
Item_func_div(Item *a,Item *b) :Item_num_op(a,b) {}
|
||||
longlong int_op() { DBUG_ASSERT(0); }
|
||||
longlong int_op() { DBUG_ASSERT(0); return 0; }
|
||||
double real_op();
|
||||
my_decimal *decimal_op(my_decimal *);
|
||||
const char *func_name() const { return "/"; }
|
||||
|
|
|
@ -867,7 +867,7 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name);
|
|||
void close_temporary(TABLE *table, bool delete_table=1);
|
||||
bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db,
|
||||
const char *table_name);
|
||||
void remove_db_from_cache(const my_string db);
|
||||
void remove_db_from_cache(const char *db);
|
||||
void flush_tables();
|
||||
bool remove_table_from_cache(THD *thd, const char *db, const char *table,
|
||||
bool return_if_owned_by_thd=0);
|
||||
|
|
|
@ -1317,6 +1317,12 @@ static void fix_server_id(THD *thd, enum_var_type type)
|
|||
server_id_supplied = 1;
|
||||
}
|
||||
|
||||
bool sys_var_long_ptr::check(THD *thd, set_var *var)
|
||||
{
|
||||
longlong v= var->value->val_int();
|
||||
var->save_result.ulonglong_value= v < 0 ? 0 : v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool sys_var_long_ptr::update(THD *thd, set_var *var)
|
||||
{
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
sys_var_long_ptr(const char *name_arg, ulong *value_ptr,
|
||||
sys_after_update_func func)
|
||||
:sys_var(name_arg,func), value(value_ptr) {}
|
||||
bool check(THD *thd, set_var *var);
|
||||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type);
|
||||
SHOW_TYPE type() { return SHOW_LONG; }
|
||||
|
|
|
@ -141,6 +141,8 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
|||
MYSQL_LOCK *lock;
|
||||
my_bool return_val=1;
|
||||
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
|
||||
char tmp_name[NAME_LEN+1];
|
||||
|
||||
DBUG_ENTER("acl_init");
|
||||
|
||||
if (!acl_cache)
|
||||
|
@ -199,6 +201,24 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
|||
ACL_HOST host;
|
||||
update_hostname(&host.host,get_field(&mem, table->field[0]));
|
||||
host.db= get_field(&mem, table->field[1]);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
/*
|
||||
We make a temporary copy of the database, force it to lower case,
|
||||
and then copy it back over the original name. We can't just update
|
||||
the host.db pointer, because tmp_name is allocated on the stack.
|
||||
*/
|
||||
(void)strmov(tmp_name, host.db);
|
||||
my_casedn_str(files_charset_info, tmp_name);
|
||||
if (strcmp(host.db, tmp_name) != 0)
|
||||
{
|
||||
sql_print_warning("'host' entry '%s|%s' had database in mixed "
|
||||
"case that has been forced to lowercase because "
|
||||
"lower_case_table_names is set.",
|
||||
host.host.hostname, host.db);
|
||||
(void)strmov(host.db, tmp_name);
|
||||
}
|
||||
}
|
||||
host.access= get_access(table,2);
|
||||
host.access= fix_rights_for_db(host.access);
|
||||
host.sort= get_sort(2,host.host.hostname,host.db);
|
||||
|
@ -409,6 +429,24 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
|||
}
|
||||
db.access=get_access(table,3);
|
||||
db.access=fix_rights_for_db(db.access);
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
/*
|
||||
We make a temporary copy of the database, force it to lower case,
|
||||
and then copy it back over the original name. We can't just update
|
||||
the db.db pointer, because tmp_name is allocated on the stack.
|
||||
*/
|
||||
(void)strmov(tmp_name, db.db);
|
||||
my_casedn_str(files_charset_info, tmp_name);
|
||||
if (strcmp(db.db, tmp_name) != 0)
|
||||
{
|
||||
sql_print_warning("'db' entry '%s %s@%s' had database in mixed "
|
||||
"case that has been forced to lowercase because "
|
||||
"lower_case_table_names is set.",
|
||||
db.db, db.user, db.host.hostname, db.host.hostname);
|
||||
(void)strmov(db.db, tmp_name);
|
||||
}
|
||||
}
|
||||
db.sort=get_sort(3,db.host.hostname,db.db,db.user);
|
||||
#ifndef TO_BE_REMOVED
|
||||
if (table->s->fields <= 9)
|
||||
|
@ -1447,7 +1485,7 @@ bool hostname_requires_resolving(const char *hostname)
|
|||
return FALSE;
|
||||
for (; (cur=*hostname); hostname++)
|
||||
{
|
||||
if ((cur != '%') && (cur != '_') && (cur != '.') &&
|
||||
if ((cur != '%') && (cur != '_') && (cur != '.') && (cur != '/') &&
|
||||
((cur < '0') || (cur > '9')))
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -3586,8 +3586,18 @@ static void mysql_rm_tmp_tables(void)
|
|||
** and afterwards delete those marked unused.
|
||||
*/
|
||||
|
||||
void remove_db_from_cache(const my_string db)
|
||||
void remove_db_from_cache(const char *db)
|
||||
{
|
||||
char name_buff[NAME_LEN+1];
|
||||
if (db && lower_case_table_names)
|
||||
{
|
||||
/*
|
||||
convert database to lower case for comparision.
|
||||
*/
|
||||
strmake(name_buff, db, sizeof(name_buff)-1);
|
||||
my_casedn_str(files_charset_info, name_buff);
|
||||
db= name_buff;
|
||||
}
|
||||
for (uint idx=0 ; idx < open_cache.records ; idx++)
|
||||
{
|
||||
TABLE *table=(TABLE*) hash_element(&open_cache,idx);
|
||||
|
|
|
@ -671,6 +671,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
|||
bool insert_into_view= (table_list->view != 0);
|
||||
/* TODO: use this condition for 'WITH CHECK OPTION' */
|
||||
bool res;
|
||||
TABLE_LIST *next_local;
|
||||
DBUG_ENTER("mysql_prepare_insert");
|
||||
DBUG_PRINT("enter", ("table_list 0x%lx, table 0x%lx, view %d",
|
||||
(ulong)table_list, (ulong)table,
|
||||
|
@ -687,6 +688,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
|||
select_insert))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
next_local= table_list->next_local;
|
||||
table_list->next_local= 0;
|
||||
if ((values && check_insert_fields(thd, table_list, fields, *values, 1,
|
||||
!insert_into_view)) ||
|
||||
(values && setup_fields(thd, 0, table_list, *values, 0, 0, 0)) ||
|
||||
|
@ -697,6 +700,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
|
|||
res) ||
|
||||
setup_fields(thd, 0, table_list, update_values, 1, 0, 0))))
|
||||
DBUG_RETURN(TRUE);
|
||||
table_list->next_local= next_local;
|
||||
|
||||
if (!table)
|
||||
table= table_list->table;
|
||||
|
|
|
@ -296,7 +296,18 @@ static char *get_text(LEX *lex)
|
|||
found_escape=1;
|
||||
if (lex->ptr == lex->end_of_query)
|
||||
return 0;
|
||||
yySkip();
|
||||
#ifdef USE_MB
|
||||
int l;
|
||||
if (use_mb(cs) &&
|
||||
(l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr,
|
||||
(const char *)lex->end_of_query))) {
|
||||
lex->ptr += l;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
yySkip();
|
||||
}
|
||||
else if (c == sep)
|
||||
{
|
||||
|
@ -324,6 +335,10 @@ static char *get_text(LEX *lex)
|
|||
else
|
||||
{
|
||||
uchar *to;
|
||||
|
||||
/* Re-use found_escape for tracking state of escapes */
|
||||
found_escape= 0;
|
||||
|
||||
for (to=start ; str != end ; str++)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
|
@ -337,7 +352,8 @@ static char *get_text(LEX *lex)
|
|||
continue;
|
||||
}
|
||||
#endif
|
||||
if (!(lex->thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) &&
|
||||
if (!found_escape &&
|
||||
!(lex->thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) &&
|
||||
*str == '\\' && str+1 != end)
|
||||
{
|
||||
switch(*++str) {
|
||||
|
@ -364,15 +380,20 @@ static char *get_text(LEX *lex)
|
|||
*to++= '\\'; // remember prefix for wildcard
|
||||
/* Fall through */
|
||||
default:
|
||||
*to++ = *str;
|
||||
found_escape= 1;
|
||||
str--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (*str == sep)
|
||||
*to++= *str++; // Two ' or "
|
||||
else if (!found_escape && *str == sep)
|
||||
{
|
||||
found_escape= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*to++ = *str;
|
||||
|
||||
found_escape= 0;
|
||||
}
|
||||
}
|
||||
*to=0;
|
||||
lex->yytoklen=(uint) (to-start);
|
||||
|
|
|
@ -39,17 +39,20 @@
|
|||
# If you want to affect other MySQL variables, you should make your changes
|
||||
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
|
||||
|
||||
# If you change base dir, you must also change datadir
|
||||
|
||||
basedir=
|
||||
datadir=
|
||||
|
||||
# The following variables are only set for letting mysql.server find things.
|
||||
|
||||
# Set some defaults
|
||||
datadir=@localstatedir@
|
||||
pid_file=
|
||||
if test -z "$basedir"
|
||||
then
|
||||
basedir=@prefix@
|
||||
bindir=@bindir@
|
||||
datadir=@localstatedir@
|
||||
else
|
||||
bindir="$basedir/bin"
|
||||
fi
|
||||
|
|
|
@ -12584,6 +12584,54 @@ static void test_bug7990()
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Test mysql_real_escape_string() with gbk charset
|
||||
|
||||
The important part is that 0x27 (') is the second-byte in a invalid
|
||||
two-byte GBK character here. But 0xbf5c is a valid GBK character, so
|
||||
it needs to be escaped as 0x5cbf27
|
||||
*/
|
||||
#define TEST_BUG8378_IN "\xef\xbb\xbf\x27\xbf\x10"
|
||||
#define TEST_BUG8378_OUT "\xef\xbb\x5c\xbf\x5c\x27\x5c\xbf\x10"
|
||||
|
||||
static void test_bug8378()
|
||||
{
|
||||
MYSQL *lmysql;
|
||||
char out[9]; /* strlen(TEST_BUG8378)*2+1 */
|
||||
int len;
|
||||
|
||||
myheader("test_bug8378");
|
||||
|
||||
if (!opt_silent)
|
||||
fprintf(stdout, "\n Establishing a test connection ...");
|
||||
if (!(lmysql= mysql_init(NULL)))
|
||||
{
|
||||
myerror("mysql_init() failed");
|
||||
exit(1);
|
||||
}
|
||||
if (mysql_options(lmysql, MYSQL_SET_CHARSET_NAME, "gbk"))
|
||||
{
|
||||
myerror("mysql_options() failed");
|
||||
exit(1);
|
||||
}
|
||||
if (!(mysql_real_connect(lmysql, opt_host, opt_user,
|
||||
opt_password, current_db, opt_port,
|
||||
opt_unix_socket, 0)))
|
||||
{
|
||||
myerror("connection failed");
|
||||
exit(1);
|
||||
}
|
||||
if (!opt_silent)
|
||||
fprintf(stdout, " OK");
|
||||
|
||||
len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4);
|
||||
|
||||
/* No escaping should have actually happened. */
|
||||
DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0);
|
||||
|
||||
mysql_close(lmysql);
|
||||
}
|
||||
|
||||
/*
|
||||
Read and parse arguments and MySQL options from my.cnf
|
||||
*/
|
||||
|
@ -12804,6 +12852,7 @@ static struct my_tests_st my_tests[]= {
|
|||
{ "test_truncation_option", test_truncation_option },
|
||||
{ "test_bug8330", test_bug8330 },
|
||||
{ "test_bug7990", test_bug7990 },
|
||||
{ "test_bug8378", test_bug8378 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue