Commit a6ac350b authored by Andrei Elkin's avatar Andrei Elkin

merging from 5.0-bt rep to a local branch

parents d091deaf f94eafb2
......@@ -2832,7 +2832,7 @@ com_charset(String *buffer __attribute__((unused)), char *line)
param= get_arg(buff, 0);
if (!param || !*param)
{
return put_info("Usage: \\C char_setname | charset charset_name",
return put_info("Usage: \\C charset_name | charset charset_name",
INFO_ERROR, 0);
}
new_cs= get_charset_by_csname(param, MY_CS_PRIMARY, MYF(MY_WME));
......
......@@ -1129,7 +1129,8 @@ static int connect_to_db(char *host, char *user,char *passwd)
DB_error(&mysql_connection, "when trying to connect");
DBUG_RETURN(1);
}
if (mysql_get_server_version(&mysql_connection) < 40100)
if ((mysql_get_server_version(&mysql_connection) < 40100) ||
(opt_compatible_mode & 3))
{
/* Don't dump SET NAMES with a pre-4.1 server (bug#7997). */
opt_set_charset= 0;
......@@ -1857,11 +1858,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
row= mysql_fetch_row(result);
fprintf(sql_file,
"SET @saved_cs_client = @@character_set_client;\n"
"SET character_set_client = utf8;\n"
fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
"/*!40101 SET character_set_client = utf8 */;\n"
"%s;\n"
"SET character_set_client = @saved_cs_client;\n",
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
row[1]);
check_io(sql_file);
......
......@@ -825,7 +825,7 @@ AC_TYPE_SIZE_T
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
memory.h pwd.h select.h \
stdlib.h stddef.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
......@@ -2060,7 +2060,7 @@ AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
......
......@@ -97,6 +97,17 @@ static HA_ERRORS ha_errlist[]=
{ 150,"Foreign key constraint is incorrectly formed"},
{ 151,"Cannot add a child row"},
{ 152,"Cannot delete a parent row"},
{ 153,"No savepoint with that name"},
{ 154,"Non unique key block size"},
{ 155,"The table does not exist in engine"},
{ 156,"The table existed in storage engine"},
{ 157,"Could not connect to storage engine"},
{ 158,"NULLs are not supported in spatial index"},
{ 159,"The table changed in storage engine"},
{ 160,"The table changed in storage engine"},
{ 161,"The table is not writable"},
{ 162,"Failed to get the next autoinc value"},
{ 163,"Failed to set the row autoinc value"},
{ -30999, "DB_INCOMPLETE: Sync didn't finish"},
{ -30998, "DB_KEYEMPTY: Key/data deleted or never created"},
{ -30997, "DB_KEYEXIST: The key/data pair already exists"},
......
......@@ -31,7 +31,6 @@ functions */
#include <sys/locking.h>
#include <windows.h>
#include <math.h> /* Because of rint() */
#include <fcntl.h>
#include <io.h>
#include <malloc.h>
......@@ -223,13 +222,6 @@ typedef uint rf_SetTimer;
#define inline __inline
#endif /* __cplusplus */
inline double rint(double nr)
{
double f = floor(nr);
double c = ceil(nr);
return (((c-nr) >= (nr-f)) ? f :c);
}
#ifdef _WIN64
#define ulonglong2double(A) ((double) (ulonglong) (A))
#define my_off_t2double(A) ((double) (my_off_t) (A))
......@@ -281,7 +273,6 @@ inline ulonglong double2ulonglong(double d)
#define HAVE_FLOAT_H
#define HAVE_LIMITS_H
#define HAVE_STDDEF_H
#define HAVE_RINT /* defined in this file */
#define NO_FCNTL_NONBLOCK /* No FCNTL */
#define HAVE_ALLOCA
#define HAVE_STRPBRK
......
......@@ -377,6 +377,7 @@ enum ha_base_keytype {
#define HA_ERR_TABLE_READONLY 161 /* The table is not writable */
#define HA_ERR_AUTOINC_READ_FAILED 162/* Failed to get the next autoinc value */
#define HA_ERR_AUTOINC_ERANGE 163 /* Failed to set the row autoinc value */
/* You must also add numbers and description to extra/perror.c ! */
#define HA_ERR_LAST 163 /*Copy last error nr.*/
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
......
......@@ -484,8 +484,39 @@ typedef unsigned short ushort;
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
#ifndef HAVE_RINT
#define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5))
#endif
/**
All integers up to this number can be represented exactly as double precision
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
*/
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
/**
rint(3) implementation for platforms that do not have it.
Always rounds to the nearest integer with ties being rounded to the nearest
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
Unlike this implementation, hardware will also honor the FPU rounding mode.
*/
static inline double rint(double x)
{
double f, i;
f = modf(x, &i);
/*
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
no need to check it.
*/
if (x > 0.0)
i += (double) ((f > 0.5) || (f == 0.5 &&
i <= (double) MAX_EXACT_INTEGER &&
(longlong) i % 2));
else
i -= (double) ((f < -0.5) || (f == -0.5 &&
i >= (double) -MAX_EXACT_INTEGER &&
(longlong) i % 2));
return i;
}
#endif /* HAVE_RINT */
/* Define some general constants */
#ifndef TRUE
......
......@@ -2,6 +2,13 @@
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to
# 'grep' call
# This test is disabled on Windows via the next line until the above bug is
# resolved
--source include/not_windows.inc
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
......
......@@ -360,4 +360,34 @@ SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
a DIV 2
0
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (-1.1), (1.1),
(-1.5), (1.5),
(-1.9), (1.9),
(-2.1), (2.1),
(-2.5), (2.5),
(-2.9), (2.9),
# Check numbers with absolute values > 2^53 - 1
# (see comments for MAX_EXACT_INTEGER)
(-1e16 - 0.5), (1e16 + 0.5),
(-1e16 - 1.5), (1e16 + 1.5);
SELECT a, ROUND(a) FROM t1;
a ROUND(a)
-1.1 -1
1.1 1
-1.5 -2
1.5 2
-1.9 -2
1.9 2
-2.1 -2
2.1 2
-2.5 -2
2.5 2
-2.9 -3
2.9 3
-1e+16 -10000000000000000
1e+16 10000000000000000
-1e+16 -10000000000000002
1e+16 10000000000000002
DROP TABLE t1;
End of 5.0 tests
......@@ -353,7 +353,14 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
If the line is in the table, it had to have been preceded by a '#'
SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1
1
DROP TABLE patch;
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
......
......@@ -93,73 +93,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t3` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t4` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t5` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t6` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
......@@ -190,73 +190,73 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
DROP TABLE IF EXISTS `t2`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t2` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `t3`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t3` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
DROP TABLE IF EXISTS `t4`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t4` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
DROP TABLE IF EXISTS `t5`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t5` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
DROP TABLE IF EXISTS `t6`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t6` (
`id` int(8) default NULL,
`name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
......
This diff is collapsed.
......@@ -210,7 +210,6 @@ source database
"MySQL: The world's most popular ;open source database"
echo message echo message
mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
"MySQL"
......@@ -378,7 +377,6 @@ mysqltest: At line 1: The argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'false' failed
system command 'NonExistsinfComamdn 2> /dev/null' failed
test
test2
......
......@@ -77,12 +77,12 @@ INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......@@ -111,12 +111,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......@@ -145,12 +145,12 @@ UNLOCK TABLES;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
`a` int(11) default NULL
);
SET character_set_client = @saved_cs_client;
/*!40101 SET character_set_client = @saved_cs_client */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
......
......@@ -13,9 +13,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
---> connection: wl2818_definer_con
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
---> patching t1.TRG...
......
......@@ -229,5 +229,25 @@ INSERT INTO t1 VALUES ('a');
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
DROP TABLE t1;
#
# Bug #15936: "round" differs on Windows to Unix
#
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (-1.1), (1.1),
(-1.5), (1.5),
(-1.9), (1.9),
(-2.1), (2.1),
(-2.5), (2.5),
(-2.9), (2.9),
# Check numbers with absolute values > 2^53 - 1
# (see comments for MAX_EXACT_INTEGER)
(-1e16 - 0.5), (1e16 + 0.5),
(-1e16 - 1.5), (1e16 + 1.5);
SELECT a, ROUND(a) FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests
# We are using .opt file since we need small binlog size
-- source include/have_log_bin.inc
# we need this for getting fixed timestamps inside of this test
......@@ -174,7 +173,8 @@ delimiter ;//
flush logs;
call p1();
drop procedure p1;
--error 1305
--error ER_SP_DOES_NOT_EXIST
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
......@@ -226,7 +226,26 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
# We create a table, patch, and load the output into it
# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
# We can easily see if a 'Query' line is missing the '#' character
# as described in the original bug
--disable_query_log
CREATE TABLE patch (a blob);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
--echo We expect this value to be 1
--echo The bug being tested was that 'Query' lines were not preceded by '#'
--echo If the line is in the table, it had to have been preceded by a '#'
--echo
SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch;
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
......
......@@ -1650,6 +1650,24 @@ DROP TABLE t1,t2;
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
--echo #
--echo # Bug#33550 mysqldump 4.0 compatibility broken
--echo #
SET NAMES utf8;
CREATE TABLE `straße` ( f1 INT );
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
DROP TABLE `straße`;
CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
--error 2
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`;
SET NAMES latin1;
--echo #
--echo # End of 5.0 tests
--echo #
......
......@@ -62,7 +62,8 @@ select otto from (select 1 as otto) as t1;
--exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
# expectation = response
--error 1054
--error ER_BAD_FIELD_ERROR
select friedrich from (select 1 as otto) as t1;
# The following unmasked unsuccessful statement must give
......@@ -131,14 +132,16 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
#----------------------------------------------------------------------------
# check mysql_errno = 1064 after statement with wrong syntax
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ----------------------------------------------------------------------------
# check if let $my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
let $my_var= 'abc' ;
eval select $mysql_errno as "after_let_var_equal_value" ;
......@@ -146,7 +149,8 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
# ----------------------------------------------------------------------------
# check if set @my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
set @my_var= 'abc' ;
eval select $mysql_errno as "after_set_var_equal_value" ;
......@@ -155,7 +159,8 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
# check if the setting of --disable-warnings itself affects $mysql_errno
# (May be --<whatever> modifies $mysql_errno.)
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--disable_warnings
eval select $mysql_errno as "after_disable_warnings_command" ;
......@@ -166,7 +171,8 @@ eval select $mysql_errno as "after_disable_warnings_command" ;
# (May be disabled warnings affect $mysql_errno.)
# ----------------------------------------------------------------------------
drop table if exists t1 ;
--error 1064
--error ER_PARSE_ERROR
garbage ;
drop table if exists t1 ;
eval select $mysql_errno as "after_disable_warnings" ;
......@@ -175,21 +181,26 @@ eval select $mysql_errno as "after_disable_warnings" ;
# ----------------------------------------------------------------------------
# check if masked errors affect $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_minus_masked" ;
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_!_masked" ;
# ----------------------------------------------------------------------------
# Will manipulations of $mysql_errno be possible and visible ?
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
let $mysql_errno= -1;
eval select $mysql_errno as "after_let_errno_equal_value" ;
......@@ -198,50 +209,61 @@ eval select $mysql_errno as "after_let_errno_equal_value" ;
# How affect actions on prepared statements $mysql_errno ?
# ----------------------------------------------------------------------------
# failing prepare
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10));
# successful prepare
--error 1064
--error ER_PARSE_ERROR
garbage ;
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_successful_prepare" ;
# successful execute
--error 1064
--error ER_PARSE_ERROR
garbage ;
execute stmt;
eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped)
drop table t1;
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
execute stmt;
eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement)
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1243
--error ER_UNKNOWN_STMT_HANDLER
execute __stmt_;
eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate
--error 1064
--error ER_PARSE_ERROR
garbage ;
deallocate prepare stmt;
eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist )
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1243
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare __stmt_;
eval select $mysql_errno as "after_failing_deallocate" ;
......@@ -266,7 +288,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# ----------------------------------------------------------------------------
# Switch off the abort on error and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--disable_abort_on_error
eval select $mysql_errno as "after_--disable_abort_on_error" ;
......@@ -280,9 +303,11 @@ select 3 from t1 ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response
......@@ -296,7 +321,8 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--enable_abort_on_error
eval select $mysql_errno as "after_--enable_abort_on_error" ;
......@@ -305,7 +331,8 @@ eval select $mysql_errno as "after_--enable_abort_on_error" ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
# ----------------------------------------------------------------------------
......@@ -568,9 +595,6 @@ echo ;
# ----------------------------------------------------------------------------
# Illegal use of exec
--error 1
--exec echo "--exec false" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
......@@ -951,8 +975,6 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn 2> /dev/null;
......@@ -1370,7 +1392,8 @@ connection default;
let $num= 2;
while ($num)
{
--error 1064
--error ER_PARSE_ERROR
failing_statement;
dec $num;
......@@ -1429,7 +1452,7 @@ select "this will be executed";
#
# Test zero length result file. Should not pass
#
--exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
......@@ -1482,7 +1505,8 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent
--exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
--error 1
--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
......@@ -1503,7 +1527,7 @@ drop table t1;
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should exist
--exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
......@@ -1515,14 +1539,17 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
# It should be possible to use the command "query" to force mysqltest to
# send the command to the server although it's a builtin mysqltest command.
--error 1064
--error ER_PARSE_ERROR
query sleep;
--error 1064
--error ER_PARSE_ERROR
--query sleep
# Just an empty query command
--error 1065
--error ER_EMPTY_QUERY
query ;
# test for replace_regex
......@@ -1915,7 +1942,8 @@ eval $my_stmt;
# 8. Ensure that "sorted_result " does not change the semantics of
# "--error ...." or the protocol output after such an expected failure
--sorted_result
--error 1146
--error ER_NO_SUCH_TABLE
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
......
-- source include/have_ndb.inc
-- source include/not_embedded.inc
# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
# to 'grep' calls
# Test is currently disabled on Windows via the next line until this bug
# can be resolved.
--source include/not_windows.inc
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings
......
......@@ -293,7 +293,8 @@ STOP SLAVE;
connection master;
FLUSH LOGS;
exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
--remove_file $MYSQLTEST_VARDIR/log/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001
# Make the slave to replay the new binlog.
......
......@@ -50,9 +50,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
#
# Remove definers from TRG file.
......@@ -61,8 +59,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
--exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
# Here we remove definers. This is somewhat complex than the original test
# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
# portable and we have to load the file into a table, exclude the definers line,
# then load the data to an outfile to accomplish the same effect
--disable_query_log
--connection default
CREATE TABLE patch (a blob);
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' INTO TABLE patch;
# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
'$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG'
FROM patch;
DROP TABLE patch;
--connection wl2818_definer_con
--enable_query_log
#
# Create a new trigger.
......
......@@ -17,9 +17,9 @@ my %opt = (
);
GetOptions(\%opt,
'verbose|v+',# verbose
'v|verbose+',# verbose
'help+', # write usage info
'debug|d+', # debug
'd|debug+', # debug
's=s', # what to sort by (t, at, l, al, r, ar etc)
'r!', # reverse the sort order (largest last instead of first)
't=i', # just show the top n queries
......
......@@ -3731,7 +3731,6 @@ convert_search_mode_to_innobase(
case HA_READ_MBR_WITHIN:
case HA_READ_MBR_DISJOINT:
case HA_READ_MBR_EQUAL:
my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0));
return(PAGE_CUR_UNSUPP);
/* do not use "default:" in order to produce a gcc warning:
enumeration value '...' not handled in switch
......@@ -5212,7 +5211,7 @@ ha_innobase::records_in_range(
mode2);
} else {
n_rows = 0;
n_rows = HA_POS_ERROR;
}
dtuple_free_for_mysql(heap1);
......
......@@ -186,39 +186,44 @@ int initgroups(const char *,unsigned int);
#ifdef HAVE_FP_EXCEPT // Fix type conflict
typedef fp_except fp_except_t;
#endif
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
#ifdef HAVE_FENV_H
#include <fenv.h>
#endif
#ifdef HAVE_SYS_FPU_H
/* for IRIX to use set_fpc_csr() */
#include <sys/fpu.h>
#endif
inline void setup_fpu()
{
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
/* We can't handle floating point exceptions with threads, so disable
this on freebsd
Don't fall for overflow, underflow,divide-by-zero or loss of precision
*/
inline void set_proper_floating_point_mode()
{
/* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
#if defined(__i386__)
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#else
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#endif
}
#elif defined(__sgi)
/* for IRIX to use set_fpc_csr() */
#include <sys/fpu.h>
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
FP_X_IMP));
#endif /* __i386__ */
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
inline void set_proper_floating_point_mode()
{
#ifdef HAVE_FESETROUND
/* Set FPU rounding mode to "round-to-nearest" */
fesetround(FE_TONEAREST);
#endif /* HAVE_FESETROUND */
#if defined(__sgi) && defined(HAVE_SYS_FPU_H)
/* Enable denormalized DOUBLE values support for IRIX */
{
union fpc_csr n;
n.fc_word = get_fpc_csr();
n.fc_struct.flush = 0;
set_fpc_csr(n.fc_word);
}
union fpc_csr n;
n.fc_word = get_fpc_csr();
n.fc_struct.flush = 0;
set_fpc_csr(n.fc_word);
#endif
}
#else
#define set_proper_floating_point_mode()
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
} /* cplusplus */
......@@ -3279,7 +3284,7 @@ static int init_server_components()
query_cache_init();
query_cache_resize(query_cache_size);
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
set_proper_floating_point_mode();
setup_fpu();
init_thr_lock();
#ifdef HAVE_REPLICATION
init_slave_list();
......
......@@ -151,6 +151,9 @@ static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
}
VOID(pthread_mutex_unlock(&LOCK_open));
}
/* Mark table as closed, ready for re-open if necessary. */
tables->table= NULL;
}
/*
......@@ -168,8 +171,7 @@ static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
'reopen' is set when a handler table is to be re-opened. In this case,
'tables' is the pointer to the hashed TABLE_LIST object which has been
saved on the original open.
'reopen' is also used to suppress the sending of an 'ok' message or
error messages.
'reopen' is also used to suppress the sending of an 'ok' message.
RETURN
FALSE OK
......@@ -205,8 +207,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
strlen(tables->alias) + 1))
{
DBUG_PRINT("info",("duplicate '%s'", tables->alias));
if (! reopen)
my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias);
my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias);
goto err;
}
}
......@@ -251,8 +252,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
/* There can be only one table in '*tables'. */
if (! (tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
{
if (! reopen)
my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
goto err;
}
......@@ -464,8 +464,7 @@ retry:
if (need_reopen)
{
mysql_ha_close_table(thd, tables);
hash_tables->table= NULL;
mysql_ha_close_table(thd, hash_tables);
/*
The lock might have been aborted, we need to manually reset
thd->some_tables_deleted because handler's tables are closed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment