Merge bk-internal.mysql.com:/data0/bk/mysql-5.1

into  bk-internal.mysql.com:/data0/bk/mysql-5.1-kt


sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
This commit is contained in:
unknown 2006-06-26 16:53:53 +02:00
commit 17f724a18c
27 changed files with 262 additions and 594 deletions

View file

@ -32,7 +32,8 @@ noinst_HEADERS = config-win.h config-netware.h \
thr_lock.h t_ctype.h violite.h md5.h base64.h \
mysql_version.h.in my_handler.h my_time.h decimal.h \
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \
my_libwrap.h
# mysql_version.h are generated
CLEANFILES = mysql_version.h my_config.h readline openssl

28
include/my_libwrap.h Normal file
View file

@ -0,0 +1,28 @@
/* Copyright (C) 2000 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef HAVE_LIBWRAP
#include <tcpd.h>
#include <syslog.h>
#ifdef NEED_SYS_SYSLOG_H
#include <sys/syslog.h>
#endif /* NEED_SYS_SYSLOG_H */
extern void my_fromhost(struct request_info *req);
extern int my_hosts_access(struct request_info *req);
extern char *my_eval_client(struct request_info *req);
#endif /* HAVE_LIBWRAP */

View file

@ -31,6 +31,10 @@
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 3 /* The number of plugin types */
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
#define __attribute__(A)
#endif
/*
Macros for beginning and ending plugin declarations. Between
mysql_declare_plugin and mysql_declare_plugin_end there should

View file

@ -794,10 +794,17 @@ select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
f1
2006-01-02
drop table t1;
select now() - now() + 0, curtime() - curtime() + 0,
create table t1 select now() - now(), curtime() - curtime(),
sec_to_time(1) + 0, from_unixtime(1) + 0;
now() - now() + 0 curtime() - curtime() + 0 sec_to_time(1) + 0 from_unixtime(1) + 0
0.000000 0.000000 1.000000 19700101030001.000000
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`now() - now()` double(23,6) NOT NULL DEFAULT '0.000000',
`curtime() - curtime()` double(23,6) NOT NULL DEFAULT '0.000000',
`sec_to_time(1) + 0` double(23,6) DEFAULT NULL,
`from_unixtime(1) + 0` double(23,6) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
End of 4.1 tests
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;

View file

@ -686,3 +686,7 @@ ERROR 42S22: Unknown column 'z' in 'field list'
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
ERROR 42S22: Unknown column 't2.x' in 'field list'
drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
DROP TABLE t1;

View file

@ -747,6 +747,19 @@ select count(id1) from t1 where id2 = 10;
count(id1)
5
drop table t1;
CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1);
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
MAX(a)
1
ALTER TABLE t1 DISABLE KEYS;
SELECT MAX(a) FROM t1;
MAX(a)
1
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
MAX(a)
1
DROP TABLE t1;
CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';

View file

@ -2730,6 +2730,12 @@ ERROR 42000: Key 'a' doesn't exist in table 't1'
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
ERROR 42000: Key 'a' doesn't exist in table 't1'
DROP TABLE t1;
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
i='1e+01' i=1e+01 i in (1e+01,1e+01) i in ('1e+01','1e+01')
0 1 1 1
DROP TABLE t1;
CREATE TABLE t1 (
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',

View file

@ -392,8 +392,10 @@ drop table t1;
# Bug #16546
#
select now() - now() + 0, curtime() - curtime() + 0,
sec_to_time(1) + 0, from_unixtime(1) + 0;
create table t1 select now() - now(), curtime() - curtime(),
sec_to_time(1) + 0, from_unixtime(1) + 0;
show create table t1;
drop table t1;
--echo End of 4.1 tests

View file

@ -224,4 +224,17 @@ insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
drop table t1,t2;
#
# Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
# tables
#
#Note: not an exsaustive test : just a check of the code path.
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
DROP TABLE t1;
# End of 4.1 tests

View file

@ -697,6 +697,18 @@ select count(*) from t1 where id2 = 10;
select count(id1) from t1 where id2 = 10;
drop table t1;
#
# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
# in queries
#
CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1);
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
ALTER TABLE t1 DISABLE KEYS;
SELECT MAX(a) FROM t1;
SELECT MAX(a) FROM t1 IGNORE INDEX(a);
DROP TABLE t1;
#
# BUG#18036 - update of table joined to self reports table as crashed
#

View file

@ -2285,6 +2285,25 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
DROP TABLE t1;
#
# Bug #18759 "Incorrect string to numeric conversion"
#
# This test is here so that the behavior will not be changed to 4.1
# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
# will be converted internally to real (double) value and it is not
# as accurate as bigint (longlong) for integers. Thus the results may
# vary. In 5.1 internally it is decimal, which is a string type and
# will be more accurate. Due to rather big changes needed to fix this
# in 4.1 or 5.0 it is not desired to do it in the stable versions.
#
# This test is here only to make sure that behavior is not changed in
# 4.1 and 5.0
#
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
DROP TABLE t1;
# End of 4.1 tests
#

View file

@ -11,6 +11,7 @@
connect (wait_con,localhost,root,,test,,);
flush status; # Reset counters
connection wait_con;
set session wait_timeout=100;
let $retries=300;
let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
set @aborted_clients= 0;

View file

@ -248,6 +248,18 @@
fun:_dl_relocate_object
}
#
# Warning from my_thread_init becasue mysqld dies before kill thread exists
#
{
my_thread_init kill thread memory loss second
Memcheck:Leak
fun:calloc
fun:my_thread_init
fun:kill_server_thread
}
#
# Leaks reported in _dl_* internal functions on Linux amd64 / glibc2.3.2.
#

View file

@ -53,7 +53,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
my_gethostbyname.c rijndael.c my_aes.c sha1.c \
my_handler.c my_netware.c my_largepage.c \
my_memmem.c \
my_windac.c my_access.c base64.c
my_windac.c my_access.c base64.c my_libwrap.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c \
CMakeLists.txt mf_soundex.c \

42
mysys/my_libwrap.c Normal file
View file

@ -0,0 +1,42 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
This is needed to be able to compile with original libwrap header
files that don't have the prototypes
*/
#include <my_global.h>
#include <my_libwrap.h>
#ifdef HAVE_LIBWRAP
void my_fromhost(struct request_info *req)
{
fromhost(req);
}
int my_hosts_access(struct request_info *req)
{
hosts_access(req);
}
char *my_eval_client(struct request_info *req)
{
eval_client(req);
}
#endif /* HAVE_LIBWRAP */

View file

@ -34,12 +34,10 @@ bin_SCRIPTS = @server_scripts@ \
mysql_create_system_tables
noinst_SCRIPTS = make_binary_distribution \
make_sharedlib_distribution \
make_win_src_distribution
make_sharedlib_distribution
EXTRA_SCRIPTS = make_binary_distribution.sh \
make_sharedlib_distribution.sh \
make_win_src_distribution.sh \
msql2mysql.sh \
mysql_config.sh \
mysql_fix_privilege_tables.sh \
@ -83,7 +81,6 @@ CLEANFILES = @server_scripts@ \
mysqldumpslow \
mysql_tableinfo \
mysqld_multi \
make_win_src_distribution \
mysql_create_system_tables
DISTCLEANFILES = mysqlbug

View file

@ -1,538 +0,0 @@
#!/bin/sh
# Terminate loudly on error, we don't want partial package
set -e
trap "echo '*** script failed ***'" 0
#
# Script to create a Windows src package
#
version=@VERSION@
CP="cp -p"
DEBUG=0
SILENT=0
SUFFIX=""
DIRNAME=""
OUTTAR="0"
OUTZIP="0"
#
# An "abort" function taking a variable number of strings (one per line)
#
abort()
{
for line
do
echo "$line"
done
exit 1
}
#
# This script must run from MySQL top directory
#
if [ ! -f scripts/make_win_src_distribution ]; then
abort "ERROR : You must run this script from the MySQL top-level directory"
fi
SOURCE=`pwd`
#
# Check for source compilation/configuration
#
if [ ! -f sql/sql_yacc.cc ]; then
abort "ERROR : Sorry, you must run this script after the complete build," \
" hope you know what you are trying to do !!"
fi
#
# Debug print of the status
#
print_debug()
{
for statement
do
if [ "$DEBUG" = "1" ] ; then
echo $statement
fi
done
}
#
# Usage of the script
#
show_usage()
{
echo "MySQL utility script to create a Windows src package, and it takes"
echo "the following arguments:"
echo ""
echo " --debug Debug, without creating the package"
echo " --tmp Specify the temporary location"
echo " --suffix Suffix name for the package"
echo " --dirname Directory name to copy files (intermediate)"
echo " --silent Show no progress information"
echo " --tar Create tar.gz package"
echo " --zip Create zip package"
echo " --help Show this help message"
exit 0
}
#
# Parse the input arguments
#
parse_arguments() {
for arg do
case "$arg" in
--add-tar) ADDTAR=1 ;;
--debug) DEBUG=1;;
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
--silent) SILENT=1 ;;
--tar) OUTTAR=1 ;;
--zip) OUTZIP=1 ;;
--help) show_usage ;;
*) abort "Unknown argument '$arg'"
;;
esac
done
}
parse_arguments "$@"
#
# Assign the tmp directory if it was set from the environment variables
#
for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
do
if [ "$i" ]; then
print_debug "Setting TMP to '$i'"
TMP=$i
break
fi
done
#
# Convert argument file from unix to DOS text
#
unix_to_dos()
{
for arg do
print_debug "Replacing LF -> CRLF from '$arg'"
awk '{sub(/$/,"\r");print}' < $arg > $arg.tmp
rm -f $arg
mv $arg.tmp $arg
done
}
#
# Create a tmp dest directory to copy files
#
BASE=$TMP/my_win_dist$SUFFIX.$$
trap "rm -r -f $BASE; echo '*** interrupted ***'; exit 1" 1 2 3 13 15
if [ -d $BASE ] ; then
echo "WARNING: Destination directory '$BASE' already exists, deleting it"
rm -r -f $BASE
fi
$CP -r $SOURCE/VC++Files $BASE
# This includes an implicit 'mkdir $BASE' !
#
# Process version tags in InstallShield files
#
vreplace()
{
for arg do
unix_to_dos $arg
cat $arg | sed -e 's!@''VERSION''@!@VERSION@!' > $arg.tmp
rm -f $arg
mv $arg.tmp $arg
done
}
if test -d $BASE/InstallShield
then
for d in 4.1.XX-gpl 4.1.XX-pro 4.1.XX-classic
do
cd $BASE/InstallShield/$d/String\ Tables/0009-English
vreplace value.shl
cd ../../Setup\ Files/Compressed\ Files/Language\ Independent/OS\ Independent
vreplace infolist.txt
done
fi
#
# Move all error message files to root directory
#
$CP -r $SOURCE/sql/share $BASE/
rm -r -f "$BASE/share/Makefile"
rm -r -f "$BASE/share/Makefile.in"
rm -r -f "$BASE/share/Makefile.am"
mkdir $BASE/Docs $BASE/extra $BASE/include
#
# Copy directory files
#
copy_dir_files()
{
for arg do
print_debug "Copying files from directory '$arg'"
cd $SOURCE/$arg
if [ ! -d $BASE/$arg ]; then
print_debug "Creating directory '$arg'"
mkdir $BASE/$arg
fi
for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def *.hpp *.yy \
README INSTALL* LICENSE AUTHORS NEWS ChangeLog \
*.inc *.test *.result *.pem Moscow_leap des_key_file \
*.vcproj *.sln *.dat *.000001 *.require *.opt
do
if [ -f $i ]
then
$CP $SOURCE/$arg/$i $BASE/$arg/$i
fi
done
for i in *.cc
do
if [ -f $i ]
then
i=`echo $i | sed 's/.cc$//g'`
$CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp
fi
done
done
}
#
# Copy directory contents recursively
#
copy_dir_dirs() {
for arg do
cd $SOURCE
(
find $arg -type d \
-and -not -path \*SCCS\* \
-and -not -path \*.deps\* \
-and -not -path \*.libs\* \
-and -not -path \*autom4te.cache -print
)|(
while read v
do
copy_dir_files $v
done
)
done
}
#
# Input directories to be copied
#
for i in client dbug extra storage/heap include storage/archive storage/csv \
include/mysql libmysql libmysqld storage/myisam storage/example \
storage/myisammrg mysys regex sql strings sql-common \
vio zlib
do
copy_dir_files $i
done
#
# Create project files for ndb
#
#make -C $SOURCE/storage/ndb windoze || true
#
# Input directories to be copied recursively
#
for i in storage/bdb storage/innobase storage/ndb extra/yassl server-tools plugin
do
copy_dir_dirs $i
done
#
# Create dummy innobase configure header
#
if [ -f $BASE/storage/innobase/ib_config.h ]; then
rm -f $BASE/storage/innobase/ib_config.h
fi
touch $BASE/storage/innobase/ib_config.h
#
# Copy miscellaneous files
#
cd $SOURCE
for i in COPYING ChangeLog README EXCEPTIONS-CLIENT\
INSTALL-SOURCE INSTALL-WIN \
INSTALL-WIN-SOURCE \
Docs/INSTALL-BINARY Docs/manual.chm
do
print_debug "Copying file '$i'"
if [ -f $i ]
then
$CP $i $BASE/$i
fi
done
#
# support files
#
mkdir $BASE/support-files
# Rename the cnf files to <file>.ini
for i in support-files/*.cnf
do
i=`echo $i | sed 's/.cnf$//g'`
cp $i.cnf $BASE/$i.ini
done
#
# Raw dirs from source tree
#
for i in scripts mysql-test SSL tests
do
print_debug "Copying directory '$i'"
if [ -d $i ]
then
if [ -d $BASE/$i ]
then
$CP -R $i $BASE
else
$CP -R $i $BASE/$i
fi
fi
# But remove object files from destination
find $BASE/$i -type f -name \*.o | xargs rm -f
done
#
# Fix some windows files to avoid compiler warnings
#
if [ -x extra/replace ] ; then
./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | \
sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' \
> $BASE/sql/sql_yacc.cpp-new
mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp
else
if [ "$SILENT" = "0" ] ; then
echo 'WARNING: "extra/replace" not built, can not filter "sql_yacc.ccp"'
echo 'WARNING: to reduce the number of warnings when building'
fi
fi
#
# Search the tree for plain text files and adapt the line end marker
#
find $BASE \( -name "*.cnf" -o -name "*.ini" \
-o -name COPYING -o -name ChangeLog -o -name EXCEPTIONS-CLIENT \
-o -name "INSTALL*" -o -name LICENSE -o -name "README*" \
-o -name "*.dsp" -o -name "*.dsw" \
-o -name "*.vcproj" -o -name "*.sln" \) -type f -print \
| while read v
do
unix_to_dos $v
done
mv $BASE/README $BASE/README.txt
#
# Clean up if we did this from a bk tree
#
find $BASE -type d \( -name SCCS -o -name .deps -o -name .libs \) -print0 | \
xargs -0 rm -r -f
rm -r -f "$BASE/mysql-test/var"
#
# Initialize the initial data directory
#
if [ ! -f scripts/mysql_install_db ] ; then
if [ "$SILENT" = "0" ] ; then
echo 'WARNING: "scripts/mysql_install_db" is not built, can not initiate databases'
fi
elif [ ! -f extra/my_print_defaults ]; then
if [ "$SILENT" = "0" ] ; then
echo 'WARNING: "extra/my_print_defaults" is not built, can not initiate databases'
fi
else
print_debug "Initializing the 'data' directory"
scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data
if test "$?" = 1
then
exit 1;
fi
fi
#
# Specify the distribution package name and copy it
#
if test -z $DIRNAME
then
NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
else
NEW_DIR_NAME=$DIRNAME
fi
NEW_NAME=$NEW_DIR_NAME-win-src
BASE2=$TMP/$NEW_DIR_NAME
rm -r -f $BASE2
mv $BASE $BASE2
BASE=$BASE2
#
# If debugging, don't create a zip/tar/gz
#
if [ "$DEBUG" = "1" ] ; then
echo "Please check the distribution files from $BASE"
echo "Exiting (without creating the package).."
exit
fi
#
# This is needed to prefere gnu tar instead of tar because tar can't
# always handle long filenames
#
PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
which_1 ()
{
for cmd
do
for d in $PATH_DIRS
do
for file in $d/$cmd
do
if test -x $file -a ! -d $file
then
echo $file
exit 0
fi
done
done
done
exit 1
}
#
# Create the result zip/tar file
#
if [ "$OUTTAR" = "0" ]; then
if [ "$OUTZIP" = "0" ]; then
OUTZIP=1
fi
fi
set_tarzip_options()
{
for arg
do
if [ "$arg" = "tar" ]; then
ZIPFILE1=gnutar
ZIPFILE2=gtar
OPT=cf
EXT=".tar"
NEED_COMPRESS=1
else
ZIPFILE1=zip
ZIPFILE2=""
OPT="-r -q"
EXT=".zip"
NEED_COMPRESS=0
fi
done
}
#
# Create the archive
#
create_archive()
{
print_debug "Using $tar to create archive"
cd $TMP
rm -f $SOURCE/$NEW_NAME$EXT
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
cd $SOURCE
if [ "$NEED_COMPRESS" = "1" ]
then
print_debug "Compressing archive"
gzip -9 $NEW_NAME$EXT
EXT="$EXT.gz"
fi
if [ "$SILENT" = "0" ] ; then
echo "$NEW_NAME$EXT created successfully !!"
fi
}
if [ "$OUTTAR" = "1" ]; then
set_tarzip_options 'tar'
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = ""
then
print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
tar=tar
set_tarzip_options 'tar'
fi
create_archive
fi
if [ "$OUTZIP" = "1" ]; then
set_tarzip_options 'zip'
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = ""
then
echo "Search failed for '$ZIPFILE1', '$ZIPFILE2', cannot create zip!"
fi
create_archive
fi
print_debug "Removing temporary directory"
rm -r -f $BASE
# No need to report anything if we got here
trap "" 0
# End of script

View file

@ -53,7 +53,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
time.cc tztime.cc uniques.cc unireg.cc item_xmlfunc.cc
rpl_tblmap.cc sql_binlog.cc event_scheduler.cc event_timed.cc
sql_tablespace.cc event.cc ../sql-common/my_user.c
partition_info.cc
partition_info.cc rpl_injector.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h

View file

@ -4655,7 +4655,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
}
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int4store(ptr,tmp);
}
@ -4722,7 +4722,7 @@ int Field_timestamp::store(longlong nr, bool unsigned_val)
nr, MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int4store(ptr,timestamp);
}
@ -4748,7 +4748,7 @@ longlong Field_timestamp::val_int(void)
THD *thd= table ? table->in_use : current_thd;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
temp=uint4korr(ptr);
else
#endif
@ -4779,7 +4779,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
val_buffer->length(field_length);
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
temp=uint4korr(ptr);
else
#endif
@ -4844,7 +4844,7 @@ bool Field_timestamp::get_date(TIME *ltime, uint fuzzydate)
long temp;
THD *thd= table ? table->in_use : current_thd;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
temp=uint4korr(ptr);
else
#endif
@ -4881,7 +4881,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
a=sint4korr(a_ptr);
b=sint4korr(b_ptr);
@ -4899,7 +4899,7 @@ int Field_timestamp::cmp(const char *a_ptr, const char *b_ptr)
void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table->s->db_low_byte_first)
if (!table || !table->s->db_low_byte_first)
{
to[0] = ptr[0];
to[1] = ptr[1];
@ -4929,7 +4929,7 @@ void Field_timestamp::set_time()
long tmp= (long) thd->query_start();
set_notnull();
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int4store(ptr,tmp);
}
@ -5341,7 +5341,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_DATE, 1);
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int4store(ptr,tmp);
}
@ -5403,7 +5403,7 @@ int Field_date::store(longlong nr, bool unsigned_val)
MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int4store(ptr, nr);
}
@ -5430,7 +5430,7 @@ double Field_date::val_real(void)
ASSERT_COLUMN_MARKED_FOR_READ;
int32 j;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
j=sint4korr(ptr);
else
#endif
@ -5444,7 +5444,7 @@ longlong Field_date::val_int(void)
ASSERT_COLUMN_MARKED_FOR_READ;
int32 j;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
j=sint4korr(ptr);
else
#endif
@ -5461,7 +5461,7 @@ String *Field_date::val_str(String *val_buffer,
val_buffer->alloc(field_length);
int32 tmp;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
tmp=sint4korr(ptr);
else
#endif
@ -5479,7 +5479,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
{
int32 a,b;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
a=sint4korr(a_ptr);
b=sint4korr(b_ptr);
@ -5497,7 +5497,7 @@ int Field_date::cmp(const char *a_ptr, const char *b_ptr)
void Field_date::sort_string(char *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table->s->db_low_byte_first)
if (!table || !table->s->db_low_byte_first)
{
to[0] = ptr[0];
to[1] = ptr[1];
@ -5744,7 +5744,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
from, len, MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int8store(ptr,tmp);
}
@ -5798,7 +5798,7 @@ int Field_datetime::store(longlong nr, bool unsigned_val)
MYSQL_TIMESTAMP_DATETIME, 1);
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int8store(ptr,nr);
}
@ -5828,7 +5828,7 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
}
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
int8store(ptr,tmp);
}
@ -5856,7 +5856,7 @@ longlong Field_datetime::val_int(void)
ASSERT_COLUMN_MARKED_FOR_READ;
longlong j;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
j=sint8korr(ptr);
else
#endif
@ -5877,7 +5877,7 @@ String *Field_datetime::val_str(String *val_buffer,
int part3;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
tmp=sint8korr(ptr);
else
#endif
@ -5942,7 +5942,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
{
longlong a,b;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
{
a=sint8korr(a_ptr);
b=sint8korr(b_ptr);
@ -5960,7 +5960,7 @@ int Field_datetime::cmp(const char *a_ptr, const char *b_ptr)
void Field_datetime::sort_string(char *to,uint length __attribute__((unused)))
{
#ifdef WORDS_BIGENDIAN
if (!table->s->db_low_byte_first)
if (!table || !table->s->db_low_byte_first)
{
to[0] = ptr[0];
to[1] = ptr[1];

View file

@ -824,7 +824,7 @@ public:
if ((*null_value= is_null()))
return 0;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
if (table && table->s->db_low_byte_first)
return sint4korr(ptr);
#endif
long tmp;

View file

@ -311,8 +311,10 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share,
if (!reopen)
{
// allocate memory on ndb share so it can be reused after online alter table
share->record[0]= (byte*) alloc_root(&share->mem_root, table->s->rec_buff_length);
share->record[1]= (byte*) alloc_root(&share->mem_root, table->s->rec_buff_length);
(void)multi_alloc_root(&share->mem_root,
&(share->record[0]), table->s->rec_buff_length,
&(share->record[1]), table->s->rec_buff_length,
NULL);
}
{
my_ptrdiff_t row_offset= share->record[0] - table->record[0];
@ -2159,6 +2161,9 @@ int ndb_add_binlog_index(THD *thd, void *_row)
break;
}
// Set all fields non-null.
if(binlog_index->s->null_bytes > 0)
bzero(binlog_index->record[0], binlog_index->s->null_bytes);
binlog_index->field[0]->store(row.master_log_pos);
binlog_index->field[1]->store(row.master_log_file,
strlen(row.master_log_file),
@ -3275,6 +3280,13 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
thd= new THD; /* note that contructor of THD uses DBUG_ */
THD_CHECK_SENTRY(thd);
/* We need to set thd->thread_id before thd->store_globals, or it will
set an invalid value for thd->variables.pseudo_thread_id.
*/
pthread_mutex_lock(&LOCK_thread_count);
thd->thread_id= thread_id++;
pthread_mutex_unlock(&LOCK_thread_count);
thd->thread_stack= (char*) &thd; /* remember where our stack is */
if (thd->store_globals())
{
@ -3307,7 +3319,6 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
pthread_detach_this_thread();
thd->real_id= pthread_self();
pthread_mutex_lock(&LOCK_thread_count);
thd->thread_id= thread_id++;
threads.append(thd);
pthread_mutex_unlock(&LOCK_thread_count);
thd->lex->start_transaction_opt= 0;
@ -3643,6 +3654,10 @@ restart:
injector::transaction::table tbl(table, TRUE);
int ret= trans.use_table(::server_id, tbl);
DBUG_ASSERT(ret == 0);
// Set all fields non-null.
if(table->s->null_bytes > 0)
bzero(table->record[0], table->s->null_bytes);
table->field[0]->store((longlong)::server_id);
table->field[1]->store((longlong)gci);
trans.write_row(::server_id,

View file

@ -138,7 +138,8 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems)
}
continue;
}
if ((res= items[i]->real_item()->type()) == Item::FIELD_ITEM)
if ((res= items[i]->real_item()->type()) == Item::FIELD_ITEM &&
items[i]->result_type() != INT_RESULT)
{
field= ((Item_field *)items[i]->real_item())->field;
break;

View file

@ -116,16 +116,7 @@ extern "C" { // Because of SCO 3.2V4.2
#include <sys/utsname.h>
#endif /* __WIN__ */
#ifdef HAVE_LIBWRAP
#include <tcpd.h>
#include <syslog.h>
#ifdef NEED_SYS_SYSLOG_H
#include <sys/syslog.h>
#endif /* NEED_SYS_SYSLOG_H */
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
#endif /* HAVE_LIBWRAP */
#include <my_libwrap.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
@ -687,6 +678,8 @@ static const char* default_dbug_option;
#endif
#ifdef HAVE_LIBWRAP
const char *libwrapName= NULL;
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
#endif
#ifdef HAVE_QUERY_CACHE
static ulong query_cache_limit= 0;
@ -4239,8 +4232,8 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
struct request_info req;
signal(SIGCHLD, SIG_DFL);
request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
fromhost(&req);
if (!hosts_access(&req))
my_fromhost(&req);
if (!my_hosts_access(&req))
{
/*
This may be stupid but refuse() includes an exit(0)
@ -4248,7 +4241,7 @@ pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
clean_exit() - same stupid thing ...
*/
syslog(deny_severity, "refused connect from %s",
eval_client(&req));
my_eval_client(&req));
/*
C++ sucks (the gibberish in front just translates the supplied

View file

@ -744,6 +744,12 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
{
KEY_PART_INFO *part,*part_end;
key_part_map key_part_to_use= 0;
/*
Perform a check if index is not disabled by ALTER TABLE
or IGNORE INDEX.
*/
if (!table->keys_in_use_for_query.is_set(idx))
continue;
uint jdx= 0;
*prefix_len= 0;
for (part= keyinfo->key_part, part_end= part+keyinfo->key_parts ;

View file

@ -1419,6 +1419,15 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
if (connect_to_master(thd, mysql, mi))
{
my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
/*
We need to clear the active VIO since, theoretically, somebody
might issue an awake() on this thread. If we are then in the
middle of closing and destroying the VIO inside the
mysql_close(), we will have a problem.
*/
#ifdef SIGNAL_WITH_VIO_CLOSE
thd->clear_active_vio();
#endif
mysql_close(mysql);
DBUG_RETURN(1);
}
@ -3507,6 +3516,17 @@ err:
VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (mysql)
{
/*
Here we need to clear the active VIO before closing the
connection with the master. The reason is that THD::awake()
might be called from terminate_slave_thread() because somebody
issued a STOP SLAVE. If that happends, the close_active_vio()
can be called in the middle of closing the VIO associated with
the 'mysql' object, causing a crash.
*/
#ifdef SIGNAL_WITH_VIO_CLOSE
thd->clear_active_vio();
#endif
mysql_close(mysql);
mi->mysql=0;
}

View file

@ -2506,15 +2506,19 @@ my_size_t THD::pack_row(TABLE *table, MY_BITMAP const* cols, byte *row_data,
int n_null_bytes= table->s->null_bytes;
byte *ptr;
uint i;
my_ptrdiff_t const offset= (my_ptrdiff_t) (record - (byte*)
table->record[0]);
my_ptrdiff_t const rec_offset= record - table->record[0];
my_ptrdiff_t const def_offset= table->s->default_values - table->record[0];
memcpy(row_data, record, n_null_bytes);
ptr= row_data+n_null_bytes;
for (i= 0 ; (field= *p_field) ; i++, p_field++)
{
if (bitmap_is_set(cols,i))
{
my_ptrdiff_t const offset=
field->is_null(rec_offset) ? def_offset : rec_offset;
ptr= (byte*)field->pack((char *) ptr, field->ptr + offset);
}
}
return (static_cast<my_size_t>(ptr - row_data));
}

View file

@ -1071,8 +1071,9 @@ JOIN::optimize()
group_list ? 0 : select_distinct,
group_list && simple_group,
select_options,
(order == 0 || skip_sort_order) ? select_limit :
HA_POS_ERROR,
(order == 0 || skip_sort_order ||
test(select_options & OPTION_BUFFER_RESULT)) ?
select_limit : HA_POS_ERROR,
(char *) "")))
DBUG_RETURN(1);
@ -8894,6 +8895,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo->key_length+= key_part_info->length;
}
}
else
{
set_if_smaller(table->s->max_rows, rows_limit);
param->end_write_records= rows_limit;
}
if (distinct && field_count != param->hidden_field_count)
{