mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Auto-merge from mysql-trunk-merge.
This commit is contained in:
commit
dfc63866eb
68 changed files with 618 additions and 565 deletions
|
@ -65,7 +65,7 @@ dist-hook:
|
|||
test ! -f $(top_srcdir)/configure.am || \
|
||||
$(INSTALL_DATA) $(top_srcdir)/configure.am $(distdir)
|
||||
|
||||
all-local: @ABI_CHECK@
|
||||
all-local: @ABI_CHECK@
|
||||
|
||||
tags:
|
||||
support-files/build-tags
|
||||
|
@ -314,7 +314,7 @@ abi_check_all: abi_check
|
|||
do_abi_check:
|
||||
set -ex; \
|
||||
for file in $(abi_headers); do \
|
||||
@CC@ -E -nostdinc -dI \
|
||||
@CC@ -E -nostdinc -dI -DMYSQL_ABI_CHECK \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/include/mysql \
|
||||
-I$(top_srcdir)/sql \
|
||||
|
|
|
@ -3652,7 +3652,7 @@ xmlencode_print(const char *src, uint length)
|
|||
tee_fputs("NULL", PAGER);
|
||||
else
|
||||
{
|
||||
for (const char *p = src; length; *p++, length--)
|
||||
for (const char *p = src; length; p++, length--)
|
||||
{
|
||||
const char *t;
|
||||
if ((t = array_value(xmlmeta, *p)))
|
||||
|
@ -4740,7 +4740,7 @@ static const char* construct_prompt()
|
|||
struct tm *t = localtime(&lclock);
|
||||
|
||||
/* 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)
|
||||
processed_prompt.append(*c);
|
||||
|
|
|
@ -596,7 +596,10 @@ static int upgrade_already_done(void)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||
-DCOMPILER=${COMPILER}
|
||||
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||
-DBINARY_DIR=${CMAKE_BINARY_DIR}
|
||||
"-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
|
||||
"-DDMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
|
||||
VERBATIM
|
||||
)
|
||||
|
@ -48,7 +48,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||
-DCMAKE_C_COMPILER=${COMPILER}
|
||||
-DCMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||
-DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
|
||||
"-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
|
||||
"-DMYSQL_ABI_CHECK -DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/do_abi_check.cmake
|
||||
VERBATIM
|
||||
)
|
||||
|
|
14
configure.in
14
configure.in
|
@ -463,16 +463,7 @@ if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
|
|||
then
|
||||
ABI_CHECK=""
|
||||
else
|
||||
# Workaround GCC >= 4.5 - See Bug#52514
|
||||
case `$CC -dumpversion` in
|
||||
[[4-9]].[[5-9]]*)
|
||||
AC_MSG_WARN([ABI check disabled (GCC >= 4.5)])
|
||||
ABI_CHECK=""
|
||||
;;
|
||||
*)
|
||||
ABI_CHECK="abi_check"
|
||||
;;
|
||||
esac
|
||||
ABI_CHECK="abi_check"
|
||||
fi
|
||||
|
||||
AC_SUBST(ABI_CHECK)
|
||||
|
@ -3045,7 +3036,8 @@ fi
|
|||
|
||||
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
|
||||
unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
|
||||
unittest/mysys/Makefile unittest/examples/Makefile dnl
|
||||
unittest/mysys/Makefile unittest/strings/Makefile dnl
|
||||
unittest/examples/Makefile dnl
|
||||
strings/Makefile regex/Makefile storage/Makefile dnl
|
||||
man/Makefile BUILD/Makefile vio/Makefile dnl
|
||||
libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
struct errors *new_error;
|
||||
char *start;
|
||||
DBUG_ENTER("parse_error_string");
|
||||
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 */
|
||||
|
||||
/* getting the error name */
|
||||
start= str;
|
||||
str= skip_delimiters(str);
|
||||
|
||||
if (!(new_error->er_name= get_word(&str)))
|
||||
|
|
|
@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, SSL& ssl)
|
|||
else
|
||||
hmac(ssl, verify, data, aSz, alert, true);
|
||||
|
||||
// read mac and fill
|
||||
// read mac and skip fill
|
||||
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
|
||||
opaque mac[SHA_LEN];
|
||||
input.read(mac, digestSz);
|
||||
|
||||
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
|
||||
int ivExtra = 0;
|
||||
opaque fill;
|
||||
|
||||
if (ssl.isTLSv1_1())
|
||||
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
||||
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
|
||||
aSz - digestSz;
|
||||
for (int i = 0; i < padSz; i++)
|
||||
fill = input[AUTO];
|
||||
input.set_current(input.get_current() + padSz);
|
||||
}
|
||||
|
||||
// verify
|
||||
|
@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
|
|||
void Data::Process(input_buffer& input, SSL& ssl)
|
||||
{
|
||||
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
|
||||
int pad = 0, padByte = 0;
|
||||
int pad = 0, padSz = 0;
|
||||
int ivExtra = 0;
|
||||
|
||||
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
|
||||
if (ssl.isTLSv1_1()) // IV
|
||||
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
||||
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
|
||||
padByte = 1;
|
||||
padSz = 1;
|
||||
}
|
||||
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];
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// read mac and fill
|
||||
// read mac and skip fill
|
||||
opaque mac[SHA_LEN];
|
||||
opaque fill;
|
||||
input.read(mac, digestSz);
|
||||
for (int i = 0; i < pad; i++)
|
||||
fill = input[AUTO];
|
||||
if (padByte)
|
||||
fill = input[AUTO];
|
||||
input.set_current(input.get_current() + pad + padSz);
|
||||
|
||||
// verify
|
||||
if (dataSz) {
|
||||
|
@ -2073,11 +2067,9 @@ void Finished::Process(input_buffer& input, SSL& ssl)
|
|||
if (ssl.isTLSv1_1())
|
||||
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
|
||||
|
||||
opaque fill;
|
||||
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
|
||||
HANDSHAKE_HEADER - finishedSz - digestSz;
|
||||
for (int i = 0; i < padSz; i++)
|
||||
fill = input[AUTO];
|
||||
input.set_current(input.get_current() + padSz);
|
||||
|
||||
// verify mac
|
||||
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.
|
||||
*/
|
||||
#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); \
|
||||
sigemptyset(&l_set); \
|
||||
l_s.sa_handler = (B); \
|
||||
l_s.sa_mask = l_set; \
|
||||
l_s.sa_flags = 0; \
|
||||
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
|
||||
DBUG_ASSERT(l_rc == 0); \
|
||||
sigaction((A), &l_s, NULL); \
|
||||
} while (0)
|
||||
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
|
||||
#define my_sigset(A,B) sigset((A),(B))
|
||||
|
|
|
@ -44,7 +44,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#ifndef _global_h /* If not standard header */
|
||||
#ifndef MYSQL_ABI_CHECK
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef __LCC__
|
||||
#include <winsock2.h> /* For windows */
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <sys/types.h>
|
||||
typedef char my_bool;
|
||||
typedef int my_socket;
|
||||
#include "mysql_version.h"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include <mysql/services.h>
|
||||
#include <mysql/service_my_snprintf.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
extern struct my_snprintf_service_st {
|
||||
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
|
||||
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
|
||||
|
@ -9,7 +7,6 @@ extern struct my_snprintf_service_st {
|
|||
size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
|
||||
size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
|
||||
#include <mysql/service_thd_alloc.h>
|
||||
#include <stdlib.h>
|
||||
struct st_mysql_lex_string
|
||||
{
|
||||
char *str;
|
||||
|
|
|
@ -70,8 +70,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MYSQL_ABI_CHECK
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
extern struct my_snprintf_service_st {
|
||||
size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
|
||||
size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
allocations - they are better served with my_malloc.
|
||||
*/
|
||||
|
||||
#ifndef MYSQL_ABI_CHECK
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -63,7 +63,9 @@ extern const char *globerrs[]; /* my_error_messages is here */
|
|||
#define EE_UNKNOWN_COLLATION 28
|
||||
#define EE_FILENOTFOUND 29
|
||||
#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. */
|
||||
|
||||
/* exit codes for all MySQL programs */
|
||||
|
|
|
@ -56,6 +56,7 @@ CREATE DATABASE `TEST_$1`;
|
|||
SHOW DATABASES LIKE "TEST%";
|
||||
Database (TEST%)
|
||||
TEST_$1
|
||||
test
|
||||
DROP DATABASE `test_$1`;
|
||||
CREATE TABLE T1 (a int) engine=innodb;
|
||||
INSERT INTO T1 VALUES (1);
|
||||
|
@ -171,7 +172,7 @@ create table myUC (i int);
|
|||
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
|
||||
where TABLE_SCHEMA ='mysqltest_LC2';
|
||||
TABLE_SCHEMA TABLE_NAME
|
||||
mysqltest_LC2 myUC
|
||||
mysqltest_lc2 myUC
|
||||
use test;
|
||||
drop database mysqltest_LC2;
|
||||
# End of 5.1 tests
|
||||
|
|
67
mysql-test/suite/rpl/r/rpl_conditional_comments.result
Normal file
67
mysql-test/suite/rpl/r/rpl_conditional_comments.result
Normal file
|
@ -0,0 +1,67 @@
|
|||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
|
||||
|
||||
# Case 1:
|
||||
# ------------------------------------------------------------------
|
||||
# In a statement, some CCs are applied while others are not. The CCs
|
||||
# which are not applied on master will be binlogged as common comments.
|
||||
/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
|
||||
# Case 2:
|
||||
# -----------------------------------------------------------------
|
||||
# Verify whether it can be binlogged correctly when executing prepared
|
||||
# statement.
|
||||
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
|
||||
EXECUTE stmt;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
EXECUTE stmt;
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
|
||||
SET @value=62;
|
||||
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
|
||||
EXECUTE stmt USING @value;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
EXECUTE stmt USING @value;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t1
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
Comparing tables master:test.t1 and slave:test.t1
|
||||
|
||||
# Case 3:
|
||||
# -----------------------------------------------------------------
|
||||
# Verify it can restore the '!', if the it is an uncomplete conditional
|
||||
# comments
|
||||
SELECT c1 FROM /*!99999 t1 WHEREN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1
|
||||
DROP TABLE t1;
|
|
@ -49,6 +49,14 @@ Slave_IO_Running = No (expect No)
|
|||
SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error;
|
||||
Last_IO_Error
|
||||
Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
RESET MASTER;
|
||||
SET @max_allowed_packet_0= @@session.max_allowed_packet;
|
||||
SHOW BINLOG EVENTS;
|
||||
SET @max_allowed_packet_1= @@session.max_allowed_packet;
|
||||
SHOW BINLOG EVENTS;
|
||||
SET @max_allowed_packet_2= @@session.max_allowed_packet;
|
||||
==== clean up ====
|
||||
DROP TABLE t1;
|
||||
SET @@global.max_allowed_packet= 1024;
|
||||
|
|
74
mysql-test/suite/rpl/t/rpl_conditional_comments.test
Normal file
74
mysql-test/suite/rpl/t/rpl_conditional_comments.test
Normal file
|
@ -0,0 +1,74 @@
|
|||
###############################################################################
|
||||
# After the patch for BUG#49124:
|
||||
# - Use ' ' instead of '!' in the conditional comments which are not applied on
|
||||
# master. So they become common comments and will not be applied on slave.
|
||||
#
|
||||
# - Example:
|
||||
# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
|
||||
# will be binlogged as
|
||||
# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'.
|
||||
###############################################################################
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_statement.inc;
|
||||
|
||||
CREATE TABLE t1(c1 INT);
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
--echo
|
||||
--echo # Case 1:
|
||||
--echo # ------------------------------------------------------------------
|
||||
--echo # In a statement, some CCs are applied while others are not. The CCs
|
||||
--echo # which are not applied on master will be binlogged as common comments.
|
||||
|
||||
/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
sync_slave_with_master;
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Case 2:
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # Verify whether it can be binlogged correctly when executing prepared
|
||||
--echo # statement.
|
||||
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
|
||||
EXECUTE stmt;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
EXECUTE stmt;
|
||||
|
||||
sync_slave_with_master;
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
SET @value=62;
|
||||
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
|
||||
EXECUTE stmt USING @value;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT);
|
||||
EXECUTE stmt USING @value;
|
||||
|
||||
source include/show_binlog_events.inc;
|
||||
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
sync_slave_with_master;
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo
|
||||
--echo # Case 3:
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # Verify it can restore the '!', if the it is an uncomplete conditional
|
||||
--echo # comments
|
||||
--error 1064
|
||||
SELECT c1 FROM /*!99999 t1 WHEREN;
|
||||
|
||||
DROP TABLE t1;
|
||||
source include/master-slave-end.inc;
|
|
@ -1,7 +1,12 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Check replication protocol packet size handling
|
||||
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
|
||||
# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
|
||||
# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
|
||||
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
|
||||
|
||||
# max-out size db name
|
||||
source include/master-slave.inc;
|
||||
|
@ -114,6 +119,38 @@ let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
|
|||
let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
|
||||
eval SELECT "$last_io_error" AS Last_IO_Error;
|
||||
|
||||
# Remove the bad binlog and clear error status on slave.
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
--connection master
|
||||
RESET MASTER;
|
||||
|
||||
|
||||
#
|
||||
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
|
||||
#
|
||||
# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
|
||||
# BINLOG EVENTS was issued. To verify that this bug is fixed, we
|
||||
# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
|
||||
# never changes. We turn off the result log because we don't care
|
||||
# about the contents of the binlog.
|
||||
|
||||
--disable_result_log
|
||||
SET @max_allowed_packet_0= @@session.max_allowed_packet;
|
||||
SHOW BINLOG EVENTS;
|
||||
SET @max_allowed_packet_1= @@session.max_allowed_packet;
|
||||
SHOW BINLOG EVENTS;
|
||||
SET @max_allowed_packet_2= @@session.max_allowed_packet;
|
||||
--enable_result_log
|
||||
if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
|
||||
{
|
||||
--echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
|
||||
--source include/show_rpl_debug_info.inc
|
||||
SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
|
||||
--die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
|
||||
}
|
||||
|
||||
|
||||
--echo ==== clean up ====
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -49,7 +49,9 @@ const char *globerrs[GLOBERRS]=
|
|||
"Can't sync file '%s' to disk (Errcode: %d)",
|
||||
"Collation '%s' is not a compiled collation and is not specified in the '%s' file",
|
||||
"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)
|
||||
|
@ -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_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
||||
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
|
||||
|
||||
|
|
|
@ -1746,16 +1746,19 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
|
|||
#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;
|
||||
my_bool append_cache;
|
||||
my_off_t pos_in_file;
|
||||
my_bool append_cache= (info->type == SEQ_READ_APPEND);
|
||||
DBUG_ENTER("my_b_flush_io_cache");
|
||||
DBUG_PRINT("enter", ("cache: 0x%lx", (long) info));
|
||||
|
||||
if (!(append_cache = (info->type == SEQ_READ_APPEND)))
|
||||
need_append_buffer_lock=0;
|
||||
#ifdef THREAD
|
||||
if (!append_cache)
|
||||
need_append_buffer_lock= 0;
|
||||
#endif
|
||||
|
||||
if (info->type == WRITE_CACHE || append_cache)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mysys_priv.h"
|
||||
#include <my_dir.h> /* for stat */
|
||||
#include <m_string.h>
|
||||
#include "mysys_err.h"
|
||||
#if defined(HAVE_UTIME_H)
|
||||
#include <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;
|
||||
uchar buff[IO_SIZE];
|
||||
MY_STAT stat_buff,new_stat_buff;
|
||||
int res;
|
||||
DBUG_ENTER("my_copy");
|
||||
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)
|
||||
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__)
|
||||
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
|
||||
|
||||
if (MyFlags & MY_COPYTIME)
|
||||
|
|
|
@ -76,11 +76,8 @@ end:
|
|||
int my_copystat(const char *from, const char *to, int MyFlags)
|
||||
{
|
||||
struct stat statbuf;
|
||||
#if !defined(__WIN__)
|
||||
int res;
|
||||
#endif
|
||||
|
||||
if (stat((char*) from, &statbuf))
|
||||
if (stat(from, &statbuf))
|
||||
{
|
||||
my_errno=errno;
|
||||
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)
|
||||
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 (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)
|
||||
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__ */
|
||||
|
||||
if (MyFlags & MY_COPYTIME)
|
||||
|
|
|
@ -256,7 +256,6 @@ sopno stopst;
|
|||
register char *ssp; /* start of string matched by subsubRE */
|
||||
register char *sep; /* end of string matched by subsubRE */
|
||||
register char *oldssp; /* previous ssp */
|
||||
register char *dp; /* used in debug mode to check asserts */
|
||||
|
||||
AT("diss", start, stop, startst, stopst);
|
||||
sp = start;
|
||||
|
@ -314,11 +313,9 @@ sopno stopst;
|
|||
ssub = ss + 1;
|
||||
esub = es - 1;
|
||||
/* did innards match? */
|
||||
if (slow(charset, m, sp, rest, ssub, esub) != NULL) {
|
||||
dp = dissect(charset, m, sp, rest, ssub, esub);
|
||||
assert(dp == rest);
|
||||
} else /* no */
|
||||
assert(sp == rest);
|
||||
if (slow(charset, m, sp, rest, ssub, esub) != NULL)
|
||||
sp = dissect(charset, m, sp, rest, ssub, esub);
|
||||
assert(sp == rest);
|
||||
sp = rest;
|
||||
break;
|
||||
case OPLUS_:
|
||||
|
@ -353,8 +350,8 @@ sopno stopst;
|
|||
}
|
||||
assert(sep == rest); /* must exhaust substring */
|
||||
assert(slow(charset, m, ssp, sep, ssub, esub) == rest);
|
||||
dp = dissect(charset, m, ssp, sep, ssub, esub);
|
||||
assert(dp == sep);
|
||||
sp = dissect(charset, m, ssp, sep, ssub, esub);
|
||||
assert(sp == sep);
|
||||
sp = rest;
|
||||
break;
|
||||
case OCH_:
|
||||
|
@ -388,8 +385,8 @@ sopno stopst;
|
|||
else
|
||||
assert(OP(m->g->strip[esub]) == O_CH);
|
||||
}
|
||||
dp = dissect(charset, m, sp, rest, ssub, esub);
|
||||
assert(dp == rest);
|
||||
sp = dissect(charset, m, sp, rest, ssub, esub);
|
||||
assert(sp == rest);
|
||||
sp = rest;
|
||||
break;
|
||||
case O_PLUS:
|
||||
|
|
|
@ -5446,7 +5446,6 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
|||
int Field_date::store(double nr)
|
||||
{
|
||||
longlong tmp;
|
||||
int error= 0;
|
||||
if (nr >= 19000000000000.0 && nr <= 99991231235959.0)
|
||||
nr=floor(nr/1000000.0); // Timestamp to date
|
||||
if (nr < 0.0 || nr > 99991231.0)
|
||||
|
@ -5455,7 +5454,6 @@ int Field_date::store(double nr)
|
|||
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARN_DATA_OUT_OF_RANGE,
|
||||
nr, MYSQL_TIMESTAMP_DATE);
|
||||
error= 1;
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
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,
|
||||
res->ptr(), res->length(), res->charset(),
|
||||
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 result=0;
|
||||
|
@ -5474,11 +5490,7 @@ bool flush_error_log()
|
|||
setbuf(stderr, NULL);
|
||||
my_delete(err_renamed, MYF(0));
|
||||
my_rename(log_error_file, err_renamed, MYF(0));
|
||||
if (freopen(log_error_file,"a+",stdout))
|
||||
{
|
||||
freopen(log_error_file,"a+",stderr);
|
||||
setbuf(stderr, NULL);
|
||||
}
|
||||
redirect_std_streams(log_error_file);
|
||||
|
||||
if ((fd= my_open(err_temp, O_RDONLY, MYF(0))) >= 0)
|
||||
{
|
||||
|
@ -5493,13 +5505,7 @@ bool flush_error_log()
|
|||
result= 1;
|
||||
#else
|
||||
my_rename(log_error_file, err_renamed, MYF(0));
|
||||
if (freopen(log_error_file,"a+",stdout))
|
||||
{
|
||||
FILE *reopen;
|
||||
reopen= freopen(log_error_file,"a+",stderr);
|
||||
setbuf(stderr, NULL);
|
||||
}
|
||||
else
|
||||
if (redirect_std_streams(log_error_file))
|
||||
result= 1;
|
||||
#endif
|
||||
mysql_mutex_unlock(&LOCK_error_log);
|
||||
|
@ -5551,25 +5557,9 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
|||
#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
|
||||
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;
|
||||
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);
|
||||
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_mon+1,
|
||||
start->tm_mday,
|
||||
|
@ -5592,7 +5582,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
|||
start->tm_sec,
|
||||
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||
"Warning" : "Note"),
|
||||
buffer);
|
||||
(int) length, buffer);
|
||||
|
||||
fflush(stderr);
|
||||
|
||||
|
@ -5600,7 +5590,22 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
|||
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)
|
||||
{
|
||||
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");
|
||||
|
||||
length= my_vsnprintf(buff, sizeof(buff), format, args);
|
||||
print_buffer_to_file(level, buff);
|
||||
print_buffer_to_file(level, buff, length);
|
||||
|
||||
#ifdef _WIN32
|
||||
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);
|
||||
}
|
||||
#endif /*EMBEDDED_LIBRARY*/
|
||||
#endif /* EMBEDDED_LIBRARY */
|
||||
|
||||
|
||||
void sql_print_error(const char *format, ...)
|
||||
|
|
|
@ -183,7 +183,7 @@ typedef fp_except fp_except_t;
|
|||
# define fpu_control_t unsigned int
|
||||
# define _FPU_EXTENDED 0x300
|
||||
# define _FPU_DOUBLE 0x200
|
||||
# if defined(__GNUC__) || defined(__SUNPRO_CC)
|
||||
# if defined(__GNUC__) || (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x590)
|
||||
# define _FPU_GETCW(cw) asm volatile ("fnstcw %0" : "=m" (*&cw))
|
||||
# define _FPU_SETCW(cw) asm volatile ("fldcw %0" : : "m" (*&cw))
|
||||
# else
|
||||
|
@ -3698,7 +3698,6 @@ static void end_ssl()
|
|||
|
||||
static int init_server_components()
|
||||
{
|
||||
FILE *reopen;
|
||||
DBUG_ENTER("init_server_components");
|
||||
/*
|
||||
We need to call each of these following functions to ensure that
|
||||
|
@ -3746,8 +3745,8 @@ static int init_server_components()
|
|||
if (freopen(log_error_file, "a+", stdout))
|
||||
#endif
|
||||
{
|
||||
reopen= freopen(log_error_file, "a+", stderr);
|
||||
setbuf(stderr, NULL);
|
||||
if (freopen(log_error_file, "a+", stderr))
|
||||
setbuf(stderr, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6962,7 +6961,7 @@ mysqld_get_one_option(int optid,
|
|||
*val= 0;
|
||||
val+= 2;
|
||||
while (*val && my_isspace(mysqld_charset, *val))
|
||||
*val++;
|
||||
val++;
|
||||
if (!*val)
|
||||
{
|
||||
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;
|
||||
while ((field= *(ptr++)))
|
||||
{
|
||||
CHARSET_INFO *cs;
|
||||
uchar *field_buf;
|
||||
LINT_INIT(field_buf);
|
||||
|
||||
if (!field_is_partition_charset(field))
|
||||
continue;
|
||||
cs= ((Field_str*)field)->charset();
|
||||
size= field->pack_length();
|
||||
if (!(field_buf= (uchar*) sql_calloc(size)))
|
||||
goto error;
|
||||
|
|
|
@ -658,7 +658,11 @@ void Protocol::end_partial_result_set(THD *thd_arg)
|
|||
bool Protocol::flush()
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
return net_flush(&thd->net);
|
||||
bool error;
|
||||
thd->stmt_da->can_overwrite_status= TRUE;
|
||||
error= net_flush(&thd->net);
|
||||
thd->stmt_da->can_overwrite_status= FALSE;
|
||||
return error;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
@ -698,7 +702,8 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
|||
if (flags & SEND_NUM_ROWS)
|
||||
{ // Packet with number of elements
|
||||
uchar *pos= net_store_length(buff, list->elements);
|
||||
(void) my_net_write(&thd->net, buff, (size_t) (pos-buff));
|
||||
if (my_net_write(&thd->net, buff, (size_t) (pos-buff)))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
|
@ -803,7 +808,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
|||
if (flags & SEND_DEFAULTS)
|
||||
item->send(&prot, &tmp); // Send default value
|
||||
if (prot.write())
|
||||
break; /* purecov: inspected */
|
||||
DBUG_RETURN(1);
|
||||
#ifndef DBUG_OFF
|
||||
field_types[count++]= field.type;
|
||||
#endif
|
||||
|
@ -816,8 +821,9 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
|||
to show that there is no cursor.
|
||||
Send no warning information, as it will be sent at statement end.
|
||||
*/
|
||||
write_eof_packet(thd, &thd->net, thd->server_status,
|
||||
thd->warning_info->statement_warn_count());
|
||||
if (write_eof_packet(thd, &thd->net, thd->server_status,
|
||||
thd->warning_info->statement_warn_count()))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(prepare_for_send(list->elements));
|
||||
|
||||
|
|
|
@ -3262,11 +3262,8 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
|
|||
mysql_mutex_lock(&rli->data_lock);
|
||||
if (rli->slave_skip_counter)
|
||||
{
|
||||
char *pos;
|
||||
pos= strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
|
||||
pos= '\0';
|
||||
pos= strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
|
||||
pos= '\0';
|
||||
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);
|
||||
saved_log_pos= rli->group_relay_log_pos;
|
||||
saved_master_log_pos= rli->group_master_log_pos;
|
||||
saved_skip= rli->slave_skip_counter;
|
||||
|
|
|
@ -142,11 +142,10 @@ Geometry *Geometry::construct(Geometry_buffer *buffer,
|
|||
{
|
||||
uint32 geom_type;
|
||||
Geometry *result;
|
||||
char byte_order;
|
||||
|
||||
if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4)
|
||||
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);
|
||||
if (!(result= create_by_typeid(buffer, (int) geom_type)))
|
||||
return NULL;
|
||||
|
|
|
@ -5826,7 +5826,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
|||
{
|
||||
int result;
|
||||
String wrong_users;
|
||||
ulong sql_mode;
|
||||
LEX_USER *user_name, *tmp_user_name;
|
||||
List_iterator <LEX_USER> user_list(list);
|
||||
TABLE_LIST tables[GRANT_TABLES];
|
||||
|
@ -5875,7 +5874,6 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
|||
}
|
||||
|
||||
some_users_created= TRUE;
|
||||
sql_mode= thd->variables.sql_mode;
|
||||
if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0))
|
||||
{
|
||||
append_user(&wrong_users, user_name);
|
||||
|
|
|
@ -5764,7 +5764,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
|
|||
DBUG_ENTER("update_field_dependencies");
|
||||
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
|
||||
|
@ -5775,15 +5775,9 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
|
|||
table->merge_keys.merge(field->part_of_key);
|
||||
|
||||
if (thd->mark_used_columns == MARK_COLUMNS_READ)
|
||||
{
|
||||
current_bitmap= table->read_set;
|
||||
other_bitmap= table->write_set;
|
||||
}
|
||||
bitmap= table->read_set;
|
||||
else
|
||||
{
|
||||
current_bitmap= table->write_set;
|
||||
other_bitmap= table->read_set;
|
||||
}
|
||||
bitmap= table->write_set;
|
||||
|
||||
/*
|
||||
The test-and-set mechanism in the bitmap is not reliable during
|
||||
|
@ -5792,7 +5786,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
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -1673,7 +1673,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
|
|||
|
||||
thd->limit_found_rows = query->found_rows();
|
||||
thd->status_var.last_query_cost= 0.0;
|
||||
thd->stmt_da->disable_status();
|
||||
if (!thd->stmt_da->is_set())
|
||||
thd->stmt_da->disable_status();
|
||||
|
||||
BLOCK_UNLOCK_RD(query_block);
|
||||
MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
|
||||
|
|
|
@ -306,7 +306,12 @@ void Materialized_cursor::fetch(ulong num_rows)
|
|||
if ((res= table->file->rnd_next(table->record[0])))
|
||||
break;
|
||||
/* Send data only if the read was successful. */
|
||||
result->send_data(item_list);
|
||||
/*
|
||||
If network write failed (i.e. due to a closed socked),
|
||||
the error has already been set. Just return.
|
||||
*/
|
||||
if (result->send_data(item_list))
|
||||
return;
|
||||
}
|
||||
|
||||
switch (res) {
|
||||
|
|
|
@ -152,7 +152,7 @@ st_parsing_options::reset()
|
|||
*/
|
||||
|
||||
bool Lex_input_stream::init(THD *thd,
|
||||
const char* buff,
|
||||
char* buff,
|
||||
unsigned int length)
|
||||
{
|
||||
DBUG_EXECUTE_IF("bug42064_simulate_oom",
|
||||
|
@ -182,7 +182,7 @@ bool Lex_input_stream::init(THD *thd,
|
|||
*/
|
||||
|
||||
void
|
||||
Lex_input_stream::reset(const char *buffer, unsigned int length)
|
||||
Lex_input_stream::reset(char *buffer, unsigned int length)
|
||||
{
|
||||
yylineno= 1;
|
||||
yytoklen= 0;
|
||||
|
@ -1427,11 +1427,10 @@ int lex_one_token(void *arg, void *yythd)
|
|||
ulong version;
|
||||
version=strtol(version_str, NULL, 10);
|
||||
|
||||
/* Accept 'M' 'm' 'm' 'd' 'd' */
|
||||
lip->yySkipn(5);
|
||||
|
||||
if (version <= MYSQL_VERSION_ID)
|
||||
{
|
||||
/* Accept 'M' 'm' 'm' 'd' 'd' */
|
||||
lip->yySkipn(5);
|
||||
/* Expand the content of the special comment as real code */
|
||||
lip->set_echo(TRUE);
|
||||
state=MY_LEX_START;
|
||||
|
@ -1439,7 +1438,19 @@ int lex_one_token(void *arg, void *yythd)
|
|||
}
|
||||
else
|
||||
{
|
||||
const char* version_mark= lip->get_ptr() - 1;
|
||||
DBUG_ASSERT(*version_mark == '!');
|
||||
/*
|
||||
Patch and skip the conditional comment to avoid it
|
||||
being propagated infinitely (eg. to a slave).
|
||||
*/
|
||||
char *pcom= lip->yyUnput(' ');
|
||||
comment_closed= ! consume_comment(lip, 1);
|
||||
if (! comment_closed)
|
||||
{
|
||||
DBUG_ASSERT(pcom == version_mark);
|
||||
*pcom= '!';
|
||||
}
|
||||
/* version allowed to have one level of comment inside. */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1392,9 +1392,9 @@ public:
|
|||
@retval FALSE OK
|
||||
@retval TRUE Error
|
||||
*/
|
||||
bool init(THD *thd, const char *buff, unsigned int length);
|
||||
bool init(THD *thd, char *buff, unsigned int length);
|
||||
|
||||
void reset(const char *buff, unsigned int length);
|
||||
void reset(char *buff, unsigned int length);
|
||||
|
||||
/**
|
||||
Set the echo mode.
|
||||
|
@ -1509,6 +1509,20 @@ public:
|
|||
m_ptr += n;
|
||||
}
|
||||
|
||||
/**
|
||||
Puts a character back into the stream, canceling
|
||||
the effect of the last yyGet() or yySkip().
|
||||
Note that the echo mode should not change between calls
|
||||
to unput, get, or skip from the stream.
|
||||
*/
|
||||
char *yyUnput(char ch)
|
||||
{
|
||||
*--m_ptr= ch;
|
||||
if (m_echo)
|
||||
m_cpp_ptr--;
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
End of file indicator for the query text to parse.
|
||||
@return true if there are no more characters to parse
|
||||
|
@ -1666,7 +1680,7 @@ public:
|
|||
|
||||
private:
|
||||
/** Pointer to the current position in the raw input stream. */
|
||||
const char *m_ptr;
|
||||
char *m_ptr;
|
||||
|
||||
/** Starting position of the last token parsed, in the raw buffer. */
|
||||
const char *m_tok_start;
|
||||
|
@ -2348,7 +2362,7 @@ public:
|
|||
@retval FALSE OK
|
||||
@retval TRUE Error
|
||||
*/
|
||||
bool init(THD *thd, const char *buff, unsigned int length)
|
||||
bool init(THD *thd, char *buff, unsigned int length)
|
||||
{
|
||||
return m_lip.init(thd, buff, length);
|
||||
}
|
||||
|
@ -2359,7 +2373,7 @@ public:
|
|||
Lex_input_stream m_lip;
|
||||
Yacc_state m_yacc;
|
||||
|
||||
void reset(const char *found_semicolon, unsigned int length)
|
||||
void reset(char *found_semicolon, unsigned int length)
|
||||
{
|
||||
m_lip.reset(found_semicolon, length);
|
||||
m_yacc.reset();
|
||||
|
|
|
@ -175,6 +175,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
bool is_fifo=0;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
LOAD_FILE_INFO lf_info;
|
||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||
#endif
|
||||
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;
|
||||
bool transactional_table;
|
||||
bool is_concurrent;
|
||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||
DBUG_ENTER("mysql_load");
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
|
@ -510,7 +510,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
error=1;
|
||||
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
|
||||
ha_autocommit_...
|
||||
|
@ -553,7 +557,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||
if (lf_info.wrote_create_file)
|
||||
{
|
||||
int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED);
|
||||
|
||||
|
||||
/* since there is already an error, the possible error of
|
||||
writing binary log will be ignored */
|
||||
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);
|
||||
Item_field *sql_field;
|
||||
TABLE *table= table_list->table;
|
||||
ulonglong id;
|
||||
bool err;
|
||||
DBUG_ENTER("read_fixed_length");
|
||||
|
||||
id= 0;
|
||||
|
||||
while (!read_info.read_fixed_length())
|
||||
{
|
||||
if (thd->killed)
|
||||
|
@ -901,12 +902,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||
Item *item;
|
||||
TABLE *table= table_list->table;
|
||||
uint enclosed_length;
|
||||
ulonglong id;
|
||||
bool err;
|
||||
DBUG_ENTER("read_sep_field");
|
||||
|
||||
enclosed_length=enclosed.length();
|
||||
id= 0;
|
||||
|
||||
for (;;it.rewind())
|
||||
{
|
||||
|
|
|
@ -1393,7 +1393,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
{
|
||||
STATUS_VAR current_global_status_var;
|
||||
ulong uptime;
|
||||
uint length;
|
||||
uint length __attribute__((unused));
|
||||
ulonglong queries_per_second1000;
|
||||
char buff[250];
|
||||
uint buff_len= sizeof(buff);
|
||||
|
@ -1406,7 +1406,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
else
|
||||
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 "
|
||||
"Slow queries: %lu Opens: %lu Flush tables: %lu "
|
||||
"Open tables: %u Queries per second avg: %u.%u",
|
||||
|
@ -1511,7 +1511,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||
#endif
|
||||
if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED())
|
||||
{
|
||||
int res;
|
||||
int res __attribute__((unused));
|
||||
res= (int) thd->is_error();
|
||||
if (command == COM_QUERY)
|
||||
{
|
||||
|
@ -5820,16 +5820,16 @@ void mysql_init_multi_delete(LEX *lex)
|
|||
Parse a query.
|
||||
|
||||
@param thd Current thread
|
||||
@param inBuf Begining of the query text
|
||||
@param rawbuf Begining of the query text
|
||||
@param length Length of the query text
|
||||
@param[out] found_semicolon For multi queries, position of the character of
|
||||
the next query in the query text.
|
||||
*/
|
||||
|
||||
void mysql_parse(THD *thd, const char *inBuf, uint length,
|
||||
void mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
Parser_state *parser_state)
|
||||
{
|
||||
int error;
|
||||
int error __attribute__((unused));
|
||||
DBUG_ENTER("mysql_parse");
|
||||
|
||||
DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
|
||||
|
@ -5853,7 +5853,7 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
|
|||
lex_start(thd);
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
||||
if (query_cache_send_result_to_client(thd, (char*) inBuf, length) <= 0)
|
||||
if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
|
||||
|
@ -5935,14 +5935,14 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
|
|||
1 can be ignored
|
||||
*/
|
||||
|
||||
bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
|
||||
bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
bool error= 0;
|
||||
DBUG_ENTER("mysql_test_parse_for_slave");
|
||||
|
||||
Parser_state parser_state;
|
||||
if (!(error= parser_state.init(thd, inBuf, length)))
|
||||
if (!(error= parser_state.init(thd, rawbuf, length)))
|
||||
{
|
||||
lex_start(thd);
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
|
|
@ -83,7 +83,7 @@ bool is_update_query(enum enum_sql_command command);
|
|||
bool is_log_table_write_query(enum enum_sql_command command);
|
||||
bool alloc_query(THD *thd, const char *packet, uint packet_length);
|
||||
void mysql_init_select(LEX *lex);
|
||||
void mysql_parse(THD *thd, const char *inBuf, uint length,
|
||||
void mysql_parse(THD *thd, char *rawbuf, uint length,
|
||||
Parser_state *parser_state);
|
||||
void mysql_reset_thd_for_next_command(THD *thd);
|
||||
bool mysql_new_select(LEX *lex, bool move_down);
|
||||
|
|
|
@ -1071,7 +1071,6 @@ static bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
|
|||
partition_info *part_info= table->part_info;
|
||||
bool result= TRUE;
|
||||
int error;
|
||||
const char *save_where;
|
||||
LEX *old_lex= thd->lex;
|
||||
LEX lex;
|
||||
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,
|
||||
(uchar*) &lex.select_lex.context);
|
||||
save_where= thd->where;
|
||||
thd->where= "partition function";
|
||||
/*
|
||||
In execution we must avoid the use of thd->change_item_tree since
|
||||
|
@ -4185,7 +4183,7 @@ void get_partition_set(const TABLE *table, uchar *buf, const uint index,
|
|||
*/
|
||||
|
||||
bool mysql_unpack_partition(THD *thd,
|
||||
const char *part_buf, uint part_info_len,
|
||||
char *part_buf, uint part_info_len,
|
||||
TABLE* table, bool is_create_table_ind,
|
||||
handlerton *default_db_type,
|
||||
bool *work_part_info_used)
|
||||
|
|
|
@ -110,7 +110,7 @@ void get_full_part_id_from_key(const TABLE *table, uchar *buf,
|
|||
KEY *key_info,
|
||||
const key_range *key_spec,
|
||||
part_id_range *part_spec);
|
||||
bool mysql_unpack_partition(THD *thd, const char *part_buf,
|
||||
bool mysql_unpack_partition(THD *thd, char *part_buf,
|
||||
uint part_info_len,
|
||||
TABLE *table, bool is_create_table_ind,
|
||||
handlerton *default_db_type,
|
||||
|
|
|
@ -353,8 +353,11 @@ static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
|
|||
&stmt->lex->param_list,
|
||||
Protocol::SEND_EOF);
|
||||
}
|
||||
/* Flag that a response has already been sent */
|
||||
thd->stmt_da->disable_status();
|
||||
|
||||
if (!error)
|
||||
/* Flag that a response has already been sent */
|
||||
thd->stmt_da->disable_status();
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -452,6 +452,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
|
|||
#ifndef DBUG_OFF
|
||||
int left_events = max_binlog_dump_events;
|
||||
#endif
|
||||
int old_max_allowed_packet= thd->variables.max_allowed_packet;
|
||||
DBUG_ENTER("mysql_binlog_send");
|
||||
DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos));
|
||||
|
||||
|
@ -975,6 +976,7 @@ end:
|
|||
mysql_mutex_lock(&LOCK_thread_count);
|
||||
thd->current_linfo = 0;
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
thd->variables.max_allowed_packet= old_max_allowed_packet;
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
err:
|
||||
|
@ -993,6 +995,7 @@ err:
|
|||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
if (file >= 0)
|
||||
mysql_file_close(file, MYF(MY_WME));
|
||||
thd->variables.max_allowed_packet= old_max_allowed_packet;
|
||||
|
||||
my_message(my_errno, errmsg, MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -1394,12 +1397,9 @@ bool change_master(THD* thd, Master_info* mi)
|
|||
/*
|
||||
Before processing the command, save the previous state.
|
||||
*/
|
||||
char *pos;
|
||||
pos= strmake(saved_host, mi->host, HOSTNAME_LENGTH);
|
||||
pos= '\0';
|
||||
strmake(saved_host, mi->host, HOSTNAME_LENGTH);
|
||||
saved_port= mi->port;
|
||||
pos= strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
|
||||
pos= '\0';
|
||||
strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
|
||||
saved_log_pos= mi->master_log_pos;
|
||||
|
||||
/*
|
||||
|
@ -1690,6 +1690,7 @@ bool mysql_show_binlog_events(THD* thd)
|
|||
IO_CACHE log;
|
||||
File file = -1;
|
||||
MYSQL_BIN_LOG *binary_log= NULL;
|
||||
int old_max_allowed_packet= thd->variables.max_allowed_packet;
|
||||
DBUG_ENTER("mysql_show_binlog_events");
|
||||
|
||||
Log_event::init_show_field_list(&field_list);
|
||||
|
@ -1844,6 +1845,7 @@ err:
|
|||
mysql_mutex_lock(&LOCK_thread_count);
|
||||
thd->current_linfo = 0;
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
thd->variables.max_allowed_packet= old_max_allowed_packet;
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -460,8 +460,19 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
|
|||
continue;
|
||||
|
||||
file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
|
||||
if (wild && wild_compare(uname, wild, 0))
|
||||
continue;
|
||||
if (wild)
|
||||
{
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
if (my_wildcmp(files_charset_info,
|
||||
uname, uname + file_name_len,
|
||||
wild, wild + wild_length,
|
||||
wild_prefix, wild_one,wild_many))
|
||||
continue;
|
||||
}
|
||||
else if (wild_compare(uname, wild, 0))
|
||||
continue;
|
||||
}
|
||||
if (!(file_name=
|
||||
thd->make_lex_string(file_name, uname, file_name_len, TRUE)))
|
||||
{
|
||||
|
@ -2936,7 +2947,7 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
|
|||
*/
|
||||
if (res == FIND_FILES_DIR)
|
||||
{
|
||||
if (lex->sql_command != SQLCOM_SELECT)
|
||||
if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND)
|
||||
return 1;
|
||||
thd->clear_error();
|
||||
return 2;
|
||||
|
@ -4126,7 +4137,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
|||
uchar *pos;
|
||||
char tmp[MAX_FIELD_WIDTH];
|
||||
String type(tmp,sizeof(tmp), system_charset_info);
|
||||
char *end;
|
||||
|
||||
DEBUG_SYNC(thd, "get_schema_column");
|
||||
|
||||
|
@ -4147,7 +4157,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
|||
field->field_name) & COL_ACLS;
|
||||
if (!tables->schema_table && !col_access)
|
||||
continue;
|
||||
end= tmp;
|
||||
char *end= tmp;
|
||||
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
|
||||
{
|
||||
if (col_access & 1)
|
||||
|
@ -4183,7 +4193,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
|||
table->field[15]->store((const char*) pos,
|
||||
strlen((const char*) pos), cs);
|
||||
|
||||
end= tmp;
|
||||
if (field->unireg_check == Field::NEXT_NUMBER)
|
||||
table->field[16]->store(STRING_WITH_LEN("auto_increment"), cs);
|
||||
if (timestamp_field == field &&
|
||||
|
|
|
@ -6473,7 +6473,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
uint index_add_count= 0;
|
||||
uint *index_add_buffer= NULL;
|
||||
uint candidate_key_count= 0;
|
||||
bool committed= 0;
|
||||
bool no_pk;
|
||||
DBUG_ENTER("mysql_alter_table");
|
||||
|
||||
|
@ -7302,7 +7301,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||
DBUG_PRINT("info", ("Committing before unlocking table"));
|
||||
if (trans_commit_stmt(thd) || trans_commit_implicit(thd))
|
||||
goto err_new_table_cleanup;
|
||||
committed= 1;
|
||||
}
|
||||
/*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;
|
||||
bool error_given;
|
||||
File file;
|
||||
uchar head[64], *disk_buff;
|
||||
uchar head[64];
|
||||
char path[FN_REFLEN];
|
||||
MEM_ROOT **root_ptr, *old_root;
|
||||
DBUG_ENTER("open_table_def");
|
||||
|
@ -550,7 +550,6 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
|
|||
|
||||
error= 1;
|
||||
error_given= 0;
|
||||
disk_buff= NULL;
|
||||
|
||||
strxmov(path, share->normalized_path.str, reg_ext, NullS);
|
||||
if ((file= mysql_file_open(key_file_frm,
|
||||
|
|
|
@ -629,7 +629,7 @@ struct TABLE_SHARE
|
|||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
/* filled in when reading from frm */
|
||||
bool auto_partitioned;
|
||||
const char *partition_info_str;
|
||||
char *partition_info_str;
|
||||
uint partition_info_str_len;
|
||||
uint partition_info_buffer_size;
|
||||
handlerton *default_part_db_type;
|
||||
|
|
|
@ -1071,7 +1071,7 @@ char *myfunc_argument_name(UDF_INIT *initid __attribute__((unused)),
|
|||
{
|
||||
if (!args->attributes[0])
|
||||
{
|
||||
null_value= 0;
|
||||
*null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
(*length)--; /* space for ending \0 (for debugging purposes) */
|
||||
|
|
|
@ -519,7 +519,7 @@ int ha_tina::encode_quote(uchar *buf)
|
|||
const char *ptr;
|
||||
const char *end_ptr;
|
||||
const bool was_null= (*field)->is_null();
|
||||
|
||||
|
||||
/*
|
||||
assistance for backwards compatibility in production builds.
|
||||
note: this will not work for ENUM columns.
|
||||
|
@ -531,7 +531,7 @@ int ha_tina::encode_quote(uchar *buf)
|
|||
}
|
||||
|
||||
(*field)->val_str(&attribute,&attribute);
|
||||
|
||||
|
||||
if (was_null)
|
||||
(*field)->set_null();
|
||||
|
||||
|
@ -542,34 +542,30 @@ int ha_tina::encode_quote(uchar *buf)
|
|||
|
||||
buffer.append('"');
|
||||
|
||||
while (ptr < end_ptr)
|
||||
for (; ptr < end_ptr; ptr++)
|
||||
{
|
||||
if (*ptr == '"')
|
||||
{
|
||||
buffer.append('\\');
|
||||
buffer.append('"');
|
||||
*ptr++;
|
||||
}
|
||||
else if (*ptr == '\r')
|
||||
{
|
||||
buffer.append('\\');
|
||||
buffer.append('r');
|
||||
*ptr++;
|
||||
}
|
||||
else if (*ptr == '\\')
|
||||
{
|
||||
buffer.append('\\');
|
||||
buffer.append('\\');
|
||||
*ptr++;
|
||||
}
|
||||
else if (*ptr == '\n')
|
||||
{
|
||||
buffer.append('\\');
|
||||
buffer.append('n');
|
||||
*ptr++;
|
||||
}
|
||||
else
|
||||
buffer.append(*ptr++);
|
||||
buffer.append(*ptr);
|
||||
}
|
||||
buffer.append('"');
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ static int example_done_func(void *p)
|
|||
my_hash_free(&example_open_tables);
|
||||
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;
|
||||
uint count;
|
||||
MYISAM_SHARE *share=info->s;
|
||||
uint flag;
|
||||
DBUG_ENTER("mi_lock_database");
|
||||
DBUG_PRINT("enter",("lock_type: %d old lock %d r_locks: %u w_locks: %u "
|
||||
"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);
|
||||
}
|
||||
|
||||
flag=error=0;
|
||||
error= 0;
|
||||
mysql_mutex_lock(&share->intern_lock);
|
||||
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)
|
||||
{ /* Only read locks left */
|
||||
flag=1;
|
||||
if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF,
|
||||
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
|
||||
error=my_errno;
|
||||
}
|
||||
else if (!share->w_locks)
|
||||
{ /* No more locks */
|
||||
flag=1;
|
||||
if (my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
|
||||
MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
|
||||
error=my_errno;
|
||||
|
@ -150,7 +147,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
|||
*/
|
||||
if (share->w_locks == 1)
|
||||
{
|
||||
flag=1;
|
||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||
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)
|
||||
{
|
||||
flag=1;
|
||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||
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 */
|
||||
if (share->r_locks == 1)
|
||||
{
|
||||
flag=1;
|
||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||
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)
|
||||
{
|
||||
flag=1;
|
||||
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
|
||||
info->lock_wait | MY_SEEK_NOT_DONE))
|
||||
{
|
||||
|
@ -256,11 +249,6 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
|||
}
|
||||
#endif
|
||||
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);
|
||||
} /* mi_lock_database */
|
||||
|
||||
|
|
|
@ -255,7 +255,6 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
|
|||
SplitStruct *stop;
|
||||
double *coord_buf;
|
||||
double *next_coord;
|
||||
double *old_coord;
|
||||
int n_dim;
|
||||
uchar *source_cur, *cur1, *cur2;
|
||||
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);
|
||||
cur->key = key;
|
||||
|
||||
old_coord = next_coord;
|
||||
|
||||
if (split_rtree_node(task, max_keys + 1,
|
||||
mi_getint(page) + full_length + 2, full_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 insert_method;
|
||||
uint length;
|
||||
uint dir_length;
|
||||
uint child_count;
|
||||
size_t name_buff_length;
|
||||
File fd;
|
||||
IO_CACHE file_cache;
|
||||
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. */
|
||||
dir_length= dirname_part(parent_name_buff, parent_name, &name_buff_length);
|
||||
my_b_seek(&file_cache, 0);
|
||||
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;
|
||||
MI_INFO *myisam;
|
||||
int rc;
|
||||
int errpos;
|
||||
int save_errno;
|
||||
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.
|
||||
*/
|
||||
mysql_mutex_lock(&m_info->mutex);
|
||||
rc= 1;
|
||||
errpos= 0;
|
||||
file_offset= 0;
|
||||
min_keys= 0;
|
||||
|
|
|
@ -994,86 +994,6 @@ static int my_strxfrm_big5(uchar *dest, const uchar *src, int len)
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
** Arguments:
|
||||
** ptr Pointer to LIKE string.
|
||||
** ptr_length Length of LIKE string.
|
||||
** escape Escape character in LIKE. (Normally '\').
|
||||
** All escape characters should be removed from min_str and max_str
|
||||
** res_length Length of min_str and max_str.
|
||||
** min_str Smallest case sensitive string that ranges LIKE.
|
||||
** Should be space padded to res_length.
|
||||
** max_str Largest case sensitive string that ranges LIKE.
|
||||
** Normally padded with the biggest character sort value.
|
||||
**
|
||||
** The function should return 0 if ok and 1 if the LIKE string can't be
|
||||
** optimized !
|
||||
*/
|
||||
|
||||
#define max_sort_char ((char) 255)
|
||||
|
||||
static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length)
|
||||
{
|
||||
const char *end= ptr + ptr_length;
|
||||
char *min_org=min_str;
|
||||
char *min_end=min_str+res_length;
|
||||
size_t charlen= res_length / cs->mbmaxlen;
|
||||
|
||||
for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--)
|
||||
{
|
||||
if (ptr+1 != end && isbig5code(ptr[0],ptr[1]))
|
||||
{
|
||||
*min_str++= *max_str++ = *ptr++;
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == escape && ptr+1 != end)
|
||||
{
|
||||
ptr++; /* Skip escape */
|
||||
if (isbig5code(ptr[0], ptr[1]))
|
||||
*min_str++= *max_str++ = *ptr++;
|
||||
if (min_str < min_end)
|
||||
*min_str++= *max_str++= *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{
|
||||
*min_str++='\0'; /* This should be min char */
|
||||
*max_str++=max_sort_char;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{
|
||||
/*
|
||||
Calculate length of keys:
|
||||
'a\0\0... is the smallest possible string when we have space expand
|
||||
a\ff\ff... is the biggest possible string
|
||||
*/
|
||||
*min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
|
||||
res_length);
|
||||
*max_length= res_length;
|
||||
do {
|
||||
*min_str++ = 0;
|
||||
*max_str++ = max_sort_char;
|
||||
} while (min_str != min_end);
|
||||
return 0;
|
||||
}
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
}
|
||||
|
||||
*min_length= *max_length= (size_t) (min_str-min_org);
|
||||
while (min_str != min_end)
|
||||
*min_str++= *max_str++= ' ';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
|
@ -6955,7 +6875,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
|
|||
my_strnncollsp_big5,
|
||||
my_strnxfrm_big5,
|
||||
my_strnxfrmlen_simple,
|
||||
my_like_range_big5,
|
||||
my_like_range_mb,
|
||||
my_wildcmp_mb,
|
||||
my_strcasecmp_mb,
|
||||
my_instr_mb,
|
||||
|
@ -7019,7 +6939,7 @@ CHARSET_INFO my_charset_big5_chinese_ci=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xF9D5, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_big5_handler,
|
||||
|
@ -7052,7 +6972,7 @@ CHARSET_INFO my_charset_big5_bin=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xF9FE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_big5_handler,
|
||||
|
|
|
@ -1812,77 +1812,6 @@ static size_t my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
** Arguments:
|
||||
** ptr Pointer to LIKE string.
|
||||
** ptr_length Length of LIKE string.
|
||||
** escape Escape character in LIKE. (Normally '\').
|
||||
** All escape characters should be removed from min_str and max_str
|
||||
** res_length Length of min_str and max_str.
|
||||
** min_str Smallest case sensitive string that ranges LIKE.
|
||||
** Should be space padded to res_length.
|
||||
** max_str Largest case sensitive string that ranges LIKE.
|
||||
** Normally padded with the biggest character sort value.
|
||||
**
|
||||
** The function should return 0 if ok and 1 if the LIKE string can't be
|
||||
** optimized !
|
||||
*/
|
||||
|
||||
#define max_sort_char ((char) 255)
|
||||
|
||||
static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str,char *max_str,
|
||||
size_t *min_length, size_t *max_length)
|
||||
{
|
||||
const char *end=ptr+ptr_length;
|
||||
char *min_org=min_str;
|
||||
char *min_end=min_str+res_length;
|
||||
|
||||
while (ptr < end && min_str < min_end) {
|
||||
if (ismbchar_cp932(cs, ptr, end)) {
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
if (min_str < min_end)
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == escape && ptr+1 < end) {
|
||||
ptr++; /* Skip escape */
|
||||
if (ismbchar_cp932(cs, ptr, end))
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
if (min_str < min_end)
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_one) { /* '_' in SQL */
|
||||
*min_str++ = '\0'; /* This should be min char */
|
||||
*max_str++ = max_sort_char;
|
||||
ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_many)
|
||||
{ /* '%' in SQL */
|
||||
*min_length = (size_t)(min_str - min_org);
|
||||
*max_length = res_length;
|
||||
do
|
||||
{
|
||||
*min_str++= 0;
|
||||
*max_str++= max_sort_char;
|
||||
} while (min_str < min_end);
|
||||
return 0;
|
||||
}
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
}
|
||||
*min_length = *max_length = (size_t) (min_str - min_org);
|
||||
while (min_str < min_end)
|
||||
*min_str++ = *max_str++ = ' '; /* Because if key compression */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint16 cp932_to_unicode[65536]=
|
||||
{
|
||||
0x0000, 0x0001, 0x0002, 0x0003, /* 0000 */
|
||||
|
@ -34852,7 +34781,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
|
|||
my_strnncollsp_cp932,
|
||||
my_strnxfrm_cp932,
|
||||
my_strnxfrmlen_simple,
|
||||
my_like_range_cp932,
|
||||
my_like_range_mb,
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
my_strcasecmp_8bit,
|
||||
my_instr_mb,
|
||||
|
@ -34918,7 +34847,7 @@ CHARSET_INFO my_charset_cp932_japanese_ci=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFCFC, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -34950,7 +34879,7 @@ CHARSET_INFO my_charset_cp932_bin=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFCFC, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -10029,7 +10029,7 @@ CHARSET_INFO my_charset_euckr_korean_ci=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -10062,7 +10062,7 @@ CHARSET_INFO my_charset_euckr_bin=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -67573,7 +67573,7 @@ CHARSET_INFO my_charset_eucjpms_japanese_ci=
|
|||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad_char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -67606,7 +67606,7 @@ CHARSET_INFO my_charset_eucjpms_bin=
|
|||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad_char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -6432,7 +6432,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xF7FE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -6464,7 +6464,7 @@ CHARSET_INFO my_charset_gb2312_bin=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xF7FE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -3548,86 +3548,6 @@ static size_t my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
** Arguments:
|
||||
** ptr Pointer to LIKE string.
|
||||
** ptr_length Length of LIKE string.
|
||||
** escape Escape character in LIKE. (Normally '\').
|
||||
** All escape characters should be removed from min_str and max_str
|
||||
** res_length Length of min_str and max_str.
|
||||
** min_str Smallest case sensitive string that ranges LIKE.
|
||||
** Should be space padded to res_length.
|
||||
** max_str Largest case sensitive string that ranges LIKE.
|
||||
** Normally padded with the biggest character sort value.
|
||||
**
|
||||
** The function should return 0 if ok and 1 if the LIKE string can't be
|
||||
** optimized !
|
||||
*/
|
||||
|
||||
#define max_sort_char ((uchar) 255)
|
||||
|
||||
static my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str,char *max_str,
|
||||
size_t *min_length,size_t *max_length)
|
||||
{
|
||||
const char *end= ptr + ptr_length;
|
||||
char *min_org=min_str;
|
||||
char *min_end=min_str+res_length;
|
||||
size_t charlen= res_length / cs->mbmaxlen;
|
||||
|
||||
for (; ptr != end && min_str != min_end && charlen > 0; ptr++, charlen--)
|
||||
{
|
||||
if (ptr+1 != end && isgbkcode(ptr[0],ptr[1]))
|
||||
{
|
||||
*min_str++= *max_str++ = *ptr++;
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == escape && ptr+1 != end)
|
||||
{
|
||||
ptr++; /* Skip escape */
|
||||
if (isgbkcode(ptr[0], ptr[1]))
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
if (min_str < min_end)
|
||||
*min_str++= *max_str++= *ptr;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_one) /* '_' in SQL */
|
||||
{
|
||||
*min_str++='\0'; /* This should be min char */
|
||||
*max_str++=max_sort_char;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_many) /* '%' in SQL */
|
||||
{
|
||||
/*
|
||||
Calculate length of keys:
|
||||
'a\0\0... is the smallest possible string when we have space expand
|
||||
a\ff\ff... is the biggest possible string
|
||||
*/
|
||||
*min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
|
||||
res_length);
|
||||
*max_length= res_length;
|
||||
do {
|
||||
*min_str++= 0;
|
||||
*max_str++= max_sort_char;
|
||||
} while (min_str != min_end);
|
||||
return 0;
|
||||
}
|
||||
*min_str++= *max_str++ = *ptr;
|
||||
}
|
||||
|
||||
*min_length= *max_length = (size_t) (min_str - min_org);
|
||||
while (min_str != min_end)
|
||||
*min_str++= *max_str++= ' '; /* Because if key compression */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
|
@ -10841,7 +10761,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
|
|||
my_strnncollsp_gbk,
|
||||
my_strnxfrm_gbk,
|
||||
my_strnxfrmlen_simple,
|
||||
my_like_range_gbk,
|
||||
my_like_range_mb,
|
||||
my_wildcmp_mb,
|
||||
my_strcasecmp_mb,
|
||||
my_instr_mb,
|
||||
|
@ -10906,7 +10826,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xA967, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -10938,7 +10858,7 @@ CHARSET_INFO my_charset_gbk_bin=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -604,7 +604,9 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
|||
DESCRIPTION
|
||||
Write max key:
|
||||
- for non-Unicode character sets:
|
||||
just set to 255.
|
||||
just bfill using max_sort_char if max_sort_char is one byte.
|
||||
In case when max_sort_char is two bytes, fill with double-byte pairs
|
||||
and optionally pad with a single space character.
|
||||
- for Unicode character set (utf-8):
|
||||
create a buffer with multibyte representation of the max_sort_char
|
||||
character, and copy it into max_str in a loop.
|
||||
|
@ -616,12 +618,20 @@ static void pad_max_char(CHARSET_INFO *cs, char *str, char *end)
|
|||
|
||||
if (!(cs->state & MY_CS_UNICODE))
|
||||
{
|
||||
bfill(str, end - str, 255);
|
||||
return;
|
||||
if (cs->max_sort_char <= 255)
|
||||
{
|
||||
bfill(str, end - str, cs->max_sort_char);
|
||||
return;
|
||||
}
|
||||
buf[0]= cs->max_sort_char >> 8;
|
||||
buf[1]= cs->max_sort_char & 0xFF;
|
||||
buflen= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
|
||||
(uchar*) buf + sizeof(buf));
|
||||
}
|
||||
|
||||
buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
|
||||
(uchar*) buf + sizeof(buf));
|
||||
|
||||
DBUG_ASSERT(buflen > 0);
|
||||
do
|
||||
|
|
|
@ -1179,86 +1179,6 @@ static size_t my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
** Calculate min_str and max_str that ranges a LIKE string.
|
||||
** Arguments:
|
||||
** ptr Pointer to LIKE string.
|
||||
** ptr_length Length of LIKE string.
|
||||
** escape Escape character in LIKE. (Normally '\').
|
||||
** All escape characters should be removed from min_str and max_str
|
||||
** res_length Length of min_str and max_str.
|
||||
** min_str Smallest case sensitive string that ranges LIKE.
|
||||
** Should be space padded to res_length.
|
||||
** max_str Largest case sensitive string that ranges LIKE.
|
||||
** Normally padded with the biggest character sort value.
|
||||
**
|
||||
** The function should return 0 if ok and 1 if the LIKE string can't be
|
||||
** optimized !
|
||||
*/
|
||||
|
||||
#define max_sort_char ((char) 255)
|
||||
|
||||
static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *ptr,size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str,char *max_str,
|
||||
size_t *min_length,size_t *max_length)
|
||||
{
|
||||
const char *end= ptr + ptr_length;
|
||||
char *min_org=min_str;
|
||||
char *min_end=min_str+res_length;
|
||||
size_t charlen= res_length / cs->mbmaxlen;
|
||||
|
||||
for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--)
|
||||
{
|
||||
if (ismbchar_sjis(cs, ptr, end)) {
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
if (min_str < min_end)
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == escape && ptr+1 < end) {
|
||||
ptr++; /* Skip escape */
|
||||
if (ismbchar_sjis(cs, ptr, end))
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
if (min_str < min_end)
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_one) { /* '_' in SQL */
|
||||
*min_str++ = '\0'; /* This should be min char */
|
||||
*max_str++ = max_sort_char;
|
||||
ptr++;
|
||||
continue;
|
||||
}
|
||||
if (*ptr == w_many)
|
||||
{ /* '%' in SQL */
|
||||
/*
|
||||
Calculate length of keys:
|
||||
'a\0\0... is the smallest possible string when we have space expand
|
||||
a\ff\ff... is the biggest possible string
|
||||
*/
|
||||
*min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
|
||||
res_length);
|
||||
*max_length= res_length;
|
||||
do
|
||||
{
|
||||
*min_str++= 0;
|
||||
*max_str++= max_sort_char;
|
||||
} while (min_str < min_end);
|
||||
return 0;
|
||||
}
|
||||
*min_str++ = *max_str++ = *ptr++;
|
||||
}
|
||||
|
||||
*min_length= *max_length= (size_t) (min_str - min_org);
|
||||
while (min_str != min_end)
|
||||
*min_str++= *max_str++= ' '; /* Because if key compression */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* SJIS->Unicode conversion table */
|
||||
static uint16 sjis_to_unicode[65536]=
|
||||
{
|
||||
|
@ -34231,7 +34151,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
|
|||
my_strnncollsp_sjis,
|
||||
my_strnxfrm_sjis,
|
||||
my_strnxfrmlen_simple,
|
||||
my_like_range_sjis,
|
||||
my_like_range_mb,
|
||||
my_wildcmp_mb, /* wildcmp */
|
||||
my_strcasecmp_8bit,
|
||||
my_instr_mb,
|
||||
|
@ -34297,7 +34217,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFCFC, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -34329,7 +34249,7 @@ CHARSET_INFO my_charset_sjis_bin=
|
|||
1, /* mbminlen */
|
||||
2, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFCFC, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
1, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -67316,7 +67316,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci=
|
|||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
@ -67349,7 +67349,7 @@ CHARSET_INFO my_charset_ujis_bin=
|
|||
1, /* mbminlen */
|
||||
3, /* mbmaxlen */
|
||||
0, /* min_sort_char */
|
||||
255, /* max_sort_char */
|
||||
0xFEFE, /* max_sort_char */
|
||||
' ', /* pad char */
|
||||
0, /* escape_with_backslash_is_dangerous */
|
||||
&my_charset_handler,
|
||||
|
|
|
@ -1917,8 +1917,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
|
|||
int decimal_intg(decimal_t *from)
|
||||
{
|
||||
int res;
|
||||
dec1 *tmp_res;
|
||||
tmp_res= remove_leading_zeroes(from, &res);
|
||||
remove_leading_zeroes(from, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
SUBDIRS = mytap . mysys examples
|
||||
SUBDIRS = mytap . mysys examples strings
|
||||
|
||||
EXTRA_DIST = unit.pl
|
||||
CLEANFILES = unit
|
||||
|
||||
unittests = mytap mysys @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@
|
||||
unittests = mytap mysys strings @mysql_se_unittest_dirs@ @mysql_pg_unittest_dirs@
|
||||
|
||||
test:
|
||||
perl unit.pl run $(unittests)
|
||||
|
|
27
unittest/strings/Makefile.am
Normal file
27
unittest/strings/Makefile.am
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
AM_CPPFLAGS = @ZLIB_INCLUDES@ -I$(top_builddir)/include
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/unittest/mytap
|
||||
|
||||
LDADD = $(top_builddir)/unittest/mytap/libmytap.a \
|
||||
$(top_builddir)/mysys/libmysys.a \
|
||||
$(top_builddir)/dbug/libdbug.a \
|
||||
$(top_builddir)/strings/libmystrings.a
|
||||
|
||||
noinst_PROGRAMS = strings-t
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
114
unittest/strings/strings-t.c
Normal file
114
unittest/strings/strings-t.c
Normal file
|
@ -0,0 +1,114 @@
|
|||
/* Copyright 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#include <tap.h>
|
||||
#include <my_global.h>
|
||||
#include <my_sys.h>
|
||||
|
||||
|
||||
/*
|
||||
Test that like_range() returns well-formed results.
|
||||
*/
|
||||
static int
|
||||
test_like_range_for_charset(CHARSET_INFO *cs, const char *src, size_t src_len)
|
||||
{
|
||||
char min_str[32], max_str[32];
|
||||
size_t min_len, max_len, min_well_formed_len, max_well_formed_len;
|
||||
int error= 0;
|
||||
|
||||
cs->coll->like_range(cs, src, src_len, '\\', '_', '%',
|
||||
sizeof(min_str), min_str, max_str, &min_len, &max_len);
|
||||
diag("min_len=%d\tmax_len=%d\t%s", (int) min_len, (int) max_len, cs->name);
|
||||
min_well_formed_len= cs->cset->well_formed_len(cs,
|
||||
min_str, min_str + min_len,
|
||||
10000, &error);
|
||||
max_well_formed_len= cs->cset->well_formed_len(cs,
|
||||
max_str, max_str + max_len,
|
||||
10000, &error);
|
||||
if (min_len != min_well_formed_len)
|
||||
diag("Bad min_str: min_well_formed_len=%d min_str[%d]=0x%02X",
|
||||
(int) min_well_formed_len, (int) min_well_formed_len,
|
||||
(uchar) min_str[min_well_formed_len]);
|
||||
if (max_len != max_well_formed_len)
|
||||
diag("Bad max_str: max_well_formed_len=%d max_str[%d]=0x%02X",
|
||||
(int) max_well_formed_len, (int) max_well_formed_len,
|
||||
(uchar) max_str[max_well_formed_len]);
|
||||
return
|
||||
min_len == min_well_formed_len &&
|
||||
max_len == max_well_formed_len ? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
static CHARSET_INFO *charset_list[]=
|
||||
{
|
||||
#ifdef HAVE_CHARSET_big5
|
||||
&my_charset_big5_chinese_ci,
|
||||
&my_charset_big5_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_euckr
|
||||
&my_charset_euckr_korean_ci,
|
||||
&my_charset_euckr_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_gb2312
|
||||
&my_charset_gb2312_chinese_ci,
|
||||
&my_charset_gb2312_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_gbk
|
||||
&my_charset_gbk_chinese_ci,
|
||||
&my_charset_gbk_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_latin1
|
||||
&my_charset_latin1,
|
||||
&my_charset_latin1_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_sjis
|
||||
&my_charset_sjis_japanese_ci,
|
||||
&my_charset_sjis_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_tis620
|
||||
&my_charset_tis620_thai_ci,
|
||||
&my_charset_tis620_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_ujis
|
||||
&my_charset_ujis_japanese_ci,
|
||||
&my_charset_ujis_bin,
|
||||
#endif
|
||||
#ifdef HAVE_CHARSET_utf8
|
||||
&my_charset_utf8_general_ci,
|
||||
&my_charset_utf8_unicode_ci,
|
||||
&my_charset_utf8_bin,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
size_t i, failed= 0;
|
||||
|
||||
plan(1);
|
||||
diag("Testing my_like_range_xxx() functions");
|
||||
|
||||
for (i= 0; i < array_elements(charset_list); i++)
|
||||
{
|
||||
CHARSET_INFO *cs= charset_list[i];
|
||||
if (test_like_range_for_charset(cs, "abc%", 4))
|
||||
{
|
||||
++failed;
|
||||
diag("Failed for %s", cs->name);
|
||||
}
|
||||
}
|
||||
ok(failed == 0, "Testing my_like_range_xxx() functions");
|
||||
return exit_status();
|
||||
}
|
Loading…
Reference in a new issue