mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Merge of mysql-5.1-bugteam into mysql-trunk-merge.
This commit is contained in:
commit
6c15f6718f
34 changed files with 148 additions and 173 deletions
|
@ -3656,7 +3656,7 @@ xmlencode_print(const char *src, uint length)
|
||||||
tee_fputs("NULL", PAGER);
|
tee_fputs("NULL", PAGER);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (const char *p = src; length; *p++, length--)
|
for (const char *p = src; length; p++, length--)
|
||||||
{
|
{
|
||||||
const char *t;
|
const char *t;
|
||||||
if ((t = array_value(xmlmeta, *p)))
|
if ((t = array_value(xmlmeta, *p)))
|
||||||
|
@ -4744,7 +4744,7 @@ static const char* construct_prompt()
|
||||||
struct tm *t = localtime(&lclock);
|
struct tm *t = localtime(&lclock);
|
||||||
|
|
||||||
/* parse thru the settings for the prompt */
|
/* parse thru the settings for the prompt */
|
||||||
for (char *c = current_prompt; *c ; *c++)
|
for (char *c = current_prompt; *c ; c++)
|
||||||
{
|
{
|
||||||
if (*c != PROMPT_CHAR)
|
if (*c != PROMPT_CHAR)
|
||||||
processed_prompt.append(*c);
|
processed_prompt.append(*c);
|
||||||
|
|
|
@ -596,7 +596,10 @@ static int upgrade_already_done(void)
|
||||||
|
|
||||||
my_fclose(in, MYF(0));
|
my_fclose(in, MYF(0));
|
||||||
|
|
||||||
return (strncmp(buf, MYSQL_SERVER_VERSION,
|
if (!res)
|
||||||
|
return 0; /* Could not read from file => not sure */
|
||||||
|
|
||||||
|
return (strncmp(res, MYSQL_SERVER_VERSION,
|
||||||
sizeof(MYSQL_SERVER_VERSION)-1)==0);
|
sizeof(MYSQL_SERVER_VERSION)-1)==0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -857,7 +857,6 @@ static struct message *parse_message_string(struct message *new_message,
|
||||||
static struct errors *parse_error_string(char *str, int er_count)
|
static struct errors *parse_error_string(char *str, int er_count)
|
||||||
{
|
{
|
||||||
struct errors *new_error;
|
struct errors *new_error;
|
||||||
char *start;
|
|
||||||
DBUG_ENTER("parse_error_string");
|
DBUG_ENTER("parse_error_string");
|
||||||
DBUG_PRINT("enter", ("str: %s", str));
|
DBUG_PRINT("enter", ("str: %s", str));
|
||||||
|
|
||||||
|
@ -868,7 +867,6 @@ static struct errors *parse_error_string(char *str, int er_count)
|
||||||
DBUG_RETURN(0); /* OOM: Fatal error */
|
DBUG_RETURN(0); /* OOM: Fatal error */
|
||||||
|
|
||||||
/* getting the error name */
|
/* getting the error name */
|
||||||
start= str;
|
|
||||||
str= skip_delimiters(str);
|
str= skip_delimiters(str);
|
||||||
|
|
||||||
if (!(new_error->er_name= get_word(&str)))
|
if (!(new_error->er_name= get_word(&str)))
|
||||||
|
|
|
@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, SSL& ssl)
|
||||||
else
|
else
|
||||||
hmac(ssl, verify, data, aSz, alert, true);
|
hmac(ssl, verify, data, aSz, alert, true);
|
||||||
|
|
||||||
// read mac and fill
|
// read mac and skip fill
|
||||||
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
|
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
|
||||||
opaque mac[SHA_LEN];
|
opaque mac[SHA_LEN];
|
||||||
input.read(mac, digestSz);
|
input.read(mac, digestSz);
|
||||||
|
|
||||||
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
|
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
|
||||||
int ivExtra = 0;
|
int ivExtra = 0;
|
||||||
opaque fill;
|
|
||||||
|
|
||||||
if (ssl.isTLSv1_1())
|
if (ssl.isTLSv1_1())
|
||||||
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
||||||
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
|
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
|
||||||
aSz - digestSz;
|
aSz - digestSz;
|
||||||
for (int i = 0; i < padSz; i++)
|
input.set_current(input.get_current() + padSz);
|
||||||
fill = input[AUTO];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
|
@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
|
||||||
void Data::Process(input_buffer& input, SSL& ssl)
|
void Data::Process(input_buffer& input, SSL& ssl)
|
||||||
{
|
{
|
||||||
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
|
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
|
||||||
int pad = 0, padByte = 0;
|
int pad = 0, padSz = 0;
|
||||||
int ivExtra = 0;
|
int ivExtra = 0;
|
||||||
|
|
||||||
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
|
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
|
||||||
if (ssl.isTLSv1_1()) // IV
|
if (ssl.isTLSv1_1()) // IV
|
||||||
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
||||||
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
|
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
|
||||||
padByte = 1;
|
padSz = 1;
|
||||||
}
|
}
|
||||||
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
|
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
|
||||||
int dataSz = msgSz - ivExtra - digestSz - pad - padByte;
|
int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
|
||||||
opaque verify[SHA_LEN];
|
opaque verify[SHA_LEN];
|
||||||
|
|
||||||
const byte* rawData = input.get_buffer() + input.get_current();
|
const byte* rawData = input.get_buffer() + input.get_current();
|
||||||
|
@ -1020,14 +1018,10 @@ void Data::Process(input_buffer& input, SSL& ssl)
|
||||||
hmac(ssl, verify, rawData, dataSz, application_data, true);
|
hmac(ssl, verify, rawData, dataSz, application_data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read mac and fill
|
// read mac and skip fill
|
||||||
opaque mac[SHA_LEN];
|
opaque mac[SHA_LEN];
|
||||||
opaque fill;
|
|
||||||
input.read(mac, digestSz);
|
input.read(mac, digestSz);
|
||||||
for (int i = 0; i < pad; i++)
|
input.set_current(input.get_current() + pad + padSz);
|
||||||
fill = input[AUTO];
|
|
||||||
if (padByte)
|
|
||||||
fill = input[AUTO];
|
|
||||||
|
|
||||||
// verify
|
// verify
|
||||||
if (dataSz) {
|
if (dataSz) {
|
||||||
|
@ -2073,11 +2067,9 @@ void Finished::Process(input_buffer& input, SSL& ssl)
|
||||||
if (ssl.isTLSv1_1())
|
if (ssl.isTLSv1_1())
|
||||||
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
||||||
|
|
||||||
opaque fill;
|
|
||||||
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
|
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
|
||||||
HANDSHAKE_HEADER - finishedSz - digestSz;
|
HANDSHAKE_HEADER - finishedSz - digestSz;
|
||||||
for (int i = 0; i < padSz; i++)
|
input.set_current(input.get_current() + padSz);
|
||||||
fill = input[AUTO];
|
|
||||||
|
|
||||||
// verify mac
|
// verify mac
|
||||||
if (memcmp(mac, verifyMAC, digestSz)) {
|
if (memcmp(mac, verifyMAC, digestSz)) {
|
||||||
|
|
|
@ -255,14 +255,13 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
|
||||||
we want to make sure that no such flags are set.
|
we want to make sure that no such flags are set.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
|
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
|
||||||
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
|
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \
|
||||||
DBUG_ASSERT((A) != 0); \
|
DBUG_ASSERT((A) != 0); \
|
||||||
sigemptyset(&l_set); \
|
sigemptyset(&l_set); \
|
||||||
l_s.sa_handler = (B); \
|
l_s.sa_handler = (B); \
|
||||||
l_s.sa_mask = l_set; \
|
l_s.sa_mask = l_set; \
|
||||||
l_s.sa_flags = 0; \
|
l_s.sa_flags = 0; \
|
||||||
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
|
sigaction((A), &l_s, NULL); \
|
||||||
DBUG_ASSERT(l_rc == 0); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
||||||
#define my_sigset(A,B) sigset((A),(B))
|
#define my_sigset(A,B) sigset((A),(B))
|
||||||
|
|
|
@ -63,7 +63,9 @@ extern const char *globerrs[]; /* my_error_messages is here */
|
||||||
#define EE_UNKNOWN_COLLATION 28
|
#define EE_UNKNOWN_COLLATION 28
|
||||||
#define EE_FILENOTFOUND 29
|
#define EE_FILENOTFOUND 29
|
||||||
#define EE_FILE_NOT_CLOSED 30
|
#define EE_FILE_NOT_CLOSED 30
|
||||||
#define EE_ERROR_LAST 30 /* Copy last error nr */
|
#define EE_CHANGE_OWNERSHIP 31
|
||||||
|
#define EE_CHANGE_PERMISSIONS 32
|
||||||
|
#define EE_ERROR_LAST 32 /* Copy last error nr */
|
||||||
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
|
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
|
||||||
|
|
||||||
/* exit codes for all MySQL programs */
|
/* exit codes for all MySQL programs */
|
||||||
|
|
|
@ -49,7 +49,9 @@ const char *globerrs[GLOBERRS]=
|
||||||
"Can't sync file '%s' to disk (Errcode: %d)",
|
"Can't sync file '%s' to disk (Errcode: %d)",
|
||||||
"Collation '%s' is not a compiled collation and is not specified in the '%s' file",
|
"Collation '%s' is not a compiled collation and is not specified in the '%s' file",
|
||||||
"File '%s' not found (Errcode: %d)",
|
"File '%s' not found (Errcode: %d)",
|
||||||
"File '%s' (fileno: %d) was not closed"
|
"File '%s' (fileno: %d) was not closed",
|
||||||
|
"Can't change ownership of the file '%s' (Errcode: %d)",
|
||||||
|
"Can't change permissions of the file '%s' (Errcode: %d)",
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_glob_errs(void)
|
void init_glob_errs(void)
|
||||||
|
@ -90,6 +92,8 @@ void init_glob_errs()
|
||||||
EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file";
|
EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file";
|
||||||
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
||||||
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
|
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
|
||||||
|
EE(EE_CHANGE_OWNERSHIP) = "Can't change ownership of the file '%s' (Errcode: %d)";
|
||||||
|
EE(EE_CHANGE_PERMISSIONS) = "Can't change permissions of the file '%s' (Errcode: %d)";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1703,16 +1703,19 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
|
int my_b_flush_io_cache(IO_CACHE *info,
|
||||||
|
int need_append_buffer_lock __attribute__((unused)))
|
||||||
{
|
{
|
||||||
size_t length;
|
size_t length;
|
||||||
my_bool append_cache;
|
|
||||||
my_off_t pos_in_file;
|
my_off_t pos_in_file;
|
||||||
|
my_bool append_cache= (info->type == SEQ_READ_APPEND);
|
||||||
DBUG_ENTER("my_b_flush_io_cache");
|
DBUG_ENTER("my_b_flush_io_cache");
|
||||||
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
|
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
|
||||||
|
|
||||||
if (!(append_cache = (info->type == SEQ_READ_APPEND)))
|
#ifdef THREAD
|
||||||
need_append_buffer_lock=0;
|
if (!append_cache)
|
||||||
|
need_append_buffer_lock= 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (info->type == WRITE_CACHE || append_cache)
|
if (info->type == WRITE_CACHE || append_cache)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
#include <my_dir.h> /* for stat */
|
#include <my_dir.h> /* for stat */
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
|
#include "mysys_err.h"
|
||||||
#if defined(HAVE_UTIME_H)
|
#if defined(HAVE_UTIME_H)
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#elif defined(HAVE_SYS_UTIME_H)
|
#elif defined(HAVE_SYS_UTIME_H)
|
||||||
|
@ -56,7 +57,6 @@ int my_copy(const char *from, const char *to, myf MyFlags)
|
||||||
File from_file,to_file;
|
File from_file,to_file;
|
||||||
uchar buff[IO_SIZE];
|
uchar buff[IO_SIZE];
|
||||||
MY_STAT stat_buff,new_stat_buff;
|
MY_STAT stat_buff,new_stat_buff;
|
||||||
int res;
|
|
||||||
DBUG_ENTER("my_copy");
|
DBUG_ENTER("my_copy");
|
||||||
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
|
DBUG_PRINT("my",("from %s to %s MyFlags %d", from, to, MyFlags));
|
||||||
|
|
||||||
|
@ -102,9 +102,23 @@ int my_copy(const char *from, const char *to, myf MyFlags)
|
||||||
|
|
||||||
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
|
if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat)
|
||||||
DBUG_RETURN(0); /* File copyed but not stat */
|
DBUG_RETURN(0); /* File copyed but not stat */
|
||||||
res= chmod(to, stat_buff.st_mode & 07777); /* Copy modes */
|
/* Copy modes */
|
||||||
|
if (chmod(to, stat_buff.st_mode & 07777))
|
||||||
|
{
|
||||||
|
my_errno= errno;
|
||||||
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
|
my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
#if !defined(__WIN__)
|
#if !defined(__WIN__)
|
||||||
res= chown(to, stat_buff.st_uid,stat_buff.st_gid); /* Copy ownership */
|
/* Copy ownership */
|
||||||
|
if (chown(to, stat_buff.st_uid, stat_buff.st_gid))
|
||||||
|
{
|
||||||
|
my_errno= errno;
|
||||||
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
|
my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (MyFlags & MY_COPYTIME)
|
if (MyFlags & MY_COPYTIME)
|
||||||
|
|
|
@ -76,11 +76,8 @@ end:
|
||||||
int my_copystat(const char *from, const char *to, int MyFlags)
|
int my_copystat(const char *from, const char *to, int MyFlags)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
#if !defined(__WIN__)
|
|
||||||
int res;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (stat((char*) from, &statbuf))
|
if (stat(from, &statbuf))
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_FAE+MY_WME))
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
|
@ -89,7 +86,15 @@ int my_copystat(const char *from, const char *to, int MyFlags)
|
||||||
}
|
}
|
||||||
if ((statbuf.st_mode & S_IFMT) != S_IFREG)
|
if ((statbuf.st_mode & S_IFMT) != S_IFREG)
|
||||||
return 1;
|
return 1;
|
||||||
(void) chmod(to, statbuf.st_mode & 07777); /* Copy modes */
|
|
||||||
|
/* Copy modes */
|
||||||
|
if (chmod(to, statbuf.st_mode & 07777))
|
||||||
|
{
|
||||||
|
my_errno= errno;
|
||||||
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
|
my_error(EE_CHANGE_PERMISSIONS, MYF(ME_BELL+ME_WAITTANG), from, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(__WIN__)
|
#if !defined(__WIN__)
|
||||||
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
|
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
|
||||||
|
@ -97,7 +102,14 @@ int my_copystat(const char *from, const char *to, int MyFlags)
|
||||||
if (MyFlags & MY_LINK_WARNING)
|
if (MyFlags & MY_LINK_WARNING)
|
||||||
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
|
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
|
||||||
}
|
}
|
||||||
res= chown(to, statbuf.st_uid, statbuf.st_gid); /* Copy ownership */
|
/* Copy ownership */
|
||||||
|
if (chown(to, statbuf.st_uid, statbuf.st_gid))
|
||||||
|
{
|
||||||
|
my_errno= errno;
|
||||||
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
|
my_error(EE_CHANGE_OWNERSHIP, MYF(ME_BELL+ME_WAITTANG), from, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
#endif /* !__WIN__ */
|
#endif /* !__WIN__ */
|
||||||
|
|
||||||
if (MyFlags & MY_COPYTIME)
|
if (MyFlags & MY_COPYTIME)
|
||||||
|
|
|
@ -256,7 +256,6 @@ sopno stopst;
|
||||||
register char *ssp; /* start of string matched by subsubRE */
|
register char *ssp; /* start of string matched by subsubRE */
|
||||||
register char *sep; /* end of string matched by subsubRE */
|
register char *sep; /* end of string matched by subsubRE */
|
||||||
register char *oldssp; /* previous ssp */
|
register char *oldssp; /* previous ssp */
|
||||||
register char *dp; /* used in debug mode to check asserts */
|
|
||||||
|
|
||||||
AT("diss", start, stop, startst, stopst);
|
AT("diss", start, stop, startst, stopst);
|
||||||
sp = start;
|
sp = start;
|
||||||
|
@ -314,11 +313,9 @@ sopno stopst;
|
||||||
ssub = ss + 1;
|
ssub = ss + 1;
|
||||||
esub = es - 1;
|
esub = es - 1;
|
||||||
/* did innards match? */
|
/* did innards match? */
|
||||||
if (slow(charset, m, sp, rest, ssub, esub) != NULL) {
|
if (slow(charset, m, sp, rest, ssub, esub) != NULL)
|
||||||
dp = dissect(charset, m, sp, rest, ssub, esub);
|
sp = dissect(charset, m, sp, rest, ssub, esub);
|
||||||
assert(dp == rest);
|
assert(sp == rest);
|
||||||
} else /* no */
|
|
||||||
assert(sp == rest);
|
|
||||||
sp = rest;
|
sp = rest;
|
||||||
break;
|
break;
|
||||||
case OPLUS_:
|
case OPLUS_:
|
||||||
|
@ -353,8 +350,8 @@ sopno stopst;
|
||||||
}
|
}
|
||||||
assert(sep == rest); /* must exhaust substring */
|
assert(sep == rest); /* must exhaust substring */
|
||||||
assert(slow(charset, m, ssp, sep, ssub, esub) == rest);
|
assert(slow(charset, m, ssp, sep, ssub, esub) == rest);
|
||||||
dp = dissect(charset, m, ssp, sep, ssub, esub);
|
sp = dissect(charset, m, ssp, sep, ssub, esub);
|
||||||
assert(dp == sep);
|
assert(sp == sep);
|
||||||
sp = rest;
|
sp = rest;
|
||||||
break;
|
break;
|
||||||
case OCH_:
|
case OCH_:
|
||||||
|
@ -388,8 +385,8 @@ sopno stopst;
|
||||||
else
|
else
|
||||||
assert(OP(m->g->strip[esub]) == O_CH);
|
assert(OP(m->g->strip[esub]) == O_CH);
|
||||||
}
|
}
|
||||||
dp = dissect(charset, m, sp, rest, ssub, esub);
|
sp = dissect(charset, m, sp, rest, ssub, esub);
|
||||||
assert(dp == rest);
|
assert(sp == rest);
|
||||||
sp = rest;
|
sp = rest;
|
||||||
break;
|
break;
|
||||||
case O_PLUS:
|
case O_PLUS:
|
||||||
|
|
|
@ -5501,7 +5501,6 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
||||||
int Field_date::store(double nr)
|
int Field_date::store(double nr)
|
||||||
{
|
{
|
||||||
longlong tmp;
|
longlong tmp;
|
||||||
int error= 0;
|
|
||||||
if (nr >= 19000000000000.0 && nr <= 99991231235959.0)
|
if (nr >= 19000000000000.0 && nr <= 99991231235959.0)
|
||||||
nr=floor(nr/1000000.0); // Timestamp to date
|
nr=floor(nr/1000000.0); // Timestamp to date
|
||||||
if (nr < 0.0 || nr > 99991231.0)
|
if (nr < 0.0 || nr > 99991231.0)
|
||||||
|
@ -5510,7 +5509,6 @@ int Field_date::store(double nr)
|
||||||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARN_DATA_OUT_OF_RANGE,
|
ER_WARN_DATA_OUT_OF_RANGE,
|
||||||
nr, MYSQL_TIMESTAMP_DATE);
|
nr, MYSQL_TIMESTAMP_DATE);
|
||||||
error= 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tmp= (longlong) rint(nr);
|
tmp= (longlong) rint(nr);
|
||||||
|
|
|
@ -301,11 +301,10 @@ my_decimal *Item::val_decimal_from_int(my_decimal *decimal_value)
|
||||||
my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
|
my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
|
||||||
{
|
{
|
||||||
String *res;
|
String *res;
|
||||||
char *end_ptr;
|
|
||||||
if (!(res= val_str(&str_value)))
|
|
||||||
return 0; // NULL or EOM
|
|
||||||
|
|
||||||
end_ptr= (char*) res->ptr()+ res->length();
|
if (!(res= val_str(&str_value)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
|
if (str2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
|
||||||
res->ptr(), res->length(), res->charset(),
|
res->ptr(), res->length(), res->charset(),
|
||||||
decimal_value) & E_DEC_BAD_NUM)
|
decimal_value) & E_DEC_BAD_NUM)
|
||||||
|
|
73
sql/log.cc
73
sql/log.cc
|
@ -5447,6 +5447,22 @@ void sql_perror(const char *message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Unfortunately, there seems to be no good way
|
||||||
|
to restore the original streams upon failure.
|
||||||
|
*/
|
||||||
|
static bool redirect_std_streams(const char *file)
|
||||||
|
{
|
||||||
|
if (freopen(file, "a+", stdout) && freopen(file, "a+", stderr))
|
||||||
|
{
|
||||||
|
setbuf(stderr, NULL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool flush_error_log()
|
bool flush_error_log()
|
||||||
{
|
{
|
||||||
bool result=0;
|
bool result=0;
|
||||||
|
@ -5474,11 +5490,7 @@ bool flush_error_log()
|
||||||
setbuf(stderr, NULL);
|
setbuf(stderr, NULL);
|
||||||
my_delete(err_renamed, MYF(0));
|
my_delete(err_renamed, MYF(0));
|
||||||
my_rename(log_error_file, err_renamed, MYF(0));
|
my_rename(log_error_file, err_renamed, MYF(0));
|
||||||
if (freopen(log_error_file,"a+",stdout))
|
redirect_std_streams(log_error_file);
|
||||||
{
|
|
||||||
freopen(log_error_file,"a+",stderr);
|
|
||||||
setbuf(stderr, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((fd= my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
|
if ((fd= my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
|
||||||
{
|
{
|
||||||
|
@ -5493,13 +5505,7 @@ bool flush_error_log()
|
||||||
result= 1;
|
result= 1;
|
||||||
#else
|
#else
|
||||||
my_rename(log_error_file, err_renamed, MYF(0));
|
my_rename(log_error_file, err_renamed, MYF(0));
|
||||||
if (freopen(log_error_file,"a+",stdout))
|
if (redirect_std_streams(log_error_file))
|
||||||
{
|
|
||||||
FILE *reopen;
|
|
||||||
reopen= freopen(log_error_file,"a+",stderr);
|
|
||||||
setbuf(stderr, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result= 1;
|
result= 1;
|
||||||
#endif
|
#endif
|
||||||
mysql_mutex_unlock(&LOCK_error_log);
|
mysql_mutex_unlock(&LOCK_error_log);
|
||||||
|
@ -5551,25 +5557,9 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Prints a printf style message to the error log and, under NT, to the
|
|
||||||
Windows event log.
|
|
||||||
|
|
||||||
This function prints the message into a buffer and then sends that buffer
|
|
||||||
to other functions to write that message to other logging sources.
|
|
||||||
|
|
||||||
@param event_type Type of event to write (Error, Warning, or Info)
|
|
||||||
@param format Printf style format of message
|
|
||||||
@param args va_list list of arguments for the message
|
|
||||||
|
|
||||||
@returns
|
|
||||||
The function always returns 0. The return value is present in the
|
|
||||||
signature to be compatible with other logging routines, which could
|
|
||||||
return an error (e.g. logging to the log tables)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
static void print_buffer_to_file(enum loglevel level, const char *buffer,
|
||||||
|
size_t length)
|
||||||
{
|
{
|
||||||
time_t skr;
|
time_t skr;
|
||||||
struct tm tm_tmp;
|
struct tm tm_tmp;
|
||||||
|
@ -5583,7 +5573,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
||||||
localtime_r(&skr, &tm_tmp);
|
localtime_r(&skr, &tm_tmp);
|
||||||
start=&tm_tmp;
|
start=&tm_tmp;
|
||||||
|
|
||||||
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
|
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s\n",
|
||||||
start->tm_year % 100,
|
start->tm_year % 100,
|
||||||
start->tm_mon+1,
|
start->tm_mon+1,
|
||||||
start->tm_mday,
|
start->tm_mday,
|
||||||
|
@ -5592,7 +5582,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
||||||
start->tm_sec,
|
start->tm_sec,
|
||||||
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||||
"Warning" : "Note"),
|
"Warning" : "Note"),
|
||||||
buffer);
|
(int) length, buffer);
|
||||||
|
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
|
@ -5600,7 +5590,22 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prints a printf style message to the error log and, under NT, to the
|
||||||
|
Windows event log.
|
||||||
|
|
||||||
|
This function prints the message into a buffer and then sends that buffer
|
||||||
|
to other functions to write that message to other logging sources.
|
||||||
|
|
||||||
|
@param level The level of the msg significance
|
||||||
|
@param format Printf style format of message
|
||||||
|
@param args va_list list of arguments for the message
|
||||||
|
|
||||||
|
@returns
|
||||||
|
The function always returns 0. The return value is present in the
|
||||||
|
signature to be compatible with other logging routines, which could
|
||||||
|
return an error (e.g. logging to the log tables)
|
||||||
|
*/
|
||||||
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
|
@ -5608,7 +5613,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
||||||
DBUG_ENTER("vprint_msg_to_log");
|
DBUG_ENTER("vprint_msg_to_log");
|
||||||
|
|
||||||
length= my_vsnprintf(buff, sizeof(buff), format, args);
|
length= my_vsnprintf(buff, sizeof(buff), format, args);
|
||||||
print_buffer_to_file(level, buff);
|
print_buffer_to_file(level, buff, length);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff));
|
print_buffer_to_nt_eventlog(level, buff, length, sizeof(buff));
|
||||||
|
@ -5616,7 +5621,7 @@ int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
#endif /*EMBEDDED_LIBRARY*/
|
#endif /* EMBEDDED_LIBRARY */
|
||||||
|
|
||||||
|
|
||||||
void sql_print_error(const char *format, ...)
|
void sql_print_error(const char *format, ...)
|
||||||
|
|
|
@ -3720,7 +3720,6 @@ static void end_ssl()
|
||||||
|
|
||||||
static int init_server_components()
|
static int init_server_components()
|
||||||
{
|
{
|
||||||
FILE *reopen;
|
|
||||||
DBUG_ENTER("init_server_components");
|
DBUG_ENTER("init_server_components");
|
||||||
/*
|
/*
|
||||||
We need to call each of these following functions to ensure that
|
We need to call each of these following functions to ensure that
|
||||||
|
@ -3768,8 +3767,8 @@ static int init_server_components()
|
||||||
if (freopen(log_error_file, "a+", stdout))
|
if (freopen(log_error_file, "a+", stdout))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
reopen= freopen(log_error_file, "a+", stderr);
|
if (freopen(log_error_file, "a+", stderr))
|
||||||
setbuf(stderr, NULL);
|
setbuf(stderr, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6984,7 +6983,7 @@ mysqld_get_one_option(int optid,
|
||||||
*val= 0;
|
*val= 0;
|
||||||
val+= 2;
|
val+= 2;
|
||||||
while (*val && my_isspace(mysqld_charset, *val))
|
while (*val && my_isspace(mysqld_charset, *val))
|
||||||
*val++;
|
val++;
|
||||||
if (!*val)
|
if (!*val)
|
||||||
{
|
{
|
||||||
sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!\n");
|
sql_print_error("Bad syntax in replicate-rewrite-db - empty TO db!\n");
|
||||||
|
|
|
@ -1535,13 +1535,11 @@ bool partition_info::set_up_charset_field_preps()
|
||||||
i= 0;
|
i= 0;
|
||||||
while ((field= *(ptr++)))
|
while ((field= *(ptr++)))
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs;
|
|
||||||
uchar *field_buf;
|
uchar *field_buf;
|
||||||
LINT_INIT(field_buf);
|
LINT_INIT(field_buf);
|
||||||
|
|
||||||
if (!field_is_partition_charset(field))
|
if (!field_is_partition_charset(field))
|
||||||
continue;
|
continue;
|
||||||
cs= ((Field_str*)field)->charset();
|
|
||||||
size= field->pack_length();
|
size= field->pack_length();
|
||||||
if (!(field_buf= (uchar*) sql_calloc(size)))
|
if (!(field_buf= (uchar*) sql_calloc(size)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -3275,11 +3275,8 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
|
||||||
mysql_mutex_lock(&rli->data_lock);
|
mysql_mutex_lock(&rli->data_lock);
|
||||||
if (rli->slave_skip_counter)
|
if (rli->slave_skip_counter)
|
||||||
{
|
{
|
||||||
char *pos;
|
strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
|
||||||
pos= strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
|
strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
|
||||||
pos= '\0';
|
|
||||||
pos= strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
|
|
||||||
pos= '\0';
|
|
||||||
saved_log_pos= rli->group_relay_log_pos;
|
saved_log_pos= rli->group_relay_log_pos;
|
||||||
saved_master_log_pos= rli->group_master_log_pos;
|
saved_master_log_pos= rli->group_master_log_pos;
|
||||||
saved_skip= rli->slave_skip_counter;
|
saved_skip= rli->slave_skip_counter;
|
||||||
|
|
|
@ -142,11 +142,10 @@ Geometry *Geometry::construct(Geometry_buffer *buffer,
|
||||||
{
|
{
|
||||||
uint32 geom_type;
|
uint32 geom_type;
|
||||||
Geometry *result;
|
Geometry *result;
|
||||||
char byte_order;
|
|
||||||
|
|
||||||
if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4)
|
if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4)
|
||||||
return NULL;
|
return NULL;
|
||||||
byte_order= data[SRID_SIZE];
|
/* + 1 to skip the byte order (stored in position SRID_SIZE). */
|
||||||
geom_type= uint4korr(data + SRID_SIZE + 1);
|
geom_type= uint4korr(data + SRID_SIZE + 1);
|
||||||
if (!(result= create_by_typeid(buffer, (int) geom_type)))
|
if (!(result= create_by_typeid(buffer, (int) geom_type)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -5831,7 +5831,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
String wrong_users;
|
String wrong_users;
|
||||||
ulong sql_mode;
|
|
||||||
LEX_USER *user_name, *tmp_user_name;
|
LEX_USER *user_name, *tmp_user_name;
|
||||||
List_iterator <LEX_USER> user_list(list);
|
List_iterator <LEX_USER> user_list(list);
|
||||||
TABLE_LIST tables[GRANT_TABLES];
|
TABLE_LIST tables[GRANT_TABLES];
|
||||||
|
@ -5880,7 +5879,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
||||||
}
|
}
|
||||||
|
|
||||||
some_users_created= TRUE;
|
some_users_created= TRUE;
|
||||||
sql_mode= thd->variables.sql_mode;
|
|
||||||
if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0))
|
if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0))
|
||||||
{
|
{
|
||||||
append_user(&wrong_users, user_name);
|
append_user(&wrong_users, user_name);
|
||||||
|
|
|
@ -5820,7 +5820,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
|
||||||
DBUG_ENTER("update_field_dependencies");
|
DBUG_ENTER("update_field_dependencies");
|
||||||
if (thd->mark_used_columns != MARK_COLUMNS_NONE)
|
if (thd->mark_used_columns != MARK_COLUMNS_NONE)
|
||||||
{
|
{
|
||||||
MY_BITMAP *current_bitmap, *other_bitmap;
|
MY_BITMAP *bitmap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We always want to register the used keys, as the column bitmap may have
|
We always want to register the used keys, as the column bitmap may have
|
||||||
|
@ -5831,15 +5831,9 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
|
||||||
table->merge_keys.merge(field->part_of_key);
|
table->merge_keys.merge(field->part_of_key);
|
||||||
|
|
||||||
if (thd->mark_used_columns == MARK_COLUMNS_READ)
|
if (thd->mark_used_columns == MARK_COLUMNS_READ)
|
||||||
{
|
bitmap= table->read_set;
|
||||||
current_bitmap= table->read_set;
|
|
||||||
other_bitmap= table->write_set;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
bitmap= table->write_set;
|
||||||
current_bitmap= table->write_set;
|
|
||||||
other_bitmap= table->read_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The test-and-set mechanism in the bitmap is not reliable during
|
The test-and-set mechanism in the bitmap is not reliable during
|
||||||
|
@ -5848,7 +5842,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
|
||||||
only those columns that are used in the SET clause. I.e they are being
|
only those columns that are used in the SET clause. I.e they are being
|
||||||
set here. See multi_update::prepare()
|
set here. See multi_update::prepare()
|
||||||
*/
|
*/
|
||||||
if (bitmap_fast_test_and_set(current_bitmap, field->field_index))
|
if (bitmap_fast_test_and_set(bitmap, field->field_index))
|
||||||
{
|
{
|
||||||
if (thd->mark_used_columns == MARK_COLUMNS_WRITE)
|
if (thd->mark_used_columns == MARK_COLUMNS_WRITE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -175,6 +175,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||||
bool is_fifo=0;
|
bool is_fifo=0;
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
LOAD_FILE_INFO lf_info;
|
LOAD_FILE_INFO lf_info;
|
||||||
|
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||||
#endif
|
#endif
|
||||||
char *db = table_list->db; // This is never null
|
char *db = table_list->db; // This is never null
|
||||||
/*
|
/*
|
||||||
|
@ -186,7 +187,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||||
ulong skip_lines= ex->skip_lines;
|
ulong skip_lines= ex->skip_lines;
|
||||||
bool transactional_table;
|
bool transactional_table;
|
||||||
bool is_concurrent;
|
bool is_concurrent;
|
||||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
|
||||||
DBUG_ENTER("mysql_load");
|
DBUG_ENTER("mysql_load");
|
||||||
|
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
|
@ -510,7 +510,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||||
error=1;
|
error=1;
|
||||||
thd->killed= THD::KILL_QUERY;
|
thd->killed= THD::KILL_QUERY;
|
||||||
};);
|
};);
|
||||||
killed_status= (error == 0)? THD::NOT_KILLED : thd->killed;
|
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
killed_status= (error == 0) ? THD::NOT_KILLED : thd->killed;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We must invalidate the table in query cache before binlog writing and
|
We must invalidate the table in query cache before binlog writing and
|
||||||
ha_autocommit_...
|
ha_autocommit_...
|
||||||
|
@ -553,7 +557,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
||||||
if (lf_info.wrote_create_file)
|
if (lf_info.wrote_create_file)
|
||||||
{
|
{
|
||||||
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
|
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
|
||||||
|
|
||||||
/* since there is already an error, the possible error of
|
/* since there is already an error, the possible error of
|
||||||
writing binary log will be ignored */
|
writing binary log will be ignored */
|
||||||
if (thd->transaction.stmt.modified_non_trans_table)
|
if (thd->transaction.stmt.modified_non_trans_table)
|
||||||
|
@ -767,12 +771,9 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
||||||
List_iterator_fast<Item> it(fields_vars);
|
List_iterator_fast<Item> it(fields_vars);
|
||||||
Item_field *sql_field;
|
Item_field *sql_field;
|
||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
ulonglong id;
|
|
||||||
bool err;
|
bool err;
|
||||||
DBUG_ENTER("read_fixed_length");
|
DBUG_ENTER("read_fixed_length");
|
||||||
|
|
||||||
id= 0;
|
|
||||||
|
|
||||||
while (!read_info.read_fixed_length())
|
while (!read_info.read_fixed_length())
|
||||||
{
|
{
|
||||||
if (thd->killed)
|
if (thd->killed)
|
||||||
|
@ -901,12 +902,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
||||||
Item *item;
|
Item *item;
|
||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
uint enclosed_length;
|
uint enclosed_length;
|
||||||
ulonglong id;
|
|
||||||
bool err;
|
bool err;
|
||||||
DBUG_ENTER("read_sep_field");
|
DBUG_ENTER("read_sep_field");
|
||||||
|
|
||||||
enclosed_length=enclosed.length();
|
enclosed_length=enclosed.length();
|
||||||
id= 0;
|
|
||||||
|
|
||||||
for (;;it.rewind())
|
for (;;it.rewind())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1387,7 +1387,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||||
{
|
{
|
||||||
STATUS_VAR current_global_status_var;
|
STATUS_VAR current_global_status_var;
|
||||||
ulong uptime;
|
ulong uptime;
|
||||||
uint length;
|
uint length __attribute__((unused));
|
||||||
ulonglong queries_per_second1000;
|
ulonglong queries_per_second1000;
|
||||||
char buff[250];
|
char buff[250];
|
||||||
uint buff_len= sizeof(buff);
|
uint buff_len= sizeof(buff);
|
||||||
|
@ -1400,7 +1400,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||||
else
|
else
|
||||||
queries_per_second1000= thd->query_id * LL(1000) / uptime;
|
queries_per_second1000= thd->query_id * LL(1000) / uptime;
|
||||||
|
|
||||||
length= my_snprintf((char*) buff, buff_len - 1,
|
length= my_snprintf(buff, buff_len - 1,
|
||||||
"Uptime: %lu Threads: %d Questions: %lu "
|
"Uptime: %lu Threads: %d Questions: %lu "
|
||||||
"Slow queries: %lu Opens: %lu Flush tables: %lu "
|
"Slow queries: %lu Opens: %lu Flush tables: %lu "
|
||||||
"Open tables: %u Queries per second avg: %u.%u",
|
"Open tables: %u Queries per second avg: %u.%u",
|
||||||
|
@ -1525,7 +1525,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||||
#endif
|
#endif
|
||||||
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
|
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
|
||||||
{
|
{
|
||||||
int res;
|
int res __attribute__((unused));
|
||||||
res= (int) thd->is_error();
|
res= (int) thd->is_error();
|
||||||
if (command == COM_QUERY)
|
if (command == COM_QUERY)
|
||||||
{
|
{
|
||||||
|
@ -5826,7 +5826,7 @@ void mysql_init_multi_delete(LEX *lex)
|
||||||
void mysql_parse(THD *thd, const char *inBuf, uint length,
|
void mysql_parse(THD *thd, const char *inBuf, uint length,
|
||||||
Parser_state *parser_state)
|
Parser_state *parser_state)
|
||||||
{
|
{
|
||||||
int error;
|
int error __attribute__((unused));
|
||||||
DBUG_ENTER("mysql_parse");
|
DBUG_ENTER("mysql_parse");
|
||||||
|
|
||||||
DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
|
DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
|
||||||
|
|
|
@ -1071,7 +1071,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
||||||
partition_info *part_info= table->part_info;
|
partition_info *part_info= table->part_info;
|
||||||
bool result= TRUE;
|
bool result= TRUE;
|
||||||
int error;
|
int error;
|
||||||
const char *save_where;
|
|
||||||
LEX *old_lex= thd->lex;
|
LEX *old_lex= thd->lex;
|
||||||
LEX lex;
|
LEX lex;
|
||||||
uint8 saved_full_group_by_flag;
|
uint8 saved_full_group_by_flag;
|
||||||
|
@ -1083,7 +1082,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
||||||
|
|
||||||
func_expr->walk(&Item::change_context_processor, 0,
|
func_expr->walk(&Item::change_context_processor, 0,
|
||||||
(uchar*) &lex.select_lex.context);
|
(uchar*) &lex.select_lex.context);
|
||||||
save_where= thd->where;
|
|
||||||
thd->where= "partition function";
|
thd->where= "partition function";
|
||||||
/*
|
/*
|
||||||
In execution we must avoid the use of thd->change_item_tree since
|
In execution we must avoid the use of thd->change_item_tree since
|
||||||
|
|
|
@ -1394,12 +1394,9 @@ bool change_master(THD* thd, Master_info* mi)
|
||||||
/*
|
/*
|
||||||
Before processing the command, save the previous state.
|
Before processing the command, save the previous state.
|
||||||
*/
|
*/
|
||||||
char *pos;
|
strmake(saved_host, mi->host, HOSTNAME_LENGTH);
|
||||||
pos= strmake(saved_host, mi->host, HOSTNAME_LENGTH);
|
|
||||||
pos= '\0';
|
|
||||||
saved_port= mi->port;
|
saved_port= mi->port;
|
||||||
pos= strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
|
strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
|
||||||
pos= '\0';
|
|
||||||
saved_log_pos= mi->master_log_pos;
|
saved_log_pos= mi->master_log_pos;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -4112,7 +4112,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||||
uchar *pos;
|
uchar *pos;
|
||||||
char tmp[MAX_FIELD_WIDTH];
|
char tmp[MAX_FIELD_WIDTH];
|
||||||
String type(tmp,sizeof(tmp), system_charset_info);
|
String type(tmp,sizeof(tmp), system_charset_info);
|
||||||
char *end;
|
|
||||||
|
|
||||||
DEBUG_SYNC(thd, "get_schema_column");
|
DEBUG_SYNC(thd, "get_schema_column");
|
||||||
|
|
||||||
|
@ -4133,7 +4132,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||||
field->field_name) & COL_ACLS;
|
field->field_name) & COL_ACLS;
|
||||||
if (!tables->schema_table && !col_access)
|
if (!tables->schema_table && !col_access)
|
||||||
continue;
|
continue;
|
||||||
end= tmp;
|
char *end= tmp;
|
||||||
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
|
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
|
||||||
{
|
{
|
||||||
if (col_access & 1)
|
if (col_access & 1)
|
||||||
|
@ -4169,7 +4168,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||||
table->field[15]->store((const char*) pos,
|
table->field[15]->store((const char*) pos,
|
||||||
strlen((const char*) pos), cs);
|
strlen((const char*) pos), cs);
|
||||||
|
|
||||||
end= tmp;
|
|
||||||
if (field->unireg_check == Field::NEXT_NUMBER)
|
if (field->unireg_check == Field::NEXT_NUMBER)
|
||||||
table->field[16]->store(STRING_WITH_LEN("auto_increment"), cs);
|
table->field[16]->store(STRING_WITH_LEN("auto_increment"), cs);
|
||||||
if (timestamp_field == field &&
|
if (timestamp_field == field &&
|
||||||
|
|
|
@ -6499,7 +6499,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||||
uint index_add_count= 0;
|
uint index_add_count= 0;
|
||||||
uint *index_add_buffer= NULL;
|
uint *index_add_buffer= NULL;
|
||||||
uint candidate_key_count= 0;
|
uint candidate_key_count= 0;
|
||||||
bool committed= 0;
|
|
||||||
bool no_pk;
|
bool no_pk;
|
||||||
DBUG_ENTER("mysql_alter_table");
|
DBUG_ENTER("mysql_alter_table");
|
||||||
|
|
||||||
|
@ -7329,7 +7328,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||||
DBUG_PRINT("info", ("Committing before unlocking table"));
|
DBUG_PRINT("info", ("Committing before unlocking table"));
|
||||||
if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
|
if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
|
||||||
goto err_new_table_cleanup;
|
goto err_new_table_cleanup;
|
||||||
committed= 1;
|
|
||||||
}
|
}
|
||||||
/*end of if (! new_table) for add/drop index*/
|
/*end of if (! new_table) for add/drop index*/
|
||||||
|
|
||||||
|
|
|
@ -541,7 +541,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
|
||||||
int error, table_type;
|
int error, table_type;
|
||||||
bool error_given;
|
bool error_given;
|
||||||
File file;
|
File file;
|
||||||
uchar head[64], *disk_buff;
|
uchar head[64];
|
||||||
char path[FN_REFLEN];
|
char path[FN_REFLEN];
|
||||||
MEM_ROOT **root_ptr, *old_root;
|
MEM_ROOT **root_ptr, *old_root;
|
||||||
DBUG_ENTER("open_table_def");
|
DBUG_ENTER("open_table_def");
|
||||||
|
@ -550,7 +550,6 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
|
||||||
|
|
||||||
error= 1;
|
error= 1;
|
||||||
error_given= 0;
|
error_given= 0;
|
||||||
disk_buff= NULL;
|
|
||||||
|
|
||||||
strxmov(path, share->normalized_path.str, reg_ext, NullS);
|
strxmov(path, share->normalized_path.str, reg_ext, NullS);
|
||||||
if ((file= mysql_file_open(key_file_frm,
|
if ((file= mysql_file_open(key_file_frm,
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)),
|
||||||
{
|
{
|
||||||
if (!args->attributes[0])
|
if (!args->attributes[0])
|
||||||
{
|
{
|
||||||
null_value= 0;
|
*null_value= 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
(*length)--; /* space for ending \0 (for debugging purposes) */
|
(*length)--; /* space for ending \0 (for debugging purposes) */
|
||||||
|
|
|
@ -519,7 +519,7 @@ int ha_tina::encode_quote(uchar *buf)
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
const char *end_ptr;
|
const char *end_ptr;
|
||||||
const bool was_null= (*field)->is_null();
|
const bool was_null= (*field)->is_null();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
assistance for backwards compatibility in production builds.
|
assistance for backwards compatibility in production builds.
|
||||||
note: this will not work for ENUM columns.
|
note: this will not work for ENUM columns.
|
||||||
|
@ -531,7 +531,7 @@ int ha_tina::encode_quote(uchar *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
(*field)->val_str(&attribute,&attribute);
|
(*field)->val_str(&attribute,&attribute);
|
||||||
|
|
||||||
if (was_null)
|
if (was_null)
|
||||||
(*field)->set_null();
|
(*field)->set_null();
|
||||||
|
|
||||||
|
@ -542,34 +542,30 @@ int ha_tina::encode_quote(uchar *buf)
|
||||||
|
|
||||||
buffer.append('"');
|
buffer.append('"');
|
||||||
|
|
||||||
while (ptr < end_ptr)
|
for (; ptr < end_ptr; ptr++)
|
||||||
{
|
{
|
||||||
if (*ptr == '"')
|
if (*ptr == '"')
|
||||||
{
|
{
|
||||||
buffer.append('\\');
|
buffer.append('\\');
|
||||||
buffer.append('"');
|
buffer.append('"');
|
||||||
*ptr++;
|
|
||||||
}
|
}
|
||||||
else if (*ptr == '\r')
|
else if (*ptr == '\r')
|
||||||
{
|
{
|
||||||
buffer.append('\\');
|
buffer.append('\\');
|
||||||
buffer.append('r');
|
buffer.append('r');
|
||||||
*ptr++;
|
|
||||||
}
|
}
|
||||||
else if (*ptr == '\\')
|
else if (*ptr == '\\')
|
||||||
{
|
{
|
||||||
buffer.append('\\');
|
buffer.append('\\');
|
||||||
buffer.append('\\');
|
buffer.append('\\');
|
||||||
*ptr++;
|
|
||||||
}
|
}
|
||||||
else if (*ptr == '\n')
|
else if (*ptr == '\n')
|
||||||
{
|
{
|
||||||
buffer.append('\\');
|
buffer.append('\\');
|
||||||
buffer.append('n');
|
buffer.append('n');
|
||||||
*ptr++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buffer.append(*ptr++);
|
buffer.append(*ptr);
|
||||||
}
|
}
|
||||||
buffer.append('"');
|
buffer.append('"');
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ static int example_done_func(void *p)
|
||||||
my_hash_free(&example_open_tables);
|
my_hash_free(&example_open_tables);
|
||||||
mysql_mutex_destroy(&example_mutex);
|
mysql_mutex_destroy(&example_mutex);
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
int error;
|
int error;
|
||||||
uint count;
|
uint count;
|
||||||
MYISAM_SHARE *share=info->s;
|
MYISAM_SHARE *share=info->s;
|
||||||
uint flag;
|
|
||||||
DBUG_ENTER("mi_lock_database");
|
DBUG_ENTER("mi_lock_database");
|
||||||
DBUG_PRINT("enter",("lock_type: %d old lock %d r_locks: %u w_locks: %u "
|
DBUG_PRINT("enter",("lock_type: %d old lock %d r_locks: %u w_locks: %u "
|
||||||
"global_changed: %d open_count: %u name: '%s'",
|
"global_changed: %d open_count: %u name: '%s'",
|
||||||
|
@ -49,7 +48,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
flag=error=0;
|
error= 0;
|
||||||
mysql_mutex_lock(&share->intern_lock);
|
mysql_mutex_lock(&share->intern_lock);
|
||||||
if (share->kfile >= 0) /* May only be false on windows */
|
if (share->kfile >= 0) /* May only be false on windows */
|
||||||
{
|
{
|
||||||
|
@ -121,14 +120,12 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
{
|
{
|
||||||
if (share->r_locks)
|
if (share->r_locks)
|
||||||
{ /* Only read locks left */
|
{ /* Only read locks left */
|
||||||
flag=1;
|
|
||||||
if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
|
if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
|
||||||
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
|
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
|
||||||
error=my_errno;
|
error=my_errno;
|
||||||
}
|
}
|
||||||
else if (!share->w_locks)
|
else if (!share->w_locks)
|
||||||
{ /* No more locks */
|
{ /* No more locks */
|
||||||
flag=1;
|
|
||||||
if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
|
if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
|
||||||
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
|
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
|
||||||
error=my_errno;
|
error=my_errno;
|
||||||
|
@ -150,7 +147,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
*/
|
*/
|
||||||
if (share->w_locks == 1)
|
if (share->w_locks == 1)
|
||||||
{
|
{
|
||||||
flag=1;
|
|
||||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||||
MYF(MY_SEEK_NOT_DONE)))
|
MYF(MY_SEEK_NOT_DONE)))
|
||||||
{
|
{
|
||||||
|
@ -165,7 +161,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
}
|
}
|
||||||
if (!share->r_locks && !share->w_locks)
|
if (!share->r_locks && !share->w_locks)
|
||||||
{
|
{
|
||||||
flag=1;
|
|
||||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||||
info->lock_wait | MY_SEEK_NOT_DONE))
|
info->lock_wait | MY_SEEK_NOT_DONE))
|
||||||
{
|
{
|
||||||
|
@ -191,7 +186,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
{ /* Change READONLY to RW */
|
{ /* Change READONLY to RW */
|
||||||
if (share->r_locks == 1)
|
if (share->r_locks == 1)
|
||||||
{
|
{
|
||||||
flag=1;
|
|
||||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||||
MYF(info->lock_wait | MY_SEEK_NOT_DONE)))
|
MYF(info->lock_wait | MY_SEEK_NOT_DONE)))
|
||||||
{
|
{
|
||||||
|
@ -208,7 +202,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
{
|
{
|
||||||
if (!share->w_locks)
|
if (!share->w_locks)
|
||||||
{
|
{
|
||||||
flag=1;
|
|
||||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||||
info->lock_wait | MY_SEEK_NOT_DONE))
|
info->lock_wait | MY_SEEK_NOT_DONE))
|
||||||
{
|
{
|
||||||
|
@ -256,11 +249,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mysql_mutex_unlock(&share->intern_lock);
|
mysql_mutex_unlock(&share->intern_lock);
|
||||||
#if defined(FULL_LOG) || defined(_lint)
|
|
||||||
lock_type|=(int) (flag << 8); /* Set bit to set if real lock */
|
|
||||||
myisam_log_command(MI_LOG_LOCK,info,(uchar*) &lock_type,sizeof(lock_type),
|
|
||||||
error);
|
|
||||||
#endif
|
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
} /* mi_lock_database */
|
} /* mi_lock_database */
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,6 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
|
||||||
SplitStruct *stop;
|
SplitStruct *stop;
|
||||||
double *coord_buf;
|
double *coord_buf;
|
||||||
double *next_coord;
|
double *next_coord;
|
||||||
double *old_coord;
|
|
||||||
int n_dim;
|
int n_dim;
|
||||||
uchar *source_cur, *cur1, *cur2;
|
uchar *source_cur, *cur1, *cur2;
|
||||||
uchar *new_page= info->buff;
|
uchar *new_page= info->buff;
|
||||||
|
@ -293,8 +292,6 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
|
||||||
rtree_d_mbr(keyinfo->seg, key, key_length, cur->coords);
|
rtree_d_mbr(keyinfo->seg, key, key_length, cur->coords);
|
||||||
cur->key = key;
|
cur->key = key;
|
||||||
|
|
||||||
old_coord = next_coord;
|
|
||||||
|
|
||||||
if (split_rtree_node(task, max_keys + 1,
|
if (split_rtree_node(task, max_keys + 1,
|
||||||
mi_getint(page) + full_length + 2, full_length,
|
mi_getint(page) + full_length + 2, full_length,
|
||||||
rt_PAGE_MIN_SIZE(keyinfo->block_length),
|
rt_PAGE_MIN_SIZE(keyinfo->block_length),
|
||||||
|
|
|
@ -226,9 +226,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
|
||||||
int save_errno;
|
int save_errno;
|
||||||
int insert_method;
|
int insert_method;
|
||||||
uint length;
|
uint length;
|
||||||
uint dir_length;
|
|
||||||
uint child_count;
|
uint child_count;
|
||||||
size_t name_buff_length;
|
|
||||||
File fd;
|
File fd;
|
||||||
IO_CACHE file_cache;
|
IO_CACHE file_cache;
|
||||||
char parent_name_buff[FN_REFLEN * 2];
|
char parent_name_buff[FN_REFLEN * 2];
|
||||||
|
@ -300,7 +298,6 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call callback for each child. */
|
/* Call callback for each child. */
|
||||||
dir_length= dirname_part(parent_name_buff, parent_name, &name_buff_length);
|
|
||||||
my_b_seek(&file_cache, 0);
|
my_b_seek(&file_cache, 0);
|
||||||
while ((length= my_b_gets(&file_cache, child_name_buff, FN_REFLEN - 1)))
|
while ((length= my_b_gets(&file_cache, child_name_buff, FN_REFLEN - 1)))
|
||||||
{
|
{
|
||||||
|
@ -381,7 +378,6 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
|
||||||
{
|
{
|
||||||
ulonglong file_offset;
|
ulonglong file_offset;
|
||||||
MI_INFO *myisam;
|
MI_INFO *myisam;
|
||||||
int rc;
|
|
||||||
int errpos;
|
int errpos;
|
||||||
int save_errno;
|
int save_errno;
|
||||||
uint idx;
|
uint idx;
|
||||||
|
@ -400,7 +396,6 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
|
||||||
here and in ha_myisammrg::store_lock() forces consistent data.
|
here and in ha_myisammrg::store_lock() forces consistent data.
|
||||||
*/
|
*/
|
||||||
mysql_mutex_lock(&m_info->mutex);
|
mysql_mutex_lock(&m_info->mutex);
|
||||||
rc= 1;
|
|
||||||
errpos= 0;
|
errpos= 0;
|
||||||
file_offset= 0;
|
file_offset= 0;
|
||||||
min_keys= 0;
|
min_keys= 0;
|
||||||
|
|
|
@ -1917,8 +1917,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
|
||||||
int decimal_intg(decimal_t *from)
|
int decimal_intg(decimal_t *from)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
dec1 *tmp_res;
|
remove_leading_zeroes(from, &res);
|
||||||
tmp_res= remove_leading_zeroes(from, &res);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue