mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
Merge branch 'bb-10.0-vicentiu' into 10.0
Extra merge commit due to intermediate commits pushed to 10.0 while merge was done.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -47,6 +47,7 @@ extra/jemalloc/build/
|
|||||||
extra/jemalloc/tmp/
|
extra/jemalloc/tmp/
|
||||||
extra/my_print_defaults
|
extra/my_print_defaults
|
||||||
extra/mysql_waitpid
|
extra/mysql_waitpid
|
||||||
|
extra/mysqld_safe_helper
|
||||||
extra/perror
|
extra/perror
|
||||||
extra/replace
|
extra/replace
|
||||||
extra/resolve_stack_dump
|
extra/resolve_stack_dump
|
||||||
@@ -213,6 +214,7 @@ support-files/mysql.spec
|
|||||||
support-files/mysqld_multi.server
|
support-files/mysqld_multi.server
|
||||||
support-files/wsrep.cnf
|
support-files/wsrep.cnf
|
||||||
support-files/wsrep_notify
|
support-files/wsrep_notify
|
||||||
|
support-files/SELinux/centos6-mariadb.pp
|
||||||
tags
|
tags
|
||||||
tests/async_queries
|
tests/async_queries
|
||||||
tests/bug25714
|
tests/bug25714
|
||||||
|
@@ -1567,8 +1567,10 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)
|
|||||||
|
|
||||||
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'"))
|
if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'"))
|
||||||
{
|
{
|
||||||
my_printf_error(0, "query failed; error: '%s'", error_flags,
|
my_printf_error(mysql_errno(mysql),
|
||||||
mysql_error(mysql));
|
"The query to get the server's pid file failed,"
|
||||||
|
" error: '%s'. Continuing.", error_flags,
|
||||||
|
mysql_error(mysql));
|
||||||
}
|
}
|
||||||
result = mysql_store_result(mysql);
|
result = mysql_store_result(mysql);
|
||||||
if (result)
|
if (result)
|
||||||
|
@@ -38,6 +38,7 @@ usr/bin/mysql_zap
|
|||||||
usr/bin/mysqlbinlog
|
usr/bin/mysqlbinlog
|
||||||
usr/bin/mysqld_multi
|
usr/bin/mysqld_multi
|
||||||
usr/bin/mysqld_safe
|
usr/bin/mysqld_safe
|
||||||
|
usr/bin/mysqld_safe_helper
|
||||||
usr/bin/mysqlhotcopy
|
usr/bin/mysqlhotcopy
|
||||||
usr/bin/perror
|
usr/bin/perror
|
||||||
usr/bin/replace
|
usr/bin/replace
|
||||||
|
@@ -40,6 +40,7 @@ usr/bin/mysql_zap
|
|||||||
usr/bin/mysqlbinlog
|
usr/bin/mysqlbinlog
|
||||||
usr/bin/mysqld_multi
|
usr/bin/mysqld_multi
|
||||||
usr/bin/mysqld_safe
|
usr/bin/mysqld_safe
|
||||||
|
usr/bin/mysqld_safe_helper
|
||||||
usr/bin/mysqlhotcopy
|
usr/bin/mysqlhotcopy
|
||||||
usr/bin/perror
|
usr/bin/perror
|
||||||
usr/bin/replace
|
usr/bin/replace
|
||||||
|
@@ -80,6 +80,9 @@ IF(UNIX)
|
|||||||
|
|
||||||
MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client)
|
MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client)
|
||||||
TARGET_LINK_LIBRARIES(mysql_waitpid mysys)
|
TARGET_LINK_LIBRARIES(mysql_waitpid mysys)
|
||||||
|
|
||||||
|
MYSQL_ADD_EXECUTABLE(mysqld_safe_helper mysqld_safe_helper.c COMPONENT Server)
|
||||||
|
TARGET_LINK_LIBRARIES(mysqld_safe_helper mysys)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
77
extra/mysqld_safe_helper.c
Normal file
77
extra/mysqld_safe_helper.c
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#include <my_global.h>
|
||||||
|
#include <m_string.h>
|
||||||
|
#include <my_sys.h>
|
||||||
|
#include <my_pthread.h>
|
||||||
|
#ifdef HAVE_PWD_H
|
||||||
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void my_exit(int c)
|
||||||
|
{
|
||||||
|
my_end(0);
|
||||||
|
exit(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_usage()
|
||||||
|
{
|
||||||
|
printf("Usage:\n"
|
||||||
|
" %s <user> log <filename>\n"
|
||||||
|
" %s <user> exec <command> <args>\n",
|
||||||
|
my_progname, my_progname);
|
||||||
|
my_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_log(const char *logfile)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
uchar buf[4096];
|
||||||
|
int size;
|
||||||
|
|
||||||
|
if (!logfile)
|
||||||
|
do_usage();
|
||||||
|
|
||||||
|
f= my_fopen(logfile, O_WRONLY|O_APPEND|O_CREAT, MYF(MY_WME));
|
||||||
|
if (!f)
|
||||||
|
my_exit(1);
|
||||||
|
|
||||||
|
while ((size= my_fread(stdin, buf, sizeof(buf), MYF(MY_WME))) > 0)
|
||||||
|
if ((int)my_fwrite(f, buf, size, MYF(MY_WME)) != size)
|
||||||
|
my_exit(1);
|
||||||
|
|
||||||
|
my_fclose(f, MYF(0));
|
||||||
|
my_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_exec(char *args[])
|
||||||
|
{
|
||||||
|
if (!args[0])
|
||||||
|
do_usage();
|
||||||
|
|
||||||
|
my_end(0);
|
||||||
|
execvp(args[0], args);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
struct passwd *user_info;
|
||||||
|
MY_INIT(argv[0]);
|
||||||
|
|
||||||
|
if (argc < 3)
|
||||||
|
do_usage(argv[0]);
|
||||||
|
|
||||||
|
user_info= my_check_user(argv[1], MYF(0));
|
||||||
|
if (user_info ? my_set_user(argv[1], user_info, MYF(MY_WME))
|
||||||
|
: my_errno == EINVAL)
|
||||||
|
my_exit(1);
|
||||||
|
|
||||||
|
if (strcmp(argv[2], "log") == 0)
|
||||||
|
do_log(argv[3]);
|
||||||
|
|
||||||
|
if (strcmp(argv[2], "exec") == 0)
|
||||||
|
do_exec(argv+3);
|
||||||
|
|
||||||
|
my_end(0);
|
||||||
|
return 1;
|
||||||
|
}
|
@@ -620,8 +620,12 @@ extern void *my_memmem(const void *haystack, size_t haystacklen,
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
extern int my_access(const char *path, int amode);
|
extern int my_access(const char *path, int amode);
|
||||||
|
#define my_check_user(A,B) (NULL)
|
||||||
|
#define my_set_user(A,B,C) (0)
|
||||||
#else
|
#else
|
||||||
#define my_access access
|
#define my_access access
|
||||||
|
struct passwd *my_check_user(const char *user, myf MyFlags);
|
||||||
|
int my_set_user(const char *user, struct passwd *user_info, myf MyFlags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int check_if_legal_filename(const char *path);
|
extern int check_if_legal_filename(const char *path);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
'\" t
|
'\" t
|
||||||
.\"
|
.\"
|
||||||
.TH "\FBMYSQL_SECURE_INST" "1" "04/08/2015" "MariaDB 10\&.0" "MariaDB Database System"
|
.TH "\FBMYSQL_SECURE_INST" "1" "3 January 2017" "MariaDB 10\&.0" "MariaDB Database System"
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
.\" * set default formatting
|
.\" * set default formatting
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
@@ -71,9 +71,8 @@ test
|
|||||||
database, which by default can be accessed by anonymous users\&.
|
database, which by default can be accessed by anonymous users\&.
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
Invoke
|
|
||||||
\fBmysql_secure_installation\fR
|
\fBmysql_secure_installation\fR
|
||||||
without arguments:
|
can be invoked without arguments:
|
||||||
.sp
|
.sp
|
||||||
.if n \{\
|
.if n \{\
|
||||||
.RS 4
|
.RS 4
|
||||||
@@ -86,10 +85,75 @@ shell> \fBmysql_secure_installation\fR
|
|||||||
.\}
|
.\}
|
||||||
.PP
|
.PP
|
||||||
The script will prompt you to determine which actions to perform\&.
|
The script will prompt you to determine which actions to perform\&.
|
||||||
|
.PP
|
||||||
|
\fBmysql_secure_installation\fR
|
||||||
|
accepts some options:
|
||||||
|
.sp
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.sp -1
|
||||||
|
.IP \(bu 2.3
|
||||||
|
.\}
|
||||||
|
.\" mysql_secure_installation: basedir option
|
||||||
|
.\" basedir option: mysql_secure_installation
|
||||||
|
\fB\-\-basedir=\fR\fB\fIdir_name\fR\fR
|
||||||
|
.sp
|
||||||
|
Base directory\&.
|
||||||
|
.RE
|
||||||
|
.sp
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.sp -1
|
||||||
|
.IP \(bu 2.3
|
||||||
|
.\}
|
||||||
|
.\" mysql_secure_installation: defaults-extra-file option
|
||||||
|
.\" defaults-extra-file option: mysql_secure_installation
|
||||||
|
\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR
|
||||||
|
.sp
|
||||||
|
Additional option file\&.
|
||||||
|
.RE
|
||||||
|
.sp
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.sp -1
|
||||||
|
.IP \(bu 2.3
|
||||||
|
.\}
|
||||||
|
.\" mysql_secure_installation: defaults-file option
|
||||||
|
.\" defaults-file option: mysql_secure_installation
|
||||||
|
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
|
||||||
|
.sp
|
||||||
|
Option file\&.
|
||||||
|
.RE
|
||||||
|
.sp
|
||||||
|
.RS 4
|
||||||
|
.ie n \{\
|
||||||
|
\h'-04'\(bu\h'+03'\c
|
||||||
|
.\}
|
||||||
|
.el \{\
|
||||||
|
.sp -1
|
||||||
|
.IP \(bu 2.3
|
||||||
|
.\}
|
||||||
|
.\" mysql_secure_installation: no-defaults option
|
||||||
|
.\" no-defaults option: mysql_secure_installation
|
||||||
|
\fB\-\-no\-defaults\fR
|
||||||
|
.sp
|
||||||
|
Don't read any defaults file\&.
|
||||||
|
.RE
|
||||||
|
.sp
|
||||||
|
Other unrecognized options will be passed on to the server\&.
|
||||||
.SH "COPYRIGHT"
|
.SH "COPYRIGHT"
|
||||||
.br
|
.br
|
||||||
.PP
|
.PP
|
||||||
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
|
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2017 MariaDB Foundation
|
||||||
.PP
|
.PP
|
||||||
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
|
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
|
||||||
.PP
|
.PP
|
||||||
|
@@ -2678,6 +2678,13 @@ end|
|
|||||||
create table t1 as select f1();
|
create table t1 as select f1();
|
||||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||||
drop function f1;
|
drop function f1;
|
||||||
|
#
|
||||||
|
# MDEV-10274 Bundling insert with create statement
|
||||||
|
# for table with unsigned Decimal primary key issues warning 1194
|
||||||
|
#
|
||||||
|
create table t1(ID decimal(2,1) unsigned NOT NULL, PRIMARY KEY (ID))engine=memory
|
||||||
|
select 2.1 ID;
|
||||||
|
drop table t1;
|
||||||
End of 5.5 tests
|
End of 5.5 tests
|
||||||
create table t1;
|
create table t1;
|
||||||
ERROR 42000: A table must have at least 1 column
|
ERROR 42000: A table must have at least 1 column
|
||||||
|
@@ -4550,6 +4550,16 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061));
|
|||||||
CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061))
|
CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061))
|
||||||
1
|
1
|
||||||
#
|
#
|
||||||
|
# MDEV-11685: sql_mode can't be set with non-ascii connection charset
|
||||||
|
#
|
||||||
|
SET character_set_connection=ucs2;
|
||||||
|
SET sql_mode='NO_ENGINE_SUBSTITUTION';
|
||||||
|
SELECT @@sql_mode;
|
||||||
|
@@sql_mode
|
||||||
|
NO_ENGINE_SUBSTITUTION
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
SET NAMES utf8;
|
||||||
|
#
|
||||||
# End of 5.5 tests
|
# End of 5.5 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
|
call mtr.add_suppression("'ucs2' can not be used as client character set");
|
||||||
show variables like 'collation_server';
|
show variables like 'collation_server';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
collation_server ucs2_unicode_ci
|
collation_server ucs2_unicode_ci
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
|
call mtr.add_suppression("'ucs2' can not be used as client character set");
|
||||||
#
|
#
|
||||||
# Start of 5.5 tests
|
# Start of 5.5 tests
|
||||||
#
|
#
|
||||||
|
@@ -1580,6 +1580,16 @@ ERROR HY000: Invalid utf16 character string: 'DE9899'
|
|||||||
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
|
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
|
||||||
ERROR HY000: Invalid utf16 character string: 'DE9899'
|
ERROR HY000: Invalid utf16 character string: 'DE9899'
|
||||||
#
|
#
|
||||||
|
# MDEV-11685: sql_mode can't be set with non-ascii connection charset
|
||||||
|
#
|
||||||
|
SET character_set_connection=utf16;
|
||||||
|
SET sql_mode='NO_ENGINE_SUBSTITUTION';
|
||||||
|
SELECT @@sql_mode;
|
||||||
|
@@sql_mode
|
||||||
|
NO_ENGINE_SUBSTITUTION
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
SET NAMES utf8;
|
||||||
|
#
|
||||||
# End of 5.5 tests
|
# End of 5.5 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
call mtr.add_suppression("Cannot use utf16 as character_set_client");
|
call mtr.add_suppression("'utf16' can not be used as client character set");
|
||||||
SHOW VARIABLES LIKE 'collation_server';
|
SHOW VARIABLES LIKE 'collation_server';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
collation_server utf16_general_ci
|
collation_server utf16_general_ci
|
||||||
|
@@ -1662,6 +1662,16 @@ select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
|
|||||||
c
|
c
|
||||||
FFFF0000
|
FFFF0000
|
||||||
#
|
#
|
||||||
|
# MDEV-11685: sql_mode can't be set with non-ascii connection charset
|
||||||
|
#
|
||||||
|
SET character_set_connection=utf32;
|
||||||
|
SET sql_mode='NO_ENGINE_SUBSTITUTION';
|
||||||
|
SELECT @@sql_mode;
|
||||||
|
@@sql_mode
|
||||||
|
NO_ENGINE_SUBSTITUTION
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
SET NAMES utf8;
|
||||||
|
#
|
||||||
# End of 5.5 tests
|
# End of 5.5 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
13
mysql-test/r/events_slowlog.result
Normal file
13
mysql-test/r/events_slowlog.result
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
set @event_scheduler_save= @@global.event_scheduler;
|
||||||
|
set @slow_query_log_save= @@global.slow_query_log;
|
||||||
|
set global event_scheduler= on;
|
||||||
|
set global slow_query_log= on;
|
||||||
|
set global long_query_time=0.2;
|
||||||
|
create table t1 (i int);
|
||||||
|
insert into t1 values (0);
|
||||||
|
create event ev on schedule at CURRENT_TIMESTAMP + INTERVAL 1 second do update t1 set i=1+sleep(0.5);
|
||||||
|
FOUND /update t1 set i=1/ in mysqld-slow.log
|
||||||
|
drop table t1;
|
||||||
|
set global event_scheduler= @event_scheduler_save;
|
||||||
|
set global slow_query_log= @slow_query_log_save;
|
||||||
|
set global long_query_time= @@session.long_query_time;
|
@@ -2739,6 +2739,12 @@ id date1 date2 DATE_ADD(a.date1,INTERVAL -10 DAY) TO_DAYS(a.date1)-10
|
|||||||
18 2010-10-13 2010-10-03 2010-10-03 734413
|
18 2010-10-13 2010-10-03 2010-10-03 734413
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision()
|
||||||
|
#
|
||||||
|
SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2;
|
||||||
|
1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2
|
||||||
|
3
|
||||||
|
#
|
||||||
# Start of 10.0 tests
|
# Start of 10.0 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@@ -799,3 +799,32 @@ a b c
|
|||||||
9 d d
|
9 d d
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
set optimizer_switch= @optimizer_switch_save;
|
set optimizer_switch= @optimizer_switch_save;
|
||||||
|
#
|
||||||
|
# MDEV-10927: Crash When Using sort_union Optimization
|
||||||
|
#
|
||||||
|
set @tmp_optimizer_switch=@@optimizer_switch;
|
||||||
|
SET optimizer_switch='index_merge_sort_intersection=on';
|
||||||
|
SET SESSION sort_buffer_size = 1024;
|
||||||
|
create table t1 (
|
||||||
|
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
col1 int(11) NOT NULL,
|
||||||
|
col2 int(11) NOT NULL,
|
||||||
|
col3 int(11) NOT NULL,
|
||||||
|
key2 int(11) NOT NULL,
|
||||||
|
col4 int(11) NOT NULL,
|
||||||
|
key1 int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (pk),
|
||||||
|
KEY key1 (key1),
|
||||||
|
KEY key2 (key2)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=12860259 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||||
|
create table t2(a int);
|
||||||
|
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
|
create table t3(a int);
|
||||||
|
insert into t3 select A.a + B.a* 10 + C.a * 100 + D.a*1000 from t2 A, t2 B, t2 C, t2 D;
|
||||||
|
insert into t1 (key1, key2, col1,col2,col3,col4)
|
||||||
|
select a,a, a,a,a,a from t3;
|
||||||
|
SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 8191+10) or (key2= 5);
|
||||||
|
sum(col1)
|
||||||
|
33632261
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@tmp_optimizer_switch;
|
||||||
|
@@ -151,3 +151,11 @@ select create_options from information_schema.tables where table_schema="test";
|
|||||||
create_options
|
create_options
|
||||||
partitioned
|
partitioned
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-11353 - Identical logical conditions
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT) CHECKSUM=1 SELECT 1;
|
||||||
|
SELECT CHECKSUM FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
|
||||||
|
CHECKSUM
|
||||||
|
3036305396
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -5701,11 +5701,13 @@ LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val"
|
|||||||
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
||||||
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
||||||
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
||||||
|
LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
|
||||||
|
LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
col1;
|
col1;
|
||||||
id col1
|
id col1
|
||||||
select timestampdiff(second, @init_time, now()) <= 1;
|
select timestampdiff(second, @init_time, now()) <= 5;
|
||||||
timestampdiff(second, @init_time, now()) <= 1
|
timestampdiff(second, @init_time, now()) <= 5
|
||||||
1
|
1
|
||||||
set join_cache_level=2;
|
set join_cache_level=2;
|
||||||
set @init_time:=now();
|
set @init_time:=now();
|
||||||
@@ -5737,11 +5739,13 @@ LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val"
|
|||||||
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
||||||
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
||||||
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
||||||
|
LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
|
||||||
|
LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
col1;
|
col1;
|
||||||
id col1
|
id col1
|
||||||
select timestampdiff(second, @init_time, now()) <= 1;
|
select timestampdiff(second, @init_time, now()) <= 5;
|
||||||
timestampdiff(second, @init_time, now()) <= 1
|
timestampdiff(second, @init_time, now()) <= 5
|
||||||
1
|
1
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t.*
|
SELECT t.*
|
||||||
@@ -5772,6 +5776,8 @@ LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val"
|
|||||||
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
||||||
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
||||||
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
||||||
|
LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
|
||||||
|
LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
col1;
|
col1;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
@@ -5801,6 +5807,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE c23 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
1 SIMPLE c23 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
||||||
1 SIMPLE c24 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
1 SIMPLE c24 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
||||||
1 SIMPLE c25 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
1 SIMPLE c25 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
||||||
|
1 SIMPLE c26 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
||||||
|
1 SIMPLE c27 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
|
||||||
set join_buffer_size=default;
|
set join_buffer_size=default;
|
||||||
set join_cache_level = default;
|
set join_cache_level = default;
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
@@ -507,7 +507,7 @@ DROP TABLE t1;
|
|||||||
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
|
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
|
||||||
#
|
#
|
||||||
CREATE TABLE t1(f1 INT);
|
CREATE TABLE t1(f1 INT);
|
||||||
SELECT 0xE1C330 INTO OUTFILE 't1.dat';
|
SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
|
||||||
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
|
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
@@ -532,28 +532,21 @@ FIELDS TERMINATED BY 't' LINES TERMINATED BY '';
|
|||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
SET @@sql_mode= @old_mode;
|
SET @@sql_mode= @old_mode;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug#23080148 - Backport of Bug#20683959.
|
# MDEV-11079 Regression: LOAD DATA INFILE lost BLOB support using utf8 load files
|
||||||
# Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY
|
|
||||||
# UNDER DB CHARSET IS UTF8.
|
|
||||||
#
|
#
|
||||||
CREATE DATABASE d1 CHARSET latin1;
|
CREATE TABLE t1 (a mediumblob NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||||
USE d1;
|
LOAD DATA INFILE '../../std_data/loaddata/mdev-11079.txt' INTO TABLE t1 CHARSET utf8 FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n';
|
||||||
CREATE TABLE t1 (val TEXT);
|
SELECT HEX(a) FROM t1;
|
||||||
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
|
HEX(a)
|
||||||
SELECT COUNT(*) FROM t1;
|
25AAABAC
|
||||||
COUNT(*)
|
DROP TABLE t1;
|
||||||
1
|
#
|
||||||
SELECT HEX(val) FROM t1;
|
# MDEV-11631 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character
|
||||||
HEX(val)
|
#
|
||||||
C38322525420406E696F757A656368756E3A20E98198E2889AF58081AEE7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE78999E880B3E7B8BAEFBDAAE7B9A7E89699E296A1E7B8BAE4BBA3EFBD8CE7B8BAEFBDA9E7B8B2E2889AE38184E7B99DEFBDB3E7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE5B3A8EFBD84E8ABA0EFBDA8E89C89F580948EE599AAE7B8BAEFBDAAE7B8BAE9A198EFBDA9EFBDB1E7B9A7E581B5E289A0E7B8BAEFBDBEE7B9A7E9A194EFBDA9E882B4EFBDA5EFBDB5E980A7F5808B96E28693E99EABE38287E58F99E7B8BAE58AB1E28691E7B8BAF5808B9AE7828AE98095EFBDB1E7B8BAEFBDAFE7B8B2E288ABE6A89FE89EB3E6BA98F58081ADE88EA0EFBDBAE98095E6BA98F58081AEE89D93EFBDBAE8AD9BEFBDACE980A7F5808B96E28693E7B8BAF580918EE288AAE7B8BAE4B88AEFBC9EE7B8BAE4B99DE28691E7B8BAF5808B96EFBCA0E88DB3E6A68AEFBDB9EFBDB3E981B2E5B3A8E296A1E7B8BAE7A4BCE7828AE88DB3E6A68AEFBDB0EFBDBDE7B8BAA0E7B8BAE88B93EFBDBEE5B899EFBC9E
|
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
|
||||||
CREATE DATABASE d2 CHARSET utf8;
|
LOAD DATA INFILE '../../std_data/loaddata/mdev-11631.txt' INTO TABLE t1 CHARACTER SET utf8;
|
||||||
USE d2;
|
SELECT HEX(a) FROM t1;
|
||||||
CREATE TABLE t1 (val TEXT);
|
HEX(a)
|
||||||
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
|
C3A4
|
||||||
Warnings:
|
DROP TABLE t1;
|
||||||
Warning 1366 Incorrect string value: '\xF5\x80\x81\xAE\xE7\xB9...' for column 'val' at row 1
|
|
||||||
DROP TABLE d1.t1, d2.t1;
|
|
||||||
DROP DATABASE d1;
|
|
||||||
DROP DATABASE d2;
|
|
||||||
|
@@ -67,9 +67,9 @@ sleep(0.5)
|
|||||||
select count(*) FROM mysql.slow_log;
|
select count(*) FROM mysql.slow_log;
|
||||||
count(*)
|
count(*)
|
||||||
1
|
1
|
||||||
truncate mysql.slow_log;
|
|
||||||
set @@long_query_time=default;
|
set @@long_query_time=default;
|
||||||
set global slow_query_log= @org_slow_query_log;
|
set global slow_query_log= @org_slow_query_log;
|
||||||
set @@log_slow_filter=default;
|
set @@log_slow_filter=default;
|
||||||
set @@log_slow_verbosity=default;
|
set @@log_slow_verbosity=default;
|
||||||
set global log_output= default;
|
set global log_output= default;
|
||||||
|
truncate mysql.slow_log;
|
||||||
|
@@ -2937,6 +2937,17 @@ t2 A, t2 B
|
|||||||
where A.b = B.b
|
where A.b = B.b
|
||||||
order by A.col2, B.col2 limit 10, 1000000;
|
order by A.col2, B.col2 limit 10, 1000000;
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
#
|
||||||
|
# mdev-10705 : long order by list that can be skipped
|
||||||
|
#
|
||||||
|
SELECT 1
|
||||||
|
UNION
|
||||||
|
( SELECT 2
|
||||||
|
ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3,
|
||||||
|
@a5 := 3, @a6 := 3, @a7 := 3, @a8 := 3, @a9 := 3, @a10 := 3 );
|
||||||
|
1
|
||||||
|
1
|
||||||
|
2
|
||||||
End of 5.5 tests
|
End of 5.5 tests
|
||||||
#
|
#
|
||||||
# MDEV-5884: EXPLAIN UPDATE ... ORDER BY LIMIT shows wrong #rows
|
# MDEV-5884: EXPLAIN UPDATE ... ORDER BY LIMIT shows wrong #rows
|
||||||
|
@@ -7136,3 +7136,14 @@ sq
|
|||||||
NULL
|
NULL
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
foo bar
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -348,4 +348,49 @@ where t1.a = t2.a and ( t1.a = ( select min(a) from t1 ) or 0 );
|
|||||||
a a a
|
a a a
|
||||||
FRA FRA FRA
|
FRA FRA FRA
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
#
|
||||||
|
# MDEV-10148: Database crashes in the query to the View
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
key_code INT(11) NOT NULL,
|
||||||
|
value_string VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (key_code)
|
||||||
|
) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
key_code INT(11) NOT NULL,
|
||||||
|
target_date DATE NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (key_code)
|
||||||
|
) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
|
||||||
|
CREATE TABLE t3 (
|
||||||
|
now_date DATE NOT NULL,
|
||||||
|
PRIMARY KEY (now_date)
|
||||||
|
) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
|
||||||
|
CREATE VIEW v1
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
B.key_code,
|
||||||
|
B.target_date
|
||||||
|
FROM
|
||||||
|
t2 B INNER JOIN t3 C ON
|
||||||
|
B.target_date = C.now_date
|
||||||
|
;
|
||||||
|
SET @s = 'SELECT A.* FROM t1 A WHERE A.key_code IN (SELECT key_code FROM v1)';
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
key_code value_string
|
||||||
|
EXECUTE stmt;
|
||||||
|
key_code value_string
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
set optimizer_switch=@subselect2_test_tmp;
|
set optimizer_switch=@subselect2_test_tmp;
|
||||||
|
create table t1 (a int);
|
||||||
|
create table t2 (a int);
|
||||||
|
create table t3(a int);
|
||||||
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
|
insert into t2 select a from t1;
|
||||||
|
insert into t3 select a from t1;
|
||||||
|
select null in (select a from t1 where a < out3.a union select a from t2 where
|
||||||
|
(select a from t3) +1 < out3.a+1) from t3 out3;
|
||||||
|
ERROR 21000: Subquery returns more than 1 row
|
||||||
|
drop table t1, t2, t3;
|
||||||
|
@@ -2397,5 +2397,44 @@ SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
|
|||||||
x
|
x
|
||||||
0
|
0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-7691: Assertion `outer_context || !*from_field || *from_field == not_found_field' ...
|
||||||
|
#
|
||||||
|
set optimizer_switch=default;
|
||||||
|
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (4),(6);
|
||||||
|
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (1),(8);
|
||||||
|
PREPARE stmt FROM "
|
||||||
|
SELECT * FROM t2
|
||||||
|
HAVING 0 IN (
|
||||||
|
SELECT a FROM t1
|
||||||
|
WHERE a IN (
|
||||||
|
SELECT a FROM t1
|
||||||
|
WHERE b = a
|
||||||
|
)
|
||||||
|
)
|
||||||
|
";
|
||||||
|
EXECUTE stmt;
|
||||||
|
b
|
||||||
|
EXECUTE stmt;
|
||||||
|
b
|
||||||
|
# Alternative test case, without HAVING
|
||||||
|
CREATE TABLE t3 (i INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES (4),(6);
|
||||||
|
PREPARE stmt FROM "
|
||||||
|
SELECT * FROM t3 AS t10
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT * FROM t3 AS t20 WHERE t10.i IN (
|
||||||
|
SELECT i FROM t3
|
||||||
|
)
|
||||||
|
)";
|
||||||
|
EXECUTE stmt;
|
||||||
|
i
|
||||||
|
6
|
||||||
|
EXECUTE stmt;
|
||||||
|
i
|
||||||
|
6
|
||||||
|
drop table t1, t2, t3;
|
||||||
SET optimizer_switch= @@global.optimizer_switch;
|
SET optimizer_switch= @@global.optimizer_switch;
|
||||||
set @@tmp_table_size= @@global.tmp_table_size;
|
set @@tmp_table_size= @@global.tmp_table_size;
|
||||||
|
@@ -7136,6 +7136,17 @@ sq
|
|||||||
NULL
|
NULL
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
foo bar
|
||||||
|
DROP TABLE t1;
|
||||||
set optimizer_switch=default;
|
set optimizer_switch=default;
|
||||||
select @@optimizer_switch like '%exists_to_in=off%';
|
select @@optimizer_switch like '%exists_to_in=off%';
|
||||||
@@optimizer_switch like '%exists_to_in=off%'
|
@@optimizer_switch like '%exists_to_in=off%'
|
||||||
|
@@ -7129,6 +7129,17 @@ sq
|
|||||||
NULL
|
NULL
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
foo bar
|
||||||
|
DROP TABLE t1;
|
||||||
set optimizer_switch=default;
|
set optimizer_switch=default;
|
||||||
select @@optimizer_switch like '%materialization=on%';
|
select @@optimizer_switch like '%materialization=on%';
|
||||||
@@optimizer_switch like '%materialization=on%'
|
@@optimizer_switch like '%materialization=on%'
|
||||||
|
@@ -7127,4 +7127,15 @@ sq
|
|||||||
NULL
|
NULL
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
foo bar
|
||||||
|
DROP TABLE t1;
|
||||||
set @optimizer_switch_for_subselect_test=null;
|
set @optimizer_switch_for_subselect_test=null;
|
||||||
|
@@ -7142,6 +7142,17 @@ sq
|
|||||||
NULL
|
NULL
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
foo bar
|
||||||
|
DROP TABLE t1;
|
||||||
set optimizer_switch=default;
|
set optimizer_switch=default;
|
||||||
select @@optimizer_switch like '%subquery_cache=on%';
|
select @@optimizer_switch like '%subquery_cache=on%';
|
||||||
@@optimizer_switch like '%subquery_cache=on%'
|
@@optimizer_switch like '%subquery_cache=on%'
|
||||||
|
@@ -7127,5 +7127,16 @@ sq
|
|||||||
NULL
|
NULL
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
f1 f2
|
||||||
|
foo bar
|
||||||
|
DROP TABLE t1;
|
||||||
set @optimizer_switch_for_subselect_test=null;
|
set @optimizer_switch_for_subselect_test=null;
|
||||||
set @join_cache_level_for_subselect_test=NULL;
|
set @join_cache_level_for_subselect_test=NULL;
|
||||||
|
@@ -362,7 +362,7 @@ a
|
|||||||
2
|
2
|
||||||
select found_rows();
|
select found_rows();
|
||||||
found_rows()
|
found_rows()
|
||||||
6
|
5
|
||||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100;
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@@ -1169,12 +1169,9 @@ a b
|
|||||||
select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
||||||
a b
|
a b
|
||||||
1 a
|
1 a
|
||||||
2 b
|
|
||||||
select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
|
||||||
a b
|
a b
|
||||||
1 a
|
1 a
|
||||||
2 b
|
|
||||||
3 c
|
|
||||||
select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
|
select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
|
||||||
a b
|
a b
|
||||||
1 a
|
1 a
|
||||||
@@ -1553,7 +1550,6 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select NULL AS `a` from `test`.`t1` union select NULL AS `a` from `test`.`t1` order by `a`
|
Note 1003 select NULL AS `a` from `test`.`t1` union select NULL AS `a` from `test`.`t1` order by `a`
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.0 tests
|
|
||||||
#
|
#
|
||||||
# Bug#32858: Error: "Incorrect usage of UNION and INTO" does not take
|
# Bug#32858: Error: "Incorrect usage of UNION and INTO" does not take
|
||||||
# subselects into account
|
# subselects into account
|
||||||
@@ -1659,6 +1655,14 @@ a
|
|||||||
4
|
4
|
||||||
5
|
5
|
||||||
6
|
6
|
||||||
|
(select a from t1 where false) UNION (select a from t1) limit 8;
|
||||||
|
a
|
||||||
|
10
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
7
|
7
|
||||||
8
|
8
|
||||||
drop table t1;
|
drop table t1;
|
||||||
@@ -1955,3 +1959,22 @@ cccc
|
|||||||
bbbb
|
bbbb
|
||||||
dddd
|
dddd
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-10172: UNION query returns incorrect rows outside
|
||||||
|
# conditional evaluation
|
||||||
|
#
|
||||||
|
create table t1 (d datetime not null primary key);
|
||||||
|
insert into t1(d) values ('2016-06-01'),('2016-06-02'),('2016-06-03'),('2016-06-04');
|
||||||
|
select * from
|
||||||
|
(
|
||||||
|
select * from t1 where d between '2016-06-02' and '2016-06-05'
|
||||||
|
union
|
||||||
|
(select * from t1 where d < '2016-06-05' order by d desc limit 1)
|
||||||
|
) onlyJun2toJun4
|
||||||
|
order by d;
|
||||||
|
d
|
||||||
|
2016-06-02 00:00:00
|
||||||
|
2016-06-03 00:00:00
|
||||||
|
2016-06-04 00:00:00
|
||||||
|
drop table t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
Ã"RT @niouzechun: 遘√<E98198><E2889A><EFBFBD><EFBFBD>繝上ャ繝斐<E7B99D><E69690><EFBFBD><EFBFBD>繧ィ繝ウ繝牙耳縺ェ繧薙□縺代l縺ゥ縲√い繝ウ繝上ャ繝斐<E7B99D><E69690><EFBFBD><EFBFBD>繧ィ繝ウ繝峨d諠ィ蜉<EFBDA8><E89C89><EFBFBD><EFBFBD>噪縺ェ縺願ゥア繧偵≠縺セ繧顔ゥ肴・オ逧<EFBDB5><E980A7><EFBFBD><EFBFBD>↓鞫ょ叙縺励↑縺<E28691><E7B8BA><EFBFBD><EFBFBD>炊逕ア縺ッ縲∫樟螳溘<E89EB3><E6BA98><EFBFBD><EFBFBD>莠コ逕溘<E98095><E6BA98><EFBFBD><EFBFBD>蝓コ譛ャ逧<EFBDAC><E980A7><EFBFBD><EFBFBD>↓縺<E28693><E7B8BA><EFBFBD><EFBFBD>∪縺上>縺九↑縺<E28691><E7B8BA><EFBFBD><EFBFBD>@荳榊ケウ遲峨□縺礼炊荳榊ース縺<EFBDBD>縺苓セ帙>
|
|
1
mysql-test/std_data/loaddata/mdev-11079.txt
Normal file
1
mysql-test/std_data/loaddata/mdev-11079.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
"%<25><><EFBFBD>"
|
1
mysql-test/std_data/loaddata/mdev-11631.txt
Normal file
1
mysql-test/std_data/loaddata/mdev-11631.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
\ä
|
@@ -48,7 +48,6 @@ Warning 1264 Out of range value for column 'c2' at row 1
|
|||||||
Note 1265 Data truncated for column 'c3' at row 1
|
Note 1265 Data truncated for column 'c3' at row 1
|
||||||
insert into t2 values ("0.0","0.0","0.0",7),("-0.0","-0.0","-0.0",8),("+0.0","+0.0","+0.0",9),("01.0","01.0","01.0",10),("+01.0","+01.0","+01.0",11),("-01.0","-01.0","-01.0",12);
|
insert into t2 values ("0.0","0.0","0.0",7),("-0.0","-0.0","-0.0",8),("+0.0","+0.0","+0.0",9),("01.0","01.0","01.0",10),("+01.0","+01.0","+01.0",11),("-01.0","-01.0","-01.0",12);
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'c2' at row 2
|
|
||||||
Warning 1264 Out of range value for column 'c2' at row 6
|
Warning 1264 Out of range value for column 'c2' at row 6
|
||||||
insert into t2 values ("-.1","-.1","-.1",13),("+.1","+.1","+.1",14),(".1",".1",".1",15);
|
insert into t2 values ("-.1","-.1","-.1",13),("+.1","+.1","+.1",14),(".1",".1",".1",15);
|
||||||
Warnings:
|
Warnings:
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
# Checking of other prerequisites is in charset_master.test #
|
# Checking of other prerequisites is in charset_master.test #
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
--source include/no_valgrind_without_big.inc
|
||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
let $engine_type= InnoDB;
|
let $engine_type= InnoDB;
|
||||||
|
@@ -1,14 +1,21 @@
|
|||||||
include/master-slave.inc
|
include/master-slave.inc
|
||||||
[connection master]
|
[connection master]
|
||||||
|
|
||||||
---Setup Section --
|
---Setup Section --
|
||||||
set timestamp=1000000000;
|
set timestamp=1000000000;
|
||||||
DROP TABLE IF EXISTS t1,t2,t3;
|
|
||||||
CREATE TABLE t1(word VARCHAR(20));
|
CREATE TABLE t1(word VARCHAR(20));
|
||||||
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
|
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
|
||||||
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
|
||||||
|
INSERT INTO t1 VALUES ("abirvalg");
|
||||||
---Test1 check table load --
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
|
set @d1 = 'dd1';
|
||||||
|
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||||
|
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||||
|
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||||
|
---Test 1 check table load --
|
||||||
SELECT COUNT(*) from t1;
|
SELECT COUNT(*) from t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
351
|
351
|
||||||
@@ -71,9 +78,7 @@ c1 c3 c4 c5
|
|||||||
5 2006-02-22 00:00:00 Tested in Texas 11
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
||||||
insert into t1 values ("Alas");
|
insert into t1 values ("Alas");
|
||||||
flush logs;
|
flush logs;
|
||||||
|
|
||||||
--- Test 1 Dump binlog to file --
|
--- Test 1 Dump binlog to file --
|
||||||
|
|
||||||
--- Test 1 delete tables, clean master and slave --
|
--- Test 1 delete tables, clean master and slave --
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
@@ -84,9 +89,7 @@ reset master;
|
|||||||
reset slave;
|
reset slave;
|
||||||
start slave;
|
start slave;
|
||||||
include/wait_for_slave_to_start.inc
|
include/wait_for_slave_to_start.inc
|
||||||
|
|
||||||
--- Test 1 Load from Dump binlog file --
|
--- Test 1 Load from Dump binlog file --
|
||||||
|
|
||||||
--- Test 1 Check Load Results --
|
--- Test 1 Check Load Results --
|
||||||
SELECT COUNT(*) from t1;
|
SELECT COUNT(*) from t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
@@ -148,7 +151,6 @@ c1 c3 c4 c5
|
|||||||
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
||||||
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
||||||
5 2006-02-22 00:00:00 Tested in Texas 11
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
||||||
|
|
||||||
--- Test 2 position test --
|
--- Test 2 position test --
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
||||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
@@ -172,7 +174,6 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
||||||
|
|
||||||
--- Test 3 First Remote test --
|
--- Test 3 First Remote test --
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
||||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
@@ -189,9 +190,6 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
|
|||||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
SET @@session.lc_time_names=0/*!*/;
|
SET @@session.lc_time_names=0/*!*/;
|
||||||
SET @@session.collation_database=DEFAULT/*!*/;
|
SET @@session.collation_database=DEFAULT/*!*/;
|
||||||
DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
|
|
||||||
/*!*/;
|
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
|
||||||
CREATE TABLE t1(word VARCHAR(20))
|
CREATE TABLE t1(word VARCHAR(20))
|
||||||
/*!*/;
|
/*!*/;
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
@@ -205,7 +203,6 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
||||||
|
|
||||||
--- Test 4 Second Remote test --
|
--- Test 4 Second Remote test --
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
@@ -276,7 +273,6 @@ c1 c3 c4 c5
|
|||||||
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
3 2006-02-22 00:00:00 Tested in Texas 6.6
|
||||||
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
4 2006-02-22 00:00:00 Tested in Texas 8.8
|
||||||
5 2006-02-22 00:00:00 Tested in Texas 11
|
5 2006-02-22 00:00:00 Tested in Texas 11
|
||||||
|
|
||||||
--- Test 5 LOAD DATA --
|
--- Test 5 LOAD DATA --
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
||||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
@@ -287,7 +283,6 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
||||||
|
|
||||||
--- Test 6 reading stdin --
|
--- Test 6 reading stdin --
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
||||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
@@ -304,9 +299,6 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
|
|||||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||||
SET @@session.lc_time_names=0/*!*/;
|
SET @@session.lc_time_names=0/*!*/;
|
||||||
SET @@session.collation_database=DEFAULT/*!*/;
|
SET @@session.collation_database=DEFAULT/*!*/;
|
||||||
DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
|
|
||||||
/*!*/;
|
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
|
||||||
CREATE TABLE t1(word VARCHAR(20))
|
CREATE TABLE t1(word VARCHAR(20))
|
||||||
/*!*/;
|
/*!*/;
|
||||||
SET TIMESTAMP=1000000000/*!*/;
|
SET TIMESTAMP=1000000000/*!*/;
|
||||||
@@ -320,7 +312,6 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
||||||
|
|
||||||
--- Test 7 reading stdin w/position --
|
--- Test 7 reading stdin w/position --
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
||||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||||
@@ -344,7 +335,6 @@ DELIMITER ;
|
|||||||
ROLLBACK /* added by mysqlbinlog */;
|
ROLLBACK /* added by mysqlbinlog */;
|
||||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||||
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
||||||
|
|
||||||
--- Test 8 switch internal charset --
|
--- Test 8 switch internal charset --
|
||||||
stop slave;
|
stop slave;
|
||||||
include/wait_for_slave_to_stop.inc
|
include/wait_for_slave_to_stop.inc
|
||||||
@@ -380,14 +370,13 @@ HEX(f)
|
|||||||
select HEX(f) from t5;
|
select HEX(f) from t5;
|
||||||
HEX(f)
|
HEX(f)
|
||||||
835C
|
835C
|
||||||
|
|
||||||
--- Test cleanup --
|
--- Test cleanup --
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE t1, t2, t3, t04, t05, t4, t5;
|
||||||
CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
|
CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
|
||||||
INSERT INTO t1 VALUES(1,1);
|
INSERT INTO t1 VALUES(1,1);
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
a b
|
a b
|
||||||
1 1
|
1 1
|
||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
|
DROP TABLE t1;
|
||||||
include/rpl_end.inc
|
include/rpl_end.inc
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
include/master-slave.inc
|
include/master-slave.inc
|
||||||
[connection master]
|
[connection master]
|
||||||
call mtr.add_suppression("Cannot use utf16 as character_set_client");
|
call mtr.add_suppression("'utf16' can not be used as client character set");
|
||||||
CREATE TABLE t1(i VARCHAR(20));
|
CREATE TABLE t1(i VARCHAR(20));
|
||||||
INSERT INTO t1 VALUES (0xFFFF);
|
INSERT INTO t1 VALUES (0xFFFF);
|
||||||
include/diff_tables.inc [master:t1, slave:t1]
|
include/diff_tables.inc [master:t1, slave:t1]
|
||||||
|
@@ -4,43 +4,27 @@
|
|||||||
# Purpose: To test changes to mysqlbinlog for row based bin logs #
|
# Purpose: To test changes to mysqlbinlog for row based bin logs #
|
||||||
# We are using .opt file since we need small binlog size #
|
# We are using .opt file since we need small binlog size #
|
||||||
##################################################################
|
##################################################################
|
||||||
# Include Section
|
|
||||||
# Make sure that we have row based bin log
|
|
||||||
-- source include/have_binlog_format_row.inc
|
-- source include/have_binlog_format_row.inc
|
||||||
# Embedded server doesn't support binlogging
|
|
||||||
-- source include/not_embedded.inc
|
-- source include/not_embedded.inc
|
||||||
# This test requires the cp932 charset compiled in
|
|
||||||
-- source include/have_cp932.inc
|
-- source include/have_cp932.inc
|
||||||
# Slow test, don't run during staging part
|
|
||||||
-- source include/not_staging.inc
|
|
||||||
|
|
||||||
-- source include/master-slave.inc
|
-- source include/master-slave.inc
|
||||||
|
|
||||||
# Setup Section
|
--echo ---Setup Section --
|
||||||
|
|
||||||
# we need this for getting fixed timestamps inside of this test
|
# we need this for getting fixed timestamps inside of this test
|
||||||
|
|
||||||
--disable_query_log
|
|
||||||
select "---Setup Section --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
set timestamp=1000000000;
|
set timestamp=1000000000;
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
DROP TABLE IF EXISTS t1,t2,t3;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
connection master;
|
|
||||||
CREATE TABLE t1(word VARCHAR(20));
|
CREATE TABLE t1(word VARCHAR(20));
|
||||||
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
|
CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY);
|
||||||
--let $position= query_get_value(SHOW MASTER STATUS, Position, 1)
|
--let position= query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||||
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
|
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT);
|
||||||
--let $stop_position=query_get_value(SHOW MASTER STATUS, Position, 1)
|
--let stop_position=query_get_value(SHOW MASTER STATUS, Position, 1)
|
||||||
--let $stop_position1=`select $stop_position - 1`
|
--let stop_position1=`select $stop_position - 1`
|
||||||
--let $binlog_start_pos=query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
|
--let binlog_start_pos=query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
|
||||||
|
|
||||||
# Test Section
|
# Test Section
|
||||||
# Lets start by putting some data into the tables.
|
# Lets start by putting some data into the tables.
|
||||||
|
|
||||||
--disable_query_log
|
|
||||||
INSERT INTO t1 VALUES ("abirvalg");
|
INSERT INTO t1 VALUES ("abirvalg");
|
||||||
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
|
||||||
@@ -54,7 +38,8 @@ set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
|||||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||||
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
|
||||||
|
|
||||||
let $count=500;
|
--disable_query_log
|
||||||
|
let count=500;
|
||||||
while ($count)
|
while ($count)
|
||||||
{
|
{
|
||||||
INSERT INTO t2 VALUES (NULL);
|
INSERT INTO t2 VALUES (NULL);
|
||||||
@@ -63,10 +48,7 @@ while ($count)
|
|||||||
}
|
}
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
|
||||||
|
--echo ---Test 1 check table load --
|
||||||
--disable_query_log
|
|
||||||
select "---Test1 check table load --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
# Lets Check the tables on the Master
|
# Lets Check the tables on the Master
|
||||||
SELECT COUNT(*) from t1;
|
SELECT COUNT(*) from t1;
|
||||||
@@ -95,34 +77,26 @@ insert into t1 values ("Alas");
|
|||||||
flush logs;
|
flush logs;
|
||||||
|
|
||||||
# delimiters are for easier debugging in future
|
# delimiters are for easier debugging in future
|
||||||
--disable_query_log
|
--echo --- Test 1 Dump binlog to file --
|
||||||
select "--- Test 1 Dump binlog to file --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Prepare local temporary file to recreate what we have currently.
|
# Prepare local temporary file to recreate what we have currently.
|
||||||
let $MYSQLD_DATADIR= `select @@datadir;`;
|
let MYSQLD_DATADIR= `select @@datadir;`;
|
||||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
|
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
|
||||||
|
|
||||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
|
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
|
||||||
|
|
||||||
# Now that we have our file, lets get rid of the current database.
|
# Now that we have our file, lets get rid of the current database.
|
||||||
# Cleanup the master and the slave and try to recreate.
|
# Cleanup the master and the slave and try to recreate.
|
||||||
--disable_query_log
|
--echo --- Test 1 delete tables, clean master and slave --
|
||||||
select "--- Test 1 delete tables, clean master and slave --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t3;
|
DROP TABLE t3;
|
||||||
|
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
#we expect STOP SLAVE to produce a warning as the slave is stopped
|
|
||||||
#(the server was started with skip-slave-start)
|
|
||||||
--disable_warnings
|
|
||||||
stop slave;
|
stop slave;
|
||||||
--source include/wait_for_slave_to_stop.inc
|
--source include/wait_for_slave_to_stop.inc
|
||||||
--enable_warnings
|
|
||||||
connection master;
|
connection master;
|
||||||
reset master;
|
reset master;
|
||||||
connection slave;
|
connection slave;
|
||||||
@@ -132,15 +106,11 @@ start slave;
|
|||||||
connection master;
|
connection master;
|
||||||
|
|
||||||
# We should be clean at this point, now we will run in the file from above.
|
# We should be clean at this point, now we will run in the file from above.
|
||||||
--disable_query_log
|
--echo --- Test 1 Load from Dump binlog file --
|
||||||
select "--- Test 1 Load from Dump binlog file --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql"
|
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql"
|
||||||
|
|
||||||
--disable_query_log
|
--echo --- Test 1 Check Load Results --
|
||||||
select "--- Test 1 Check Load Results --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
# Lets Check the tables on the Master
|
# Lets Check the tables on the Master
|
||||||
SELECT COUNT(*) from t1;
|
SELECT COUNT(*) from t1;
|
||||||
@@ -168,28 +138,20 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
|
|||||||
|
|
||||||
# this test for start-position option
|
# this test for start-position option
|
||||||
# By setting this position to 416, we should only get the create of t3
|
# By setting this position to 416, we should only get the create of t3
|
||||||
--disable_query_log
|
--echo --- Test 2 position test --
|
||||||
select "--- Test 2 position test --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
let $MYSQLD_DATADIR= `select @@datadir;`;
|
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$position --stop-position=$stop_position $MYSQLD_DATADIR/master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$position --stop-position=$stop_position $MYSQLD_DATADIR/master-bin.000001
|
||||||
|
|
||||||
# These are tests for remote binlog.
|
# These are tests for remote binlog.
|
||||||
# They should return the same as previous test.
|
# They should return the same as previous test.
|
||||||
|
|
||||||
--disable_query_log
|
--echo --- Test 3 First Remote test --
|
||||||
select "--- Test 3 First Remote test --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
|
|
||||||
# This is broken now
|
# This is broken now
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
|
||||||
|
|
||||||
--disable_query_log
|
--echo --- Test 4 Second Remote test --
|
||||||
select "--- Test 4 Second Remote test --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
|
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
|
||||||
|
|
||||||
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql
|
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql
|
||||||
|
|
||||||
# Now that we have our file, lets get rid of the current database.
|
# Now that we have our file, lets get rid of the current database.
|
||||||
@@ -201,13 +163,8 @@ DROP TABLE t3;
|
|||||||
|
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
||||||
#we expect STOP SLAVE to produce a warning as the slave is stopped
|
|
||||||
#(the server was started with skip-slave-start)
|
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
stop slave;
|
stop slave;
|
||||||
--source include/wait_for_slave_to_stop.inc
|
--source include/wait_for_slave_to_stop.inc
|
||||||
--enable_warnings
|
|
||||||
connection master;
|
connection master;
|
||||||
reset master;
|
reset master;
|
||||||
connection slave;
|
connection slave;
|
||||||
@@ -251,40 +208,26 @@ connection master;
|
|||||||
# transactions. /Matz
|
# transactions. /Matz
|
||||||
|
|
||||||
# LOAD DATA
|
# LOAD DATA
|
||||||
--disable_query_log
|
--echo --- Test 5 LOAD DATA --
|
||||||
select "--- Test 5 LOAD DATA --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
|
||||||
|
|
||||||
# Bug#7853 (mysqlbinlog does not accept input from stdin)
|
# Bug#7853 (mysqlbinlog does not accept input from stdin)
|
||||||
|
|
||||||
--disable_query_log
|
--echo --- Test 6 reading stdin --
|
||||||
select "--- Test 6 reading stdin --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
let $MYSQLD_DATADIR= `select @@datadir;`;
|
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_position1 - < $MYSQLD_DATADIR/master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_position1 - < $MYSQLD_DATADIR/master-bin.000001
|
||||||
|
|
||||||
--disable_query_log
|
--echo --- Test 7 reading stdin w/position --
|
||||||
select "--- Test 7 reading stdin w/position --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||||
--exec $MYSQL_BINLOG --short-form --start-position=$position --stop-position=$stop_position - < $MYSQLD_DATADIR/master-bin.000001
|
--exec $MYSQL_BINLOG --short-form --start-position=$position --stop-position=$stop_position - < $MYSQLD_DATADIR/master-bin.000001
|
||||||
|
|
||||||
# Bug#16217 (mysql client did not know how not switch its internal charset)
|
# Bug#16217 (mysql client did not know how not switch its internal charset)
|
||||||
--disable_query_log
|
--echo --- Test 8 switch internal charset --
|
||||||
select "--- Test 8 switch internal charset --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
||||||
#we expect STOP SLAVE to produce a warning as the slave is stopped
|
|
||||||
#(the server was started with skip-slave-start)
|
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
stop slave;
|
stop slave;
|
||||||
--source include/wait_for_slave_to_stop.inc
|
--source include/wait_for_slave_to_stop.inc
|
||||||
--enable_warnings
|
|
||||||
connection master;
|
connection master;
|
||||||
reset master;
|
reset master;
|
||||||
connection slave;
|
connection slave;
|
||||||
@@ -297,7 +240,6 @@ create table t4 (f text character set utf8);
|
|||||||
create table t5 (f text character set cp932);
|
create table t5 (f text character set cp932);
|
||||||
--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')"
|
--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')"
|
||||||
--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'<27>\');"
|
--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'<27>\');"
|
||||||
let $MYSQLD_DATADIR= `select @@datadir;`;
|
|
||||||
flush logs;
|
flush logs;
|
||||||
rename table t4 to t04, t5 to t05;
|
rename table t4 to t04, t5 to t05;
|
||||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
|
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
|
||||||
@@ -314,42 +256,30 @@ select HEX(f) from t4;
|
|||||||
select HEX(f) from t05;
|
select HEX(f) from t05;
|
||||||
select HEX(f) from t5;
|
select HEX(f) from t5;
|
||||||
|
|
||||||
--disable_query_log
|
--echo --- Test cleanup --
|
||||||
select "--- Test cleanup --" as "";
|
|
||||||
--enable_query_log
|
|
||||||
# clean up
|
# clean up
|
||||||
connection master;
|
connection master;
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
||||||
connection master;
|
connection master;
|
||||||
|
DROP TABLE t1, t2, t3, t04, t05, t4, t5;
|
||||||
|
|
||||||
# BUG#17654 also test mysqlbinlog to ensure it can read the binlog from a remote server
|
# BUG#17654 also test mysqlbinlog to ensure it can read the binlog from a remote server
|
||||||
# and ensure that the results are the same as if read from a file (the same file).
|
# and ensure that the results are the same as if read from a file (the same file).
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
DROP TABLE IF EXISTS t1;
|
|
||||||
--enable_warnings
|
|
||||||
|
|
||||||
CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
|
CREATE TABLE t1 (a INT NOT NULL KEY, b INT);
|
||||||
|
|
||||||
INSERT INTO t1 VALUES(1,1);
|
INSERT INTO t1 VALUES(1,1);
|
||||||
|
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
|
|
||||||
let $MYSQLD_DATADIR= `select @@datadir;`;
|
|
||||||
|
|
||||||
FLUSH LOGS;
|
FLUSH LOGS;
|
||||||
|
|
||||||
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
|
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
|
||||||
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
|
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
|
||||||
|
|
||||||
--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
|
--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
|
||||||
|
|
||||||
--remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
|
--remove_file $MYSQLTEST_VARDIR/tmp/remote.sql
|
||||||
|
|
||||||
--remove_file $MYSQLTEST_VARDIR/tmp/local.sql
|
--remove_file $MYSQLTEST_VARDIR/tmp/local.sql
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5;
|
|
||||||
sync_slave_with_master;
|
sync_slave_with_master;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
# then set default's client character set(latin1) as client's character set.
|
# then set default's client character set(latin1) as client's character set.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
--source include/master-slave.inc
|
--source include/master-slave.inc
|
||||||
call mtr.add_suppression("Cannot use utf16 as character_set_client");
|
call mtr.add_suppression("'utf16' can not be used as client character set");
|
||||||
CREATE TABLE t1(i VARCHAR(20));
|
CREATE TABLE t1(i VARCHAR(20));
|
||||||
INSERT INTO t1 VALUES (0xFFFF);
|
INSERT INTO t1 VALUES (0xFFFF);
|
||||||
--sync_slave_with_master
|
--sync_slave_with_master
|
||||||
|
@@ -2081,6 +2081,15 @@ DELIMITER ;|
|
|||||||
create table t1 as select f1();
|
create table t1 as select f1();
|
||||||
drop function f1;
|
drop function f1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-10274 Bundling insert with create statement
|
||||||
|
--echo # for table with unsigned Decimal primary key issues warning 1194
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1(ID decimal(2,1) unsigned NOT NULL, PRIMARY KEY (ID))engine=memory
|
||||||
|
select 2.1 ID;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo End of 5.5 tests
|
--echo End of 5.5 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -811,6 +811,14 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _ucs2 0x0061));
|
|||||||
SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061));
|
SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061));
|
||||||
SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061));
|
SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061));
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
|
||||||
|
--echo #
|
||||||
|
SET character_set_connection=ucs2;
|
||||||
|
SET sql_mode='NO_ENGINE_SUBSTITUTION';
|
||||||
|
SELECT @@sql_mode;
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
SET NAMES utf8;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.5 tests
|
--echo # End of 5.5 tests
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
-- source include/have_ucs2.inc
|
-- source include/have_ucs2.inc
|
||||||
|
|
||||||
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
|
call mtr.add_suppression("'ucs2' can not be used as client character set");
|
||||||
|
|
||||||
#
|
#
|
||||||
# MySQL Bug#15276: MySQL ignores collation-server
|
# MySQL Bug#15276: MySQL ignores collation-server
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
-- source include/have_query_cache.inc
|
-- source include/have_query_cache.inc
|
||||||
-- source include/have_ucs2.inc
|
-- source include/have_ucs2.inc
|
||||||
|
|
||||||
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
|
call mtr.add_suppression("'ucs2' can not be used as client character set");
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Start of 5.5 tests
|
--echo # Start of 5.5 tests
|
||||||
|
@@ -795,6 +795,15 @@ DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
|
|||||||
--error ER_INVALID_CHARACTER_STRING
|
--error ER_INVALID_CHARACTER_STRING
|
||||||
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
|
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
|
||||||
|
--echo #
|
||||||
|
SET character_set_connection=utf16;
|
||||||
|
SET sql_mode='NO_ENGINE_SUBSTITUTION';
|
||||||
|
SELECT @@sql_mode;
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
SET NAMES utf8;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.5 tests
|
--echo # End of 5.5 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
--source include/have_utf16.inc
|
--source include/have_utf16.inc
|
||||||
call mtr.add_suppression("Cannot use utf16 as character_set_client");
|
call mtr.add_suppression("'utf16' can not be used as client character set");
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #32391 Character sets: crash with --character-set-server
|
# Bug #32391 Character sets: crash with --character-set-server
|
||||||
|
@@ -894,6 +894,15 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061));
|
|||||||
#
|
#
|
||||||
select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
|
select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
|
||||||
|
--echo #
|
||||||
|
SET character_set_connection=utf32;
|
||||||
|
SET sql_mode='NO_ENGINE_SUBSTITUTION';
|
||||||
|
SELECT @@sql_mode;
|
||||||
|
SET sql_mode=DEFAULT;
|
||||||
|
SET NAMES utf8;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.5 tests
|
--echo # End of 5.5 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
28
mysql-test/t/events_slowlog.test
Normal file
28
mysql-test/t/events_slowlog.test
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
--source include/not_embedded.inc
|
||||||
|
#
|
||||||
|
# MDEV-11552 Queries executed by event scheduler are written to slow log incorrectly or not written at all
|
||||||
|
#
|
||||||
|
set @event_scheduler_save= @@global.event_scheduler;
|
||||||
|
set @slow_query_log_save= @@global.slow_query_log;
|
||||||
|
|
||||||
|
set global event_scheduler= on;
|
||||||
|
set global slow_query_log= on;
|
||||||
|
set global long_query_time=0.2;
|
||||||
|
|
||||||
|
create table t1 (i int);
|
||||||
|
insert into t1 values (0);
|
||||||
|
create event ev on schedule at CURRENT_TIMESTAMP + INTERVAL 1 second do update t1 set i=1+sleep(0.5);
|
||||||
|
|
||||||
|
--let wait_condition= select i from t1 where i > 0
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
|
--let SEARCH_FILE = `SELECT @@slow_query_log_file`
|
||||||
|
--let SEARCH_PATTERN= update t1 set i=1
|
||||||
|
--let SEARCH_RANGE= -1000
|
||||||
|
--source include/search_pattern_in_file.inc
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
set global event_scheduler= @event_scheduler_save;
|
||||||
|
set global slow_query_log= @slow_query_log_save;
|
||||||
|
set global long_query_time= @@session.long_query_time;
|
@@ -1668,6 +1668,11 @@ INSERT INTO t1 VALUES (18, '2010-10-13');
|
|||||||
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
|
SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision()
|
||||||
|
--echo #
|
||||||
|
SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2;
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Start of 10.0 tests
|
--echo # Start of 10.0 tests
|
||||||
|
@@ -171,6 +171,37 @@ WHERE ( tb.b != ta.b OR tb.a = ta.a )
|
|||||||
AND ( tb.b = ta.c OR tb.b = ta.b );
|
AND ( tb.b = ta.c OR tb.b = ta.b );
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
set optimizer_switch= @optimizer_switch_save;
|
set optimizer_switch= @optimizer_switch_save;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-10927: Crash When Using sort_union Optimization
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
set @tmp_optimizer_switch=@@optimizer_switch;
|
||||||
|
SET optimizer_switch='index_merge_sort_intersection=on';
|
||||||
|
SET SESSION sort_buffer_size = 1024;
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
col1 int(11) NOT NULL,
|
||||||
|
col2 int(11) NOT NULL,
|
||||||
|
col3 int(11) NOT NULL,
|
||||||
|
key2 int(11) NOT NULL,
|
||||||
|
col4 int(11) NOT NULL,
|
||||||
|
key1 int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (pk),
|
||||||
|
KEY key1 (key1),
|
||||||
|
KEY key2 (key2)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=12860259 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
|
||||||
|
|
||||||
|
create table t2(a int);
|
||||||
|
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
|
|
||||||
|
create table t3(a int);
|
||||||
|
insert into t3 select A.a + B.a* 10 + C.a * 100 + D.a*1000 from t2 A, t2 B, t2 C, t2 D;
|
||||||
|
|
||||||
|
insert into t1 (key1, key2, col1,col2,col3,col4)
|
||||||
|
select a,a, a,a,a,a from t3;
|
||||||
|
SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 8191+10) or (key2= 5);
|
||||||
|
drop table t1,t2,t3;
|
||||||
|
set optimizer_switch=@tmp_optimizer_switch;
|
||||||
|
@@ -131,3 +131,10 @@ drop table if exists t1;
|
|||||||
create table t1 (f1 int key) partition by key(f1) partitions 2;
|
create table t1 (f1 int key) partition by key(f1) partitions 2;
|
||||||
select create_options from information_schema.tables where table_schema="test";
|
select create_options from information_schema.tables where table_schema="test";
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-11353 - Identical logical conditions
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1(a INT) CHECKSUM=1 SELECT 1;
|
||||||
|
SELECT CHECKSUM FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -3708,9 +3708,11 @@ FROM
|
|||||||
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
||||||
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
||||||
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
||||||
|
LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
|
||||||
|
LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
col1;
|
col1;
|
||||||
select timestampdiff(second, @init_time, now()) <= 1;
|
select timestampdiff(second, @init_time, now()) <= 5;
|
||||||
|
|
||||||
set join_cache_level=2;
|
set join_cache_level=2;
|
||||||
|
|
||||||
@@ -3743,9 +3745,11 @@ FROM
|
|||||||
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
||||||
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
||||||
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
||||||
|
LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
|
||||||
|
LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
col1;
|
col1;
|
||||||
select timestampdiff(second, @init_time, now()) <= 1;
|
select timestampdiff(second, @init_time, now()) <= 5;
|
||||||
|
|
||||||
EXPLAIN
|
EXPLAIN
|
||||||
SELECT t.*
|
SELECT t.*
|
||||||
@@ -3776,6 +3780,8 @@ FROM
|
|||||||
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
|
||||||
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
|
||||||
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
|
||||||
|
LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
|
||||||
|
LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
|
||||||
ORDER BY
|
ORDER BY
|
||||||
col1;
|
col1;
|
||||||
|
|
||||||
|
@@ -612,7 +612,7 @@ disconnect con1;
|
|||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
CREATE TABLE t1(f1 INT);
|
CREATE TABLE t1(f1 INT);
|
||||||
EVAL SELECT 0xE1C330 INTO OUTFILE 't1.dat';
|
EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
|
LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
@@ -658,25 +658,21 @@ SET @@sql_mode= @old_mode;
|
|||||||
--remove_file $MYSQLTEST_VARDIR/mysql
|
--remove_file $MYSQLTEST_VARDIR/mysql
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#23080148 - Backport of Bug#20683959.
|
--echo # MDEV-11079 Regression: LOAD DATA INFILE lost BLOB support using utf8 load files
|
||||||
--echo # Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY
|
|
||||||
--echo # UNDER DB CHARSET IS UTF8.
|
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
CREATE DATABASE d1 CHARSET latin1;
|
CREATE TABLE t1 (a mediumblob NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||||
USE d1;
|
LOAD DATA INFILE '../../std_data/loaddata/mdev-11079.txt' INTO TABLE t1 CHARSET utf8 FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n';
|
||||||
CREATE TABLE t1 (val TEXT);
|
SELECT HEX(a) FROM t1;
|
||||||
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
|
DROP TABLE t1;
|
||||||
SELECT COUNT(*) FROM t1;
|
|
||||||
SELECT HEX(val) FROM t1;
|
|
||||||
|
|
||||||
CREATE DATABASE d2 CHARSET utf8;
|
--echo #
|
||||||
USE d2;
|
--echo # MDEV-11631 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character
|
||||||
CREATE TABLE t1 (val TEXT);
|
--echo #
|
||||||
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
|
|
||||||
|
|
||||||
DROP TABLE d1.t1, d2.t1;
|
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
|
||||||
DROP DATABASE d1;
|
LOAD DATA INFILE '../../std_data/loaddata/mdev-11631.txt' INTO TABLE t1 CHARACTER SET utf8;
|
||||||
DROP DATABASE d2;
|
SELECT HEX(a) FROM t1;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -50,7 +50,6 @@ set global slow_query_log=1;
|
|||||||
set global log_output='TABLE';
|
set global log_output='TABLE';
|
||||||
select sleep(0.5);
|
select sleep(0.5);
|
||||||
select count(*) FROM mysql.slow_log;
|
select count(*) FROM mysql.slow_log;
|
||||||
truncate mysql.slow_log;
|
|
||||||
|
|
||||||
# Reset used variables
|
# Reset used variables
|
||||||
set @@long_query_time=default;
|
set @@long_query_time=default;
|
||||||
@@ -58,3 +57,4 @@ set global slow_query_log= @org_slow_query_log;
|
|||||||
set @@log_slow_filter=default;
|
set @@log_slow_filter=default;
|
||||||
set @@log_slow_verbosity=default;
|
set @@log_slow_verbosity=default;
|
||||||
set global log_output= default;
|
set global log_output= default;
|
||||||
|
truncate mysql.slow_log;
|
||||||
|
@@ -1945,6 +1945,16 @@ order by A.col2, B.col2 limit 10, 1000000;
|
|||||||
|
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # mdev-10705 : long order by list that can be skipped
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SELECT 1
|
||||||
|
UNION
|
||||||
|
( SELECT 2
|
||||||
|
ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3,
|
||||||
|
@a5 := 3, @a6 := 3, @a7 := 3, @a8 := 3, @a9 := 3, @a10 := 3 );
|
||||||
|
|
||||||
--echo End of 5.5 tests
|
--echo End of 5.5 tests
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@@ -6011,3 +6011,13 @@ SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
|
|||||||
|
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
|
||||||
|
INSERT INTO t1 VALUES ('foo','bar');
|
||||||
|
SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
|
||||||
|
SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
|
||||||
|
DROP TABLE t1;
|
||||||
|
@@ -359,5 +359,55 @@ where t1.a = t2.a and ( t1.a = ( select min(a) from t1 ) or 0 );
|
|||||||
|
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-10148: Database crashes in the query to the View
|
||||||
|
--echo #
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
key_code INT(11) NOT NULL,
|
||||||
|
value_string VARCHAR(50) NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (key_code)
|
||||||
|
) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
key_code INT(11) NOT NULL,
|
||||||
|
target_date DATE NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (key_code)
|
||||||
|
) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
|
||||||
|
|
||||||
|
CREATE TABLE t3 (
|
||||||
|
now_date DATE NOT NULL,
|
||||||
|
PRIMARY KEY (now_date)
|
||||||
|
) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
|
||||||
|
|
||||||
|
CREATE VIEW v1
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
B.key_code,
|
||||||
|
B.target_date
|
||||||
|
FROM
|
||||||
|
t2 B INNER JOIN t3 C ON
|
||||||
|
B.target_date = C.now_date
|
||||||
|
;
|
||||||
|
SET @s = 'SELECT A.* FROM t1 A WHERE A.key_code IN (SELECT key_code FROM v1)';
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt; #1st time -> success
|
||||||
|
EXECUTE stmt; #2nd time -> crash
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
set optimizer_switch=@subselect2_test_tmp;
|
set optimizer_switch=@subselect2_test_tmp;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #23303485 : HANDLE_FATAL_SIGNAL (SIG=11) IN SUBSELECT_UNION_ENGINE::NO_ROWS
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
create table t2 (a int);
|
||||||
|
create table t3(a int);
|
||||||
|
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
|
insert into t2 select a from t1;
|
||||||
|
insert into t3 select a from t1;
|
||||||
|
--error ER_SUBQUERY_NO_1_ROW
|
||||||
|
select null in (select a from t1 where a < out3.a union select a from t2 where
|
||||||
|
(select a from t3) +1 < out3.a+1) from t3 out3;
|
||||||
|
drop table t1, t2, t3;
|
||||||
|
@@ -1956,5 +1956,46 @@ SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-7691: Assertion `outer_context || !*from_field || *from_field == not_found_field' ...
|
||||||
|
--echo #
|
||||||
|
set optimizer_switch=default;
|
||||||
|
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES (4),(6);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t2 VALUES (1),(8);
|
||||||
|
|
||||||
|
PREPARE stmt FROM "
|
||||||
|
SELECT * FROM t2
|
||||||
|
HAVING 0 IN (
|
||||||
|
SELECT a FROM t1
|
||||||
|
WHERE a IN (
|
||||||
|
SELECT a FROM t1
|
||||||
|
WHERE b = a
|
||||||
|
)
|
||||||
|
)
|
||||||
|
";
|
||||||
|
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
--echo # Alternative test case, without HAVING
|
||||||
|
CREATE TABLE t3 (i INT) ENGINE=MyISAM;
|
||||||
|
INSERT INTO t3 VALUES (4),(6);
|
||||||
|
|
||||||
|
PREPARE stmt FROM "
|
||||||
|
SELECT * FROM t3 AS t10
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT * FROM t3 AS t20 WHERE t10.i IN (
|
||||||
|
SELECT i FROM t3
|
||||||
|
)
|
||||||
|
)";
|
||||||
|
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
drop table t1, t2, t3;
|
||||||
|
|
||||||
SET optimizer_switch= @@global.optimizer_switch;
|
SET optimizer_switch= @@global.optimizer_switch;
|
||||||
set @@tmp_table_size= @@global.tmp_table_size;
|
set @@tmp_table_size= @@global.tmp_table_size;
|
||||||
|
@@ -1022,7 +1022,6 @@ ORDER BY a;
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
|
||||||
-- echo #
|
-- echo #
|
||||||
-- echo # Bug#32858: Error: "Incorrect usage of UNION and INTO" does not take
|
-- echo # Bug#32858: Error: "Incorrect usage of UNION and INTO" does not take
|
||||||
-- echo # subselects into account
|
-- echo # subselects into account
|
||||||
@@ -1126,6 +1125,8 @@ create table t1 (a int);
|
|||||||
insert into t1 values (10),(10),(10),(2),(3),(4),(5),(6),(7),(8),(9),(1),(10);
|
insert into t1 values (10),(10),(10),(2),(3),(4),(5),(6),(7),(8),(9),(1),(10);
|
||||||
--sorted_result
|
--sorted_result
|
||||||
select a from t1 where false UNION select a from t1 limit 8;
|
select a from t1 where false UNION select a from t1 limit 8;
|
||||||
|
--sorted_result
|
||||||
|
(select a from t1 where false) UNION (select a from t1) limit 8;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
@@ -1350,3 +1351,22 @@ UNION
|
|||||||
;
|
;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-10172: UNION query returns incorrect rows outside
|
||||||
|
--echo # conditional evaluation
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (d datetime not null primary key);
|
||||||
|
insert into t1(d) values ('2016-06-01'),('2016-06-02'),('2016-06-03'),('2016-06-04');
|
||||||
|
select * from
|
||||||
|
(
|
||||||
|
select * from t1 where d between '2016-06-02' and '2016-06-05'
|
||||||
|
union
|
||||||
|
(select * from t1 where d < '2016-06-05' order by d desc limit 1)
|
||||||
|
) onlyJun2toJun4
|
||||||
|
order by d;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
@@ -967,6 +967,14 @@
|
|||||||
fun:backtrace
|
fun:backtrace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
memory leak in mysqld_exit
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:malloc
|
||||||
|
fun:_dl_close_worker
|
||||||
|
fun:_dl_close
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug in Glibc 2.9: http://sourceware.org/bugzilla/show_bug.cgi?id=10391
|
# Bug in Glibc 2.9: http://sourceware.org/bugzilla/show_bug.cgi?id=10391
|
||||||
# Fixed in latest Glibc, but suppressed here for running tests on hosts
|
# Fixed in latest Glibc, but suppressed here for running tests on hosts
|
||||||
|
@@ -46,7 +46,7 @@ IF (WIN32)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_addr_resolve.c)
|
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_addr_resolve.c my_setuser.c)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(HAVE_ALARM)
|
IF(HAVE_ALARM)
|
||||||
|
82
mysys/my_setuser.c
Normal file
82
mysys/my_setuser.c
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#include <my_global.h>
|
||||||
|
#include <m_string.h>
|
||||||
|
#include <my_sys.h>
|
||||||
|
#include <my_pthread.h>
|
||||||
|
#ifdef HAVE_PWD_H
|
||||||
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_GRP_H
|
||||||
|
#include <grp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct passwd *my_check_user(const char *user, myf MyFlags)
|
||||||
|
{
|
||||||
|
struct passwd *user_info;
|
||||||
|
uid_t user_id= geteuid();
|
||||||
|
DBUG_ENTER("my_check_user");
|
||||||
|
|
||||||
|
// Don't bother if we aren't superuser
|
||||||
|
if (user_id)
|
||||||
|
{
|
||||||
|
if (user)
|
||||||
|
{
|
||||||
|
/* Don't give a warning, if real user is same as given with --user */
|
||||||
|
user_info= getpwnam(user);
|
||||||
|
if (!user_info || user_id != user_info->pw_uid)
|
||||||
|
{
|
||||||
|
my_errno= EPERM;
|
||||||
|
if (MyFlags & MY_WME)
|
||||||
|
my_printf_error(my_errno, "One can only use the --user switch if "
|
||||||
|
"running as root", MYF(ME_JUST_WARNING|ME_NOREFRESH));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DBUG_RETURN(NULL);
|
||||||
|
}
|
||||||
|
if (!user)
|
||||||
|
{
|
||||||
|
if (MyFlags & MY_FAE)
|
||||||
|
{
|
||||||
|
my_errno= EINVAL;
|
||||||
|
my_printf_error(my_errno, "Please consult the Knowledge Base to find "
|
||||||
|
"out how to run mysqld as root!", MYF(ME_NOREFRESH));
|
||||||
|
}
|
||||||
|
DBUG_RETURN(NULL);
|
||||||
|
}
|
||||||
|
if (!strcmp(user,"root"))
|
||||||
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
|
if (!(user_info= getpwnam(user)))
|
||||||
|
{
|
||||||
|
// Allow a numeric uid to be used
|
||||||
|
int err= 0;
|
||||||
|
user_id= my_strtoll10(user, NULL, &err);
|
||||||
|
if (err || !(user_info= getpwuid(user_id)))
|
||||||
|
{
|
||||||
|
my_errno= EINVAL;
|
||||||
|
my_printf_error(my_errno, "Can't change to run as user '%s'. Please "
|
||||||
|
"check that the user exists!", MYF(ME_NOREFRESH), user);
|
||||||
|
DBUG_RETURN(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DBUG_ASSERT(user_info);
|
||||||
|
DBUG_RETURN(user_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
int my_set_user(const char *user, struct passwd *user_info, myf MyFlags)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("my_set_user");
|
||||||
|
|
||||||
|
DBUG_ASSERT(user_info != 0);
|
||||||
|
#ifdef HAVE_INITGROUPS
|
||||||
|
initgroups(user, user_info->pw_gid);
|
||||||
|
#endif
|
||||||
|
if (setgid(user_info->pw_gid) == -1 || setuid(user_info->pw_uid) == -1)
|
||||||
|
{
|
||||||
|
my_errno= errno;
|
||||||
|
if (MyFlags & MY_WME)
|
||||||
|
my_printf_error(errno, "Cannot change uid/gid (errno: %d)", MYF(ME_NOREFRESH),
|
||||||
|
errno);
|
||||||
|
DBUG_RETURN(my_errno);
|
||||||
|
}
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
@@ -2843,6 +2843,7 @@ void __attribute__ ((constructor)) audit_plugin_so_init(void)
|
|||||||
_mysql_plugin_declarations_[0].info= mysql_v4_descriptor;
|
_mysql_plugin_declarations_[0].info= mysql_v4_descriptor;
|
||||||
use_event_data_for_disconnect= 1;
|
use_event_data_for_disconnect= 1;
|
||||||
}
|
}
|
||||||
|
MYSQL_SYSVAR_NAME(loc_info).flags= PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(locinfo_ini_value, 'O', sizeof(locinfo_ini_value)-1);
|
memset(locinfo_ini_value, 'O', sizeof(locinfo_ini_value)-1);
|
||||||
|
@@ -20,6 +20,7 @@ mysqld_ld_preload=
|
|||||||
mysqld_ld_library_path=
|
mysqld_ld_library_path=
|
||||||
flush_caches=0
|
flush_caches=0
|
||||||
numa_interleave=0
|
numa_interleave=0
|
||||||
|
unsafe_my_cnf=0
|
||||||
|
|
||||||
# Initial logging status: error log is not open, and not using syslog
|
# Initial logging status: error log is not open, and not using syslog
|
||||||
logging=init
|
logging=init
|
||||||
@@ -129,6 +130,18 @@ my_which ()
|
|||||||
return $ret # Success
|
return $ret # Success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find_in_bin() {
|
||||||
|
if test -x "$MY_BASEDIR_VERSION/bin/$1"
|
||||||
|
then
|
||||||
|
echo "$MY_BASEDIR_VERSION/bin/$1"
|
||||||
|
elif test -x "@bindir@/$1"
|
||||||
|
then
|
||||||
|
echo "@bindir@/$1"
|
||||||
|
else
|
||||||
|
echo "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
log_generic () {
|
log_generic () {
|
||||||
priority="$1"
|
priority="$1"
|
||||||
shift
|
shift
|
||||||
@@ -137,7 +150,7 @@ log_generic () {
|
|||||||
echo "$msg"
|
echo "$msg"
|
||||||
case $logging in
|
case $logging in
|
||||||
init) ;; # Just echo the message, don't save it anywhere
|
init) ;; # Just echo the message, don't save it anywhere
|
||||||
file) echo "$msg" >> "$err_log" ;;
|
file) echo "$msg" | "$helper" "$user" log "$err_log" ;;
|
||||||
syslog) logger -t "$syslog_tag_mysqld_safe" -p "$priority" "$*" ;;
|
syslog) logger -t "$syslog_tag_mysqld_safe" -p "$priority" "$*" ;;
|
||||||
*)
|
*)
|
||||||
echo "Internal program error (non-fatal):" \
|
echo "Internal program error (non-fatal):" \
|
||||||
@@ -157,7 +170,7 @@ log_notice () {
|
|||||||
eval_log_error () {
|
eval_log_error () {
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
case $logging in
|
case $logging in
|
||||||
file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;;
|
file) cmd="$cmd 2>&1 | "`shell_quote_string "$helper"`" $user log "`shell_quote_string "$err_log"` ;;
|
||||||
syslog)
|
syslog)
|
||||||
# mysqld often prefixes its messages with a timestamp, which is
|
# mysqld often prefixes its messages with a timestamp, which is
|
||||||
# redundant when logging to syslog (which adds its own timestamp)
|
# redundant when logging to syslog (which adds its own timestamp)
|
||||||
@@ -191,11 +204,17 @@ shell_quote_string() {
|
|||||||
echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g'
|
echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_executable_location() {
|
||||||
|
if test "$unsafe_my_cnf" = 1 -a "$unrecognized_handling" != collect; then
|
||||||
|
log_error "Cannot accept $1 from a config file, when my.cnf is in the datadir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
parse_arguments() {
|
parse_arguments() {
|
||||||
for arg do
|
for arg do
|
||||||
val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
|
val=`echo "$arg" | sed -e "s;--[^=]*=;;"`
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
--crash[-_]script=*) CRASH_SCRIPT="$val" ;;
|
|
||||||
# these get passed explicitly to mysqld
|
# these get passed explicitly to mysqld
|
||||||
--basedir=*) MY_BASEDIR_VERSION="$val" ;;
|
--basedir=*) MY_BASEDIR_VERSION="$val" ;;
|
||||||
--datadir=*|--data=*) DATADIR="$val" ;;
|
--datadir=*|--data=*) DATADIR="$val" ;;
|
||||||
@@ -222,12 +241,14 @@ parse_arguments() {
|
|||||||
|
|
||||||
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
|
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
|
||||||
--core[-_]file[-_]size=*) core_file_size="$val" ;;
|
--core[-_]file[-_]size=*) core_file_size="$val" ;;
|
||||||
--ledir=*) ledir="$val" ;;
|
--ledir=*) check_executable_location "$arg" ; ledir="$val" ;;
|
||||||
--malloc[-_]lib=*) set_malloc_lib "$val" ;;
|
--malloc[-_]lib=*) check_executable_location "$arg"; set_malloc_lib "$val" ;;
|
||||||
--mysqld=*) MYSQLD="$val" ;;
|
--crash[-_]script=*) check_executable_location "$arg"; crash_script="$val" ;;
|
||||||
|
--mysqld=*) check_executable_location "$arg"; MYSQLD="$val" ;;
|
||||||
--mysqld[-_]version=*)
|
--mysqld[-_]version=*)
|
||||||
if test -n "$val"
|
if test -n "$val"
|
||||||
then
|
then
|
||||||
|
check_executable_location "$arg"
|
||||||
MYSQLD="mysqld-$val"
|
MYSQLD="mysqld-$val"
|
||||||
PLUGIN_VARIANT="/$val"
|
PLUGIN_VARIANT="/$val"
|
||||||
else
|
else
|
||||||
@@ -386,15 +407,8 @@ set_malloc_lib() {
|
|||||||
# First, try to find BASEDIR and ledir (where mysqld is)
|
# First, try to find BASEDIR and ledir (where mysqld is)
|
||||||
#
|
#
|
||||||
|
|
||||||
if echo '@pkgdatadir@' | grep '^@prefix@' > /dev/null
|
MY_PWD=`dirname $0`
|
||||||
then
|
MY_PWD=`cd "$MY_PWD"/.. && pwd`
|
||||||
relpkgdata=`echo '@pkgdatadir@' | sed -e 's,^@prefix@,,' -e 's,^/,,' -e 's,^,./,'`
|
|
||||||
else
|
|
||||||
# pkgdatadir is not relative to prefix
|
|
||||||
relpkgdata='@pkgdatadir@'
|
|
||||||
fi
|
|
||||||
|
|
||||||
MY_PWD=`pwd`
|
|
||||||
# Check for the directories we would expect from a binary release install
|
# Check for the directories we would expect from a binary release install
|
||||||
if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION"
|
if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION"
|
||||||
then
|
then
|
||||||
@@ -410,16 +424,16 @@ then
|
|||||||
else
|
else
|
||||||
ledir="$MY_BASEDIR_VERSION/bin"
|
ledir="$MY_BASEDIR_VERSION/bin"
|
||||||
fi
|
fi
|
||||||
elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld"
|
elif test -x "$MY_PWD/bin/mysqld"
|
||||||
then
|
then
|
||||||
MY_BASEDIR_VERSION="$MY_PWD" # Where bin, share and data are
|
MY_BASEDIR_VERSION="$MY_PWD" # Where bin, share and data are
|
||||||
ledir="$MY_PWD/bin" # Where mysqld is
|
ledir="$MY_PWD/bin" # Where mysqld is
|
||||||
# Check for the directories we would expect from a source install
|
# Check for the directories we would expect from a source install
|
||||||
elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
|
elif test -x "$MY_PWD/libexec/mysqld"
|
||||||
then
|
then
|
||||||
MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
|
MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
|
||||||
ledir="$MY_PWD/libexec" # Where mysqld is
|
ledir="$MY_PWD/libexec" # Where mysqld is
|
||||||
elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/sbin/mysqld"
|
elif test -x "$MY_PWD/sbin/mysqld"
|
||||||
then
|
then
|
||||||
MY_BASEDIR_VERSION="$MY_PWD" # Where sbin, share and var are
|
MY_BASEDIR_VERSION="$MY_PWD" # Where sbin, share and var are
|
||||||
ledir="$MY_PWD/sbin" # Where mysqld is
|
ledir="$MY_PWD/sbin" # Where mysqld is
|
||||||
@@ -429,6 +443,8 @@ else
|
|||||||
ledir='@libexecdir@'
|
ledir='@libexecdir@'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
helper=`find_in_bin mysqld_safe_helper`
|
||||||
|
print_defaults=`find_in_bin my_print_defaults`
|
||||||
|
|
||||||
#
|
#
|
||||||
# Second, try to find the data directory
|
# Second, try to find the data directory
|
||||||
@@ -466,6 +482,7 @@ IGNORING $DATADIR/my.cnf"
|
|||||||
log_error "WARNING: Found $DATADIR/my.cnf
|
log_error "WARNING: Found $DATADIR/my.cnf
|
||||||
The data directory is a deprecated location for my.cnf, please move it to
|
The data directory is a deprecated location for my.cnf, please move it to
|
||||||
$MY_BASEDIR_VERSION/my.cnf"
|
$MY_BASEDIR_VERSION/my.cnf"
|
||||||
|
unsafe_my_cnf=1
|
||||||
MYSQL_HOME=$DATADIR
|
MYSQL_HOME=$DATADIR
|
||||||
else
|
else
|
||||||
MYSQL_HOME=$MY_BASEDIR_VERSION
|
MYSQL_HOME=$MY_BASEDIR_VERSION
|
||||||
@@ -473,34 +490,15 @@ $MY_BASEDIR_VERSION/my.cnf"
|
|||||||
fi
|
fi
|
||||||
export MYSQL_HOME
|
export MYSQL_HOME
|
||||||
|
|
||||||
|
|
||||||
# Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
|
|
||||||
# and then merge with the command line arguments
|
|
||||||
if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults"
|
|
||||||
then
|
|
||||||
print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults"
|
|
||||||
elif test -x `dirname $0`/my_print_defaults
|
|
||||||
then
|
|
||||||
print_defaults="`dirname $0`/my_print_defaults"
|
|
||||||
elif test -x ./bin/my_print_defaults
|
|
||||||
then
|
|
||||||
print_defaults="./bin/my_print_defaults"
|
|
||||||
elif test -x @bindir@/my_print_defaults
|
|
||||||
then
|
|
||||||
print_defaults="@bindir@/my_print_defaults"
|
|
||||||
elif test -x @bindir@/mysql_print_defaults
|
|
||||||
then
|
|
||||||
print_defaults="@bindir@/mysql_print_defaults"
|
|
||||||
else
|
|
||||||
print_defaults="my_print_defaults"
|
|
||||||
fi
|
|
||||||
|
|
||||||
append_arg_to_args () {
|
append_arg_to_args () {
|
||||||
args="$args "`shell_quote_string "$1"`
|
args="$args "`shell_quote_string "$1"`
|
||||||
}
|
}
|
||||||
|
|
||||||
args=
|
args=
|
||||||
|
|
||||||
|
# Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
|
||||||
|
# and then merge with the command line arguments
|
||||||
|
|
||||||
SET_USER=2
|
SET_USER=2
|
||||||
parse_arguments `$print_defaults $defaults --loose-verbose --mysqld`
|
parse_arguments `$print_defaults $defaults --loose-verbose --mysqld`
|
||||||
if test $SET_USER -eq 2
|
if test $SET_USER -eq 2
|
||||||
@@ -609,11 +607,6 @@ then
|
|||||||
log_notice "Logging to '$err_log'."
|
log_notice "Logging to '$err_log'."
|
||||||
logging=file
|
logging=file
|
||||||
|
|
||||||
if [ ! -f "$err_log" ]; then # if error log already exists,
|
|
||||||
touch "$err_log" # we just append. otherwise,
|
|
||||||
chmod "$fmode" "$err_log" # fix the permissions here!
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
else
|
||||||
if [ -n "$syslog_tag" ]
|
if [ -n "$syslog_tag" ]
|
||||||
then
|
then
|
||||||
@@ -626,10 +619,6 @@ else
|
|||||||
logging=syslog
|
logging=syslog
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# close stdout and stderr, everything goes to $logging now
|
|
||||||
exec 1>&-
|
|
||||||
exec 2>&-
|
|
||||||
|
|
||||||
USER_OPTION=""
|
USER_OPTION=""
|
||||||
if test -w / -o "$USER" = "root"
|
if test -w / -o "$USER" = "root"
|
||||||
then
|
then
|
||||||
@@ -637,11 +626,6 @@ then
|
|||||||
then
|
then
|
||||||
USER_OPTION="--user=$user"
|
USER_OPTION="--user=$user"
|
||||||
fi
|
fi
|
||||||
# Change the err log to the right user, if it is in use
|
|
||||||
if [ $want_syslog -eq 0 ]; then
|
|
||||||
touch "$err_log"
|
|
||||||
chown $user "$err_log"
|
|
||||||
fi
|
|
||||||
if test -n "$open_files"
|
if test -n "$open_files"
|
||||||
then
|
then
|
||||||
ulimit -n $open_files
|
ulimit -n $open_files
|
||||||
@@ -885,6 +869,15 @@ max_fast_restarts=5
|
|||||||
# flag whether a usable sleep command exists
|
# flag whether a usable sleep command exists
|
||||||
have_sleep=1
|
have_sleep=1
|
||||||
|
|
||||||
|
# close stdout and stderr, everything goes to $logging now
|
||||||
|
if expr "${-}" : '.*x' > /dev/null
|
||||||
|
then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
exec 1>&-
|
||||||
|
exec 2>&-
|
||||||
|
fi
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
rm -f "$pid_file" # Some extra safety
|
rm -f "$pid_file" # Some extra safety
|
||||||
@@ -892,13 +885,6 @@ do
|
|||||||
start_time=`date +%M%S`
|
start_time=`date +%M%S`
|
||||||
|
|
||||||
eval_log_error "$cmd"
|
eval_log_error "$cmd"
|
||||||
|
|
||||||
if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then
|
|
||||||
touch "$err_log" # hypothetical: log was renamed but not
|
|
||||||
chown $user "$err_log" # flushed yet. we'd recreate it with
|
|
||||||
chmod "$fmode" "$err_log" # wrong owner next time we log, so set
|
|
||||||
fi # it up correctly while we can!
|
|
||||||
|
|
||||||
end_time=`date +%M%S`
|
end_time=`date +%M%S`
|
||||||
|
|
||||||
if test ! -f "$pid_file" # This is removed if normal shutdown
|
if test ! -f "$pid_file" # This is removed if normal shutdown
|
||||||
@@ -962,9 +948,9 @@ do
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
log_notice "mysqld restarted"
|
log_notice "mysqld restarted"
|
||||||
if test -n "$CRASH_SCRIPT"
|
if test -n "$crash_script"
|
||||||
then
|
then
|
||||||
crash_script_output=`$CRASH_SCRIPT 2>&1`
|
crash_script_output=`$crash_script 2>&1`
|
||||||
log_error "$crash_script_output"
|
log_error "$crash_script_output"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "unireg.h"
|
#include "unireg.h"
|
||||||
#include "sql_base.h" // close_thread_tables
|
#include "sql_base.h" // close_thread_tables
|
||||||
|
#include "sql_parse.h"
|
||||||
#include "event_db_repository.h"
|
#include "event_db_repository.h"
|
||||||
#include "key.h" // key_copy
|
#include "key.h" // key_copy
|
||||||
#include "sql_db.h" // get_default_db_collation
|
#include "sql_db.h" // get_default_db_collation
|
||||||
@@ -704,19 +705,17 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||||||
|
|
||||||
restore_record(table, s->default_values); // Get default values for fields
|
restore_record(table, s->default_values); // Get default values for fields
|
||||||
|
|
||||||
if (system_charset_info->cset->
|
if (check_string_char_length(&parse_data->dbname, 0,
|
||||||
numchars(system_charset_info, parse_data->dbname.str,
|
table->field[ET_FIELD_DB]->char_length(),
|
||||||
parse_data->dbname.str + parse_data->dbname.length) >
|
system_charset_info, 1))
|
||||||
table->field[ET_FIELD_DB]->char_length())
|
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), parse_data->dbname.str);
|
my_error(ER_TOO_LONG_IDENT, MYF(0), parse_data->dbname.str);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system_charset_info->cset->
|
if (check_string_char_length(&parse_data->name, 0,
|
||||||
numchars(system_charset_info, parse_data->name.str,
|
table->field[ET_FIELD_NAME]->char_length(),
|
||||||
parse_data->name.str + parse_data->name.length) >
|
system_charset_info, 1))
|
||||||
table->field[ET_FIELD_NAME]->char_length())
|
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), parse_data->name.str);
|
my_error(ER_TOO_LONG_IDENT, MYF(0), parse_data->name.str);
|
||||||
goto end;
|
goto end;
|
||||||
|
15
sql/field.cc
15
sql/field.cc
@@ -1269,12 +1269,15 @@ void Field_num::prepend_zeros(String *value)
|
|||||||
int diff;
|
int diff;
|
||||||
if ((diff= (int) (field_length - value->length())) > 0)
|
if ((diff= (int) (field_length - value->length())) > 0)
|
||||||
{
|
{
|
||||||
bmove_upp((uchar*) value->ptr()+field_length,
|
const bool error= value->realloc(field_length);
|
||||||
(uchar*) value->ptr()+value->length(),
|
if (!error)
|
||||||
value->length());
|
{
|
||||||
bfill((uchar*) value->ptr(),diff,'0');
|
bmove_upp((uchar*) value->ptr()+field_length,
|
||||||
value->length(field_length);
|
(uchar*) value->ptr()+value->length(),
|
||||||
(void) value->c_ptr_quick(); // Avoid warnings in purify
|
value->length());
|
||||||
|
bfill((uchar*) value->ptr(),diff,'0');
|
||||||
|
value->length(field_length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1629,7 +1629,7 @@ int merge_buffers(Sort_param *param, IO_CACHE *from_file,
|
|||||||
if (!(error= (int) read_to_buffer(from_file, buffpek,
|
if (!(error= (int) read_to_buffer(from_file, buffpek,
|
||||||
rec_length)))
|
rec_length)))
|
||||||
{
|
{
|
||||||
queue_remove(&queue,0);
|
(void) queue_remove_top(&queue);
|
||||||
reuse_freed_buff(&queue, buffpek, rec_length);
|
reuse_freed_buff(&queue, buffpek, rec_length);
|
||||||
}
|
}
|
||||||
else if (error == -1)
|
else if (error == -1)
|
||||||
|
@@ -4524,7 +4524,7 @@ void handler::get_dynamic_partition_info(PARTITION_STATS *stat_info,
|
|||||||
stat_info->update_time= stats.update_time;
|
stat_info->update_time= stats.update_time;
|
||||||
stat_info->check_time= stats.check_time;
|
stat_info->check_time= stats.check_time;
|
||||||
stat_info->check_sum= 0;
|
stat_info->check_sum= 0;
|
||||||
if (table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_OLD_CHECKSUM))
|
if (table_flags() & (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM))
|
||||||
stat_info->check_sum= checksum();
|
stat_info->check_sum= checksum();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
41
sql/item.cc
41
sql/item.cc
@@ -1206,7 +1206,8 @@ Item *Item_cache::safe_charset_converter(CHARSET_INFO *tocs)
|
|||||||
if (conv == example)
|
if (conv == example)
|
||||||
return this;
|
return this;
|
||||||
Item_cache *cache;
|
Item_cache *cache;
|
||||||
if (!conv || !(cache= new Item_cache_str(conv)))
|
if (!conv || conv->fix_fields(current_thd, (Item **) NULL) ||
|
||||||
|
!(cache= new Item_cache_str(conv)))
|
||||||
return NULL; // Safe conversion is not possible, or OEM
|
return NULL; // Safe conversion is not possible, or OEM
|
||||||
cache->setup(conv);
|
cache->setup(conv);
|
||||||
cache->fixed= false; // Make Item::fix_fields() happy
|
cache->fixed= false; // Make Item::fix_fields() happy
|
||||||
@@ -2742,6 +2743,44 @@ void Item_field::fix_after_pullout(st_select_lex *new_parent, Item **ref)
|
|||||||
depended_from= NULL;
|
depended_from= NULL;
|
||||||
if (context)
|
if (context)
|
||||||
{
|
{
|
||||||
|
bool need_change= false;
|
||||||
|
/*
|
||||||
|
Suppose there are nested selects:
|
||||||
|
|
||||||
|
select_id=1
|
||||||
|
select_id=2
|
||||||
|
select_id=3 <----+
|
||||||
|
select_id=4 -+
|
||||||
|
select_id=5 --+
|
||||||
|
|
||||||
|
Suppose, pullout operation has moved anything that had select_id=4 or 5
|
||||||
|
in to select_id=3.
|
||||||
|
|
||||||
|
If this Item_field had a name resolution context pointing into select_lex
|
||||||
|
with id=4 or id=5, it needs a new name resolution context.
|
||||||
|
|
||||||
|
However, it could also be that this object is a part of outer reference:
|
||||||
|
Item_ref(Item_field(field in select with select_id=1))).
|
||||||
|
- The Item_ref object has a context with select_id=5, and so needs a new
|
||||||
|
name resolution context.
|
||||||
|
- The Item_field object has a context with select_id=1, and doesn't need
|
||||||
|
a new name resolution context.
|
||||||
|
|
||||||
|
So, the following loop walks from Item_field's current context upwards.
|
||||||
|
If we find that the select we've been pulled out to is up there, we
|
||||||
|
create the new name resolution context. Otherwise, we don't.
|
||||||
|
*/
|
||||||
|
for (Name_resolution_context *ct= context; ct; ct= ct->outer_context)
|
||||||
|
{
|
||||||
|
if (new_parent == ct->select_lex)
|
||||||
|
{
|
||||||
|
need_change= true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!need_change)
|
||||||
|
return;
|
||||||
|
|
||||||
Name_resolution_context *ctx= new Name_resolution_context();
|
Name_resolution_context *ctx= new Name_resolution_context();
|
||||||
if (context->select_lex == new_parent)
|
if (context->select_lex == new_parent)
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
|
/* Copyright (c) 2002, 2016, Oracle and/or its affiliates.
|
||||||
Copyright (c) 2010, 2015, MariaDB
|
Copyright (c) 2010, 2016, MariaDB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -3424,8 +3424,12 @@ bool subselect_union_engine::is_executed() const
|
|||||||
|
|
||||||
bool subselect_union_engine::no_rows()
|
bool subselect_union_engine::no_rows()
|
||||||
{
|
{
|
||||||
|
bool rows_present= false;
|
||||||
|
|
||||||
/* Check if we got any rows when reading UNION result from temp. table: */
|
/* Check if we got any rows when reading UNION result from temp. table: */
|
||||||
return MY_TEST(!unit->fake_select_lex->join->send_records);
|
if (unit->fake_select_lex->join)
|
||||||
|
rows_present= MY_TEST(!unit->fake_select_lex->join->send_records);
|
||||||
|
return rows_present;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4808,9 +4812,9 @@ bool subselect_hash_sj_engine::init(List<Item> *tmp_columns, uint subquery_id)
|
|||||||
result= result_sink;
|
result= result_sink;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If the subquery has blobs, or the total key lenght is bigger than
|
If the subquery has blobs, or the total key length is bigger than
|
||||||
some length, or the total number of key parts is more than the
|
some length, or the total number of key parts is more than the
|
||||||
allowed maximum (currently MAX_REF_PARTS == 16), then the created
|
allowed maximum (currently MAX_REF_PARTS == 32), then the created
|
||||||
index cannot be used for lookups and we can't use hash semi
|
index cannot be used for lookups and we can't use hash semi
|
||||||
join. If this is the case, delete the temporary table since it
|
join. If this is the case, delete the temporary table since it
|
||||||
will not be used, and tell the caller we failed to initialize the
|
will not be used, and tell the caller we failed to initialize the
|
||||||
@@ -6564,4 +6568,3 @@ end:
|
|||||||
void subselect_table_scan_engine::cleanup()
|
void subselect_table_scan_engine::cleanup()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -426,7 +426,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
|
|||||||
{
|
{
|
||||||
if (!my_isspace(&my_charset_latin1,*val))
|
if (!my_isspace(&my_charset_latin1,*val))
|
||||||
{
|
{
|
||||||
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
|
make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||||
val_begin, length,
|
val_begin, length,
|
||||||
cached_timestamp_type, NullS);
|
cached_timestamp_type, NullS);
|
||||||
break;
|
break;
|
||||||
@@ -708,7 +708,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
|
|||||||
{
|
{
|
||||||
longlong value;
|
longlong value;
|
||||||
const char *start= str;
|
const char *start= str;
|
||||||
for (value=0; str != end && my_isdigit(cs, *str) ; str++)
|
for (value= 0; str != end && my_isdigit(cs, *str); str++)
|
||||||
value= value*10 + *str - '0';
|
value= value*10 + *str - '0';
|
||||||
msec_length= 6 - (str - start);
|
msec_length= 6 - (str - start);
|
||||||
values[i]= value;
|
values[i]= value;
|
||||||
@@ -1460,6 +1460,7 @@ void Item_temporal_func::fix_length_and_dec()
|
|||||||
time can get us to return NULL.
|
time can get us to return NULL.
|
||||||
*/
|
*/
|
||||||
maybe_null= 1;
|
maybe_null= 1;
|
||||||
|
|
||||||
if (decimals)
|
if (decimals)
|
||||||
{
|
{
|
||||||
if (decimals == NOT_FIXED_DEC)
|
if (decimals == NOT_FIXED_DEC)
|
||||||
|
108
sql/mysqld.cc
108
sql/mysqld.cc
@@ -123,10 +123,7 @@ extern "C" { // Because of SCO 3.2V4.2
|
|||||||
#include <sysent.h>
|
#include <sysent.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_PWD_H
|
#ifdef HAVE_PWD_H
|
||||||
#include <pwd.h> // For getpwent
|
#include <pwd.h> // For struct passwd
|
||||||
#endif
|
|
||||||
#ifdef HAVE_GRP_H
|
|
||||||
#include <grp.h>
|
|
||||||
#endif
|
#endif
|
||||||
#include <my_net.h>
|
#include <my_net.h>
|
||||||
|
|
||||||
@@ -465,9 +462,7 @@ ulong opt_binlog_rows_event_max_size;
|
|||||||
my_bool opt_master_verify_checksum= 0;
|
my_bool opt_master_verify_checksum= 0;
|
||||||
my_bool opt_slave_sql_verify_checksum= 1;
|
my_bool opt_slave_sql_verify_checksum= 1;
|
||||||
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
|
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
|
||||||
#ifdef HAVE_INITGROUPS
|
|
||||||
volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */
|
volatile sig_atomic_t calling_initgroups= 0; /**< Used in SIGSEGV handler. */
|
||||||
#endif
|
|
||||||
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
|
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
|
||||||
uint mysqld_extra_port;
|
uint mysqld_extra_port;
|
||||||
uint mysqld_port_timeout;
|
uint mysqld_port_timeout;
|
||||||
@@ -2223,59 +2218,18 @@ static void set_ports()
|
|||||||
|
|
||||||
static struct passwd *check_user(const char *user)
|
static struct passwd *check_user(const char *user)
|
||||||
{
|
{
|
||||||
#if !defined(__WIN__)
|
myf flags= 0;
|
||||||
struct passwd *tmp_user_info;
|
if (global_system_variables.log_warnings)
|
||||||
uid_t user_id= geteuid();
|
flags|= MY_WME;
|
||||||
|
if (!opt_bootstrap && !opt_help)
|
||||||
|
flags|= MY_FAE;
|
||||||
|
|
||||||
// Don't bother if we aren't superuser
|
struct passwd *tmp_user_info= my_check_user(user, MYF(flags));
|
||||||
if (user_id)
|
|
||||||
{
|
|
||||||
if (user)
|
|
||||||
{
|
|
||||||
/* Don't give a warning, if real user is same as given with --user */
|
|
||||||
/* purecov: begin tested */
|
|
||||||
tmp_user_info= getpwnam(user);
|
|
||||||
if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
|
|
||||||
global_system_variables.log_warnings)
|
|
||||||
sql_print_warning(
|
|
||||||
"One can only use the --user switch if running as root\n");
|
|
||||||
/* purecov: end */
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (!user)
|
|
||||||
{
|
|
||||||
if (!opt_bootstrap && !opt_help)
|
|
||||||
{
|
|
||||||
sql_print_error("Fatal error: Please consult the Knowledge Base "
|
|
||||||
"to find out how to run mysqld as root!\n");
|
|
||||||
unireg_abort(1);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
/* purecov: begin tested */
|
|
||||||
if (!strcmp(user,"root"))
|
|
||||||
return NULL; // Avoid problem with dynamic libraries
|
|
||||||
|
|
||||||
if (!(tmp_user_info= getpwnam(user)))
|
if (!tmp_user_info && my_errno==EINVAL && (flags & MY_FAE))
|
||||||
{
|
unireg_abort(1);
|
||||||
// Allow a numeric uid to be used
|
|
||||||
const char *pos;
|
|
||||||
for (pos= user; my_isdigit(mysqld_charset,*pos); pos++) ;
|
|
||||||
if (*pos) // Not numeric id
|
|
||||||
goto err;
|
|
||||||
if (!(tmp_user_info= getpwuid(atoi(user))))
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp_user_info;
|
return tmp_user_info;
|
||||||
/* purecov: end */
|
|
||||||
|
|
||||||
err:
|
|
||||||
sql_print_error("Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
|
|
||||||
unireg_abort(1);
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void allow_coredumps()
|
static inline void allow_coredumps()
|
||||||
@@ -2292,10 +2246,6 @@ static inline void allow_coredumps()
|
|||||||
|
|
||||||
static void set_user(const char *user, struct passwd *user_info_arg)
|
static void set_user(const char *user, struct passwd *user_info_arg)
|
||||||
{
|
{
|
||||||
/* purecov: begin tested */
|
|
||||||
#if !defined(__WIN__)
|
|
||||||
DBUG_ASSERT(user_info_arg != 0);
|
|
||||||
#ifdef HAVE_INITGROUPS
|
|
||||||
/*
|
/*
|
||||||
We can get a SIGSEGV when calling initgroups() on some systems when NSS
|
We can get a SIGSEGV when calling initgroups() on some systems when NSS
|
||||||
is configured to use LDAP and the server is statically linked. We set
|
is configured to use LDAP and the server is statically linked. We set
|
||||||
@@ -2303,22 +2253,11 @@ static void set_user(const char *user, struct passwd *user_info_arg)
|
|||||||
output a specific message to help the user resolve this problem.
|
output a specific message to help the user resolve this problem.
|
||||||
*/
|
*/
|
||||||
calling_initgroups= 1;
|
calling_initgroups= 1;
|
||||||
initgroups((char*) user, user_info_arg->pw_gid);
|
int res= my_set_user(user, user_info_arg, MYF(MY_WME));
|
||||||
calling_initgroups= 0;
|
calling_initgroups= 0;
|
||||||
#endif
|
if (res)
|
||||||
if (setgid(user_info_arg->pw_gid) == -1)
|
|
||||||
{
|
|
||||||
sql_perror("setgid");
|
|
||||||
unireg_abort(1);
|
unireg_abort(1);
|
||||||
}
|
|
||||||
if (setuid(user_info_arg->pw_uid) == -1)
|
|
||||||
{
|
|
||||||
sql_perror("setuid");
|
|
||||||
unireg_abort(1);
|
|
||||||
}
|
|
||||||
allow_coredumps();
|
allow_coredumps();
|
||||||
#endif
|
|
||||||
/* purecov: end */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4265,19 +4204,24 @@ static int init_common_variables()
|
|||||||
default_charset_info= default_collation;
|
default_charset_info= default_collation;
|
||||||
}
|
}
|
||||||
/* Set collactions that depends on the default collation */
|
/* Set collactions that depends on the default collation */
|
||||||
global_system_variables.collation_server= default_charset_info;
|
global_system_variables.collation_server= default_charset_info;
|
||||||
global_system_variables.collation_database= default_charset_info;
|
global_system_variables.collation_database= default_charset_info;
|
||||||
global_system_variables.collation_connection= default_charset_info;
|
if (is_supported_parser_charset(default_charset_info))
|
||||||
global_system_variables.character_set_results= default_charset_info;
|
|
||||||
if (default_charset_info->mbminlen > 1)
|
|
||||||
{
|
{
|
||||||
global_system_variables.character_set_client= &my_charset_latin1;
|
global_system_variables.collation_connection= default_charset_info;
|
||||||
sql_print_warning("Cannot use %s as character_set_client, %s will be used instead",
|
global_system_variables.character_set_results= default_charset_info;
|
||||||
default_charset_info->csname,
|
global_system_variables.character_set_client= default_charset_info;
|
||||||
global_system_variables.character_set_client->csname);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
global_system_variables.character_set_client= default_charset_info;
|
{
|
||||||
|
sql_print_warning("'%s' can not be used as client character set. "
|
||||||
|
"'%s' will be used as default client character set.",
|
||||||
|
default_charset_info->csname,
|
||||||
|
my_charset_latin1.csname);
|
||||||
|
global_system_variables.collation_connection= &my_charset_latin1;
|
||||||
|
global_system_variables.character_set_results= &my_charset_latin1;
|
||||||
|
global_system_variables.character_set_client= &my_charset_latin1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(character_set_filesystem=
|
if (!(character_set_filesystem=
|
||||||
get_charset_by_csname(character_set_filesystem_name,
|
get_charset_by_csname(character_set_filesystem_name,
|
||||||
|
@@ -149,7 +149,7 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
|||||||
|
|
||||||
if (opt_stack_trace)
|
if (opt_stack_trace)
|
||||||
{
|
{
|
||||||
my_safe_printf_stderr("Thread pointer: 0x%p\n", thd);
|
my_safe_printf_stderr("Thread pointer: %p\n", thd);
|
||||||
my_safe_printf_stderr("%s",
|
my_safe_printf_stderr("%s",
|
||||||
"Attempting backtrace. You can use the following "
|
"Attempting backtrace. You can use the following "
|
||||||
"information to find out\n"
|
"information to find out\n"
|
||||||
|
@@ -522,12 +522,8 @@ check_routine_name(LEX_STRING *ident)
|
|||||||
my_error(ER_SP_WRONG_NAME, MYF(0), ident->str);
|
my_error(ER_SP_WRONG_NAME, MYF(0), ident->str);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (check_string_char_length(ident, "", NAME_CHAR_LEN,
|
if (check_ident_length(ident))
|
||||||
system_charset_info, 1))
|
|
||||||
{
|
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), ident->str);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -3120,23 +3116,23 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
|||||||
thd->query_length()) <= 0)
|
thd->query_length()) <= 0)
|
||||||
{
|
{
|
||||||
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
|
res= m_lex_keeper.reset_lex_and_exec_core(thd, nextp, FALSE, this);
|
||||||
|
bool log_slow= !res && thd->enable_slow_log;
|
||||||
|
|
||||||
if (thd->get_stmt_da()->is_eof())
|
/* Finalize server status flags after executing a statement. */
|
||||||
{
|
if (log_slow || thd->get_stmt_da()->is_eof())
|
||||||
/* Finalize server status flags after executing a statement. */
|
|
||||||
thd->update_server_status();
|
thd->update_server_status();
|
||||||
|
|
||||||
|
if (thd->get_stmt_da()->is_eof())
|
||||||
thd->protocol->end_statement();
|
thd->protocol->end_statement();
|
||||||
}
|
|
||||||
|
|
||||||
query_cache_end_of_result(thd);
|
query_cache_end_of_result(thd);
|
||||||
|
|
||||||
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_STATUS,
|
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_STATUS,
|
||||||
thd->get_stmt_da()->is_error() ?
|
thd->get_stmt_da()->is_error() ?
|
||||||
thd->get_stmt_da()->sql_errno() : 0,
|
thd->get_stmt_da()->sql_errno() : 0,
|
||||||
command_name[COM_QUERY].str);
|
command_name[COM_QUERY].str);
|
||||||
|
|
||||||
if (!res && unlikely(thd->enable_slow_log))
|
if (log_slow)
|
||||||
log_slow_statement(thd);
|
log_slow_statement(thd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2007, 2013, Oracle and/or its affiliates.
|
Copyright (c) 2007, 2013, Oracle and/or its affiliates.
|
||||||
Copyright (c) 2008, 2014, SkySQL Ab.
|
Copyright (c) 2008, 2016, MariaDB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -831,6 +831,7 @@ void update_global_user_stats(THD *thd, bool create_user, time_t now)
|
|||||||
|
|
||||||
bool thd_init_client_charset(THD *thd, uint cs_number)
|
bool thd_init_client_charset(THD *thd, uint cs_number)
|
||||||
{
|
{
|
||||||
|
SV *gv=&global_system_variables;
|
||||||
CHARSET_INFO *cs;
|
CHARSET_INFO *cs;
|
||||||
/*
|
/*
|
||||||
Use server character set and collation if
|
Use server character set and collation if
|
||||||
@@ -841,12 +842,10 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
|
|||||||
if (!opt_character_set_client_handshake ||
|
if (!opt_character_set_client_handshake ||
|
||||||
!(cs= get_charset(cs_number, MYF(0))))
|
!(cs= get_charset(cs_number, MYF(0))))
|
||||||
{
|
{
|
||||||
thd->variables.character_set_client=
|
DBUG_ASSERT(is_supported_parser_charset(gv->character_set_client));
|
||||||
global_system_variables.character_set_client;
|
thd->variables.character_set_client= gv->character_set_client;
|
||||||
thd->variables.collation_connection=
|
thd->variables.collation_connection= gv->collation_connection;
|
||||||
global_system_variables.collation_connection;
|
thd->variables.character_set_results= gv->character_set_results;
|
||||||
thd->variables.character_set_results=
|
|
||||||
global_system_variables.character_set_results;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -4274,6 +4274,12 @@ bool st_select_lex::is_merged_child_of(st_select_lex *ancestor)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sl->master_unit()->derived &&
|
||||||
|
sl->master_unit()->derived->is_merged_derived())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
all_merged= FALSE;
|
all_merged= FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -1482,7 +1482,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
|
|||||||
stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
|
stack=stack_pos=(int*) sql_alloc(sizeof(int)*length);
|
||||||
|
|
||||||
if (!(buffer=(uchar*) my_malloc(buff_length+1,MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
if (!(buffer=(uchar*) my_malloc(buff_length+1,MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
||||||
error=1; /* purecov: inspected */
|
error= 1; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
end_of_buff=buffer+buff_length;
|
end_of_buff=buffer+buff_length;
|
||||||
@@ -1748,7 +1748,7 @@ int READ_INFO::read_field()
|
|||||||
** We come here if buffer is too small. Enlarge it and continue
|
** We come here if buffer is too small. Enlarge it and continue
|
||||||
*/
|
*/
|
||||||
if (!(new_buffer=(uchar*) my_realloc((char*) buffer,buff_length+1+IO_SIZE,
|
if (!(new_buffer=(uchar*) my_realloc((char*) buffer,buff_length+1+IO_SIZE,
|
||||||
MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
MYF(MY_WME | MY_THREAD_SPECIFIC))))
|
||||||
return (error=1);
|
return (error=1);
|
||||||
to=new_buffer + (to-buffer);
|
to=new_buffer + (to-buffer);
|
||||||
buffer=new_buffer;
|
buffer=new_buffer;
|
||||||
@@ -1984,15 +1984,7 @@ int READ_INFO::read_value(int delim, String *val)
|
|||||||
for (chr= GET; my_tospace(chr) != delim && chr != my_b_EOF;)
|
for (chr= GET; my_tospace(chr) != delim && chr != my_b_EOF;)
|
||||||
{
|
{
|
||||||
#ifdef USE_MB
|
#ifdef USE_MB
|
||||||
uint ml= my_mbcharlen(read_charset, chr);
|
if (my_mbcharlen(read_charset, chr) > 1)
|
||||||
if (ml == 0)
|
|
||||||
{
|
|
||||||
chr= my_b_EOF;
|
|
||||||
val->length(0);
|
|
||||||
return chr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ml > 1)
|
|
||||||
{
|
{
|
||||||
DBUG_PRINT("read_xml",("multi byte"));
|
DBUG_PRINT("read_xml",("multi byte"));
|
||||||
int i, ml= my_mbcharlen(read_charset, chr);
|
int i, ml= my_mbcharlen(read_charset, chr);
|
||||||
|
@@ -4921,11 +4921,8 @@ create_sp_error:
|
|||||||
}
|
}
|
||||||
case SQLCOM_SHOW_CREATE_TRIGGER:
|
case SQLCOM_SHOW_CREATE_TRIGGER:
|
||||||
{
|
{
|
||||||
if (lex->spname->m_name.length > NAME_LEN)
|
if (check_ident_length(&lex->spname->m_name))
|
||||||
{
|
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
if (show_create_trigger(thd, lex->spname))
|
if (show_create_trigger(thd, lex->spname))
|
||||||
goto error; /* Error has been already logged. */
|
goto error; /* Error has been already logged. */
|
||||||
@@ -6663,12 +6660,9 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
|
|||||||
uint8 datetime_precision= length ? atoi(length) : 0;
|
uint8 datetime_precision= length ? atoi(length) : 0;
|
||||||
DBUG_ENTER("add_field_to_list");
|
DBUG_ENTER("add_field_to_list");
|
||||||
|
|
||||||
if (check_string_char_length(field_name, "", NAME_CHAR_LEN,
|
if (check_ident_length(field_name))
|
||||||
system_charset_info, 1))
|
|
||||||
{
|
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), field_name->str); /* purecov: inspected */
|
|
||||||
DBUG_RETURN(1); /* purecov: inspected */
|
DBUG_RETURN(1); /* purecov: inspected */
|
||||||
}
|
|
||||||
if (type_modifier & PRI_KEY_FLAG)
|
if (type_modifier & PRI_KEY_FLAG)
|
||||||
{
|
{
|
||||||
Key *key;
|
Key *key;
|
||||||
@@ -8443,6 +8437,18 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool check_ident_length(LEX_STRING *ident)
|
||||||
|
{
|
||||||
|
if (check_string_char_length(ident, 0, NAME_CHAR_LEN, system_charset_info, 1))
|
||||||
|
{
|
||||||
|
my_error(ER_TOO_LONG_IDENT, MYF(0), ident->str);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
C_MODE_START
|
C_MODE_START
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -76,6 +76,7 @@ bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
|
|||||||
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
|
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
|
||||||
uint max_char_length, CHARSET_INFO *cs,
|
uint max_char_length, CHARSET_INFO *cs,
|
||||||
bool no_error);
|
bool no_error);
|
||||||
|
bool check_ident_length(LEX_STRING *ident);
|
||||||
CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
|
CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
|
||||||
bool check_host_name(LEX_STRING *str);
|
bool check_host_name(LEX_STRING *str);
|
||||||
bool check_identifier_name(LEX_STRING *str, uint max_char_length,
|
bool check_identifier_name(LEX_STRING *str, uint max_char_length,
|
||||||
|
@@ -777,10 +777,15 @@ JOIN::prepare(Item ***rref_pointer_array,
|
|||||||
if (mixed_implicit_grouping && tbl->table)
|
if (mixed_implicit_grouping && tbl->table)
|
||||||
tbl->table->maybe_null= 1;
|
tbl->table->maybe_null= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint real_og_num= og_num;
|
||||||
|
if (skip_order_by &&
|
||||||
|
select_lex != select_lex->master_unit()->global_parameters)
|
||||||
|
real_og_num+= select_lex->order_list.elements;
|
||||||
|
|
||||||
if ((wild_num && setup_wild(thd, tables_list, fields_list, &all_fields,
|
if ((wild_num && setup_wild(thd, tables_list, fields_list, &all_fields,
|
||||||
wild_num)) ||
|
wild_num)) ||
|
||||||
select_lex->setup_ref_array(thd, og_num) ||
|
select_lex->setup_ref_array(thd, real_og_num) ||
|
||||||
setup_fields(thd, (*rref_pointer_array), fields_list, MARK_COLUMNS_READ,
|
setup_fields(thd, (*rref_pointer_array), fields_list, MARK_COLUMNS_READ,
|
||||||
&all_fields, 1) ||
|
&all_fields, 1) ||
|
||||||
setup_without_group(thd, (*rref_pointer_array), tables_list,
|
setup_without_group(thd, (*rref_pointer_array), tables_list,
|
||||||
@@ -3082,7 +3087,7 @@ void JOIN::exec_inner()
|
|||||||
*curr_fields_list),
|
*curr_fields_list),
|
||||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
|
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
|
||||||
error= do_select(curr_join, curr_fields_list, NULL, procedure);
|
error= do_select(curr_join, curr_fields_list, NULL, procedure);
|
||||||
thd->limit_found_rows= curr_join->send_records;
|
thd->limit_found_rows= curr_join->send_records - curr_join->duplicate_rows;
|
||||||
if (curr_join->order && curr_join->sortorder &&
|
if (curr_join->order && curr_join->sortorder &&
|
||||||
curr_join->filesort_found_rows)
|
curr_join->filesort_found_rows)
|
||||||
{
|
{
|
||||||
@@ -12765,6 +12770,9 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
|
|||||||
COND_EQUAL cond_equal;
|
COND_EQUAL cond_equal;
|
||||||
cond_equal.upper_levels= inherited;
|
cond_equal.upper_levels= inherited;
|
||||||
|
|
||||||
|
if (check_stack_overrun(thd, STACK_MIN_SIZE, NULL))
|
||||||
|
return cond; // Fatal error flag is set!
|
||||||
|
|
||||||
if (cond->type() == Item::COND_ITEM)
|
if (cond->type() == Item::COND_ITEM)
|
||||||
{
|
{
|
||||||
List<Item> eq_list;
|
List<Item> eq_list;
|
||||||
@@ -17453,7 +17461,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
|
|||||||
join->join_tab[join->top_join_tab_count - 1].next_select= end_select;
|
join->join_tab[join->top_join_tab_count - 1].next_select= end_select;
|
||||||
join_tab=join->join_tab+join->const_tables;
|
join_tab=join->join_tab+join->const_tables;
|
||||||
}
|
}
|
||||||
join->send_records=0;
|
join->duplicate_rows= join->send_records=0;
|
||||||
if (join->table_count == join->const_tables)
|
if (join->table_count == join->const_tables)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -18978,7 +18986,12 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||||||
int error;
|
int error;
|
||||||
/* result < 0 if row was not accepted and should not be counted */
|
/* result < 0 if row was not accepted and should not be counted */
|
||||||
if ((error= join->result->send_data(*join->fields)))
|
if ((error= join->result->send_data(*join->fields)))
|
||||||
DBUG_RETURN(error < 0 ? NESTED_LOOP_OK : NESTED_LOOP_ERROR);
|
{
|
||||||
|
if (error > 0)
|
||||||
|
DBUG_RETURN(NESTED_LOOP_ERROR);
|
||||||
|
// error < 0 => duplicate row
|
||||||
|
join->duplicate_rows++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++join->send_records;
|
++join->send_records;
|
||||||
@@ -19112,7 +19125,7 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||||||
if (error < 0)
|
if (error < 0)
|
||||||
{
|
{
|
||||||
/* Duplicate row, don't count */
|
/* Duplicate row, don't count */
|
||||||
join->send_records--;
|
join->duplicate_rows++;
|
||||||
error= 0;
|
error= 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1015,7 +1015,8 @@ public:
|
|||||||
table_map outer_join;
|
table_map outer_join;
|
||||||
/* Bitmap of tables used in the select list items */
|
/* Bitmap of tables used in the select list items */
|
||||||
table_map select_list_used_tables;
|
table_map select_list_used_tables;
|
||||||
ha_rows send_records,found_records,examined_rows,row_limit, select_limit;
|
ha_rows send_records, found_records, examined_rows,
|
||||||
|
row_limit, select_limit, duplicate_rows;
|
||||||
/**
|
/**
|
||||||
Used to fetch no more than given amount of rows per one
|
Used to fetch no more than given amount of rows per one
|
||||||
fetch operation of server side cursor.
|
fetch operation of server side cursor.
|
||||||
@@ -1281,7 +1282,7 @@ public:
|
|||||||
sort_and_group= 0;
|
sort_and_group= 0;
|
||||||
first_record= 0;
|
first_record= 0;
|
||||||
do_send_rows= 1;
|
do_send_rows= 1;
|
||||||
send_records= 0;
|
duplicate_rows= send_records= 0;
|
||||||
found_records= 0;
|
found_records= 0;
|
||||||
fetch_limit= HA_POS_ERROR;
|
fetch_limit= HA_POS_ERROR;
|
||||||
examined_rows= 0;
|
examined_rows= 0;
|
||||||
|
@@ -3516,7 +3516,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
sql_field->pack_length= dup_field->pack_length;
|
sql_field->pack_length= dup_field->pack_length;
|
||||||
sql_field->key_length= dup_field->key_length;
|
sql_field->key_length= dup_field->key_length;
|
||||||
sql_field->decimals= dup_field->decimals;
|
sql_field->decimals= dup_field->decimals;
|
||||||
sql_field->create_length_to_internal_length();
|
|
||||||
sql_field->unireg_check= dup_field->unireg_check;
|
sql_field->unireg_check= dup_field->unireg_check;
|
||||||
/*
|
/*
|
||||||
We're making one field from two, the result field will have
|
We're making one field from two, the result field will have
|
||||||
@@ -3526,6 +3525,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
if (!(sql_field->flags & NOT_NULL_FLAG))
|
if (!(sql_field->flags & NOT_NULL_FLAG))
|
||||||
null_fields--;
|
null_fields--;
|
||||||
sql_field->flags= dup_field->flags;
|
sql_field->flags= dup_field->flags;
|
||||||
|
sql_field->create_length_to_internal_length();
|
||||||
sql_field->interval= dup_field->interval;
|
sql_field->interval= dup_field->interval;
|
||||||
sql_field->vcol_info= dup_field->vcol_info;
|
sql_field->vcol_info= dup_field->vcol_info;
|
||||||
sql_field->stored_in_db= dup_field->stored_in_db;
|
sql_field->stored_in_db= dup_field->stored_in_db;
|
||||||
@@ -3652,12 +3652,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
my_error(ER_TOO_MANY_KEY_PARTS,MYF(0),tmp);
|
my_error(ER_TOO_MANY_KEY_PARTS,MYF(0),tmp);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (check_string_char_length(&key->name, "", NAME_CHAR_LEN,
|
if (check_ident_length(&key->name))
|
||||||
system_charset_info, 1))
|
|
||||||
{
|
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), key->name.str);
|
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
|
||||||
key_iterator2.rewind ();
|
key_iterator2.rewind ();
|
||||||
if (key->type != Key::FOREIGN_KEY)
|
if (key->type != Key::FOREIGN_KEY)
|
||||||
{
|
{
|
||||||
|
@@ -453,12 +453,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
|||||||
my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
|
my_message(ER_UDF_NO_PATHS, ER(ER_UDF_NO_PATHS), MYF(0));
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
if (check_string_char_length(&udf->name, "", NAME_CHAR_LEN,
|
if (check_ident_length(&udf->name))
|
||||||
system_charset_info, 1))
|
|
||||||
{
|
|
||||||
my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name.str);
|
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
|
||||||
|
|
||||||
tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
|
tables.init_one_table(STRING_WITH_LEN("mysql"), STRING_WITH_LEN("func"),
|
||||||
"func", TL_WRITE);
|
"func", TL_WRITE);
|
||||||
|
@@ -5117,6 +5117,8 @@ part_name:
|
|||||||
{
|
{
|
||||||
partition_info *part_info= Lex->part_info;
|
partition_info *part_info= Lex->part_info;
|
||||||
partition_element *p_elem= part_info->curr_part_elem;
|
partition_element *p_elem= part_info->curr_part_elem;
|
||||||
|
if (check_ident_length(&$1))
|
||||||
|
MYSQL_YYABORT;
|
||||||
p_elem->partition_name= $1.str;
|
p_elem->partition_name= $1.str;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -5411,7 +5413,11 @@ sub_part_definition:
|
|||||||
|
|
||||||
sub_name:
|
sub_name:
|
||||||
ident_or_text
|
ident_or_text
|
||||||
{ Lex->part_info->curr_part_elem->partition_name= $1.str; }
|
{
|
||||||
|
if (check_ident_length(&$1))
|
||||||
|
MYSQL_YYABORT;
|
||||||
|
Lex->part_info->curr_part_elem->partition_name= $1.str;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_part_options:
|
opt_part_options:
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "sql_plugin.h" // Includes my_global.h
|
#include "sql_plugin.h" // Includes my_global.h
|
||||||
#include "sql_priv.h"
|
#include "sql_priv.h"
|
||||||
#include "sql_class.h" // set_var.h: THD
|
#include "sql_class.h" // set_var.h: THD
|
||||||
|
#include "sql_parse.h"
|
||||||
#include "sys_vars.h"
|
#include "sys_vars.h"
|
||||||
|
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
@@ -613,7 +614,7 @@ static bool check_cs_client(sys_var *self, THD *thd, set_var *var)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Currently, UCS-2 cannot be used as a client character set
|
// Currently, UCS-2 cannot be used as a client character set
|
||||||
if (((CHARSET_INFO *)(var->save_result.ptr))->mbminlen > 1)
|
if (!is_supported_parser_charset((CHARSET_INFO *)(var->save_result.ptr)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -1235,7 +1235,7 @@ public:
|
|||||||
|
|
||||||
if (var->value->result_type() == STRING_RESULT)
|
if (var->value->result_type() == STRING_RESULT)
|
||||||
{
|
{
|
||||||
if (!(res=var->value->val_str(&str)))
|
if (!(res=var->value->val_str_ascii(&str)))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,10 @@ public class ApacheInterface extends JdbcInterface {
|
|||||||
ds.setPassword(parms[3]);
|
ds.setPassword(parms[3]);
|
||||||
pool.put(url, ds);
|
pool.put(url, ds);
|
||||||
} // endif ds
|
} // endif ds
|
||||||
|
|
||||||
|
// if (parms.length > 4 && parms[4] != null)
|
||||||
|
// ds.setConnectionProperties(parms[4]);
|
||||||
|
|
||||||
// Get a connection from the data source
|
// Get a connection from the data source
|
||||||
conn = ds.getConnection();
|
conn = ds.getConnection();
|
||||||
|
|
||||||
|
@@ -20,25 +20,25 @@ SET(CONNECT_SOURCES
|
|||||||
ha_connect.cc connect.cc user_connect.cc mycat.cc
|
ha_connect.cc connect.cc user_connect.cc mycat.cc
|
||||||
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
|
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
|
||||||
array.cpp blkfil.cpp colblk.cpp csort.cpp
|
array.cpp blkfil.cpp colblk.cpp csort.cpp
|
||||||
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
|
filamap.cpp filamdbf.cpp filamfix.cpp filamgz.cpp filamtxt.cpp
|
||||||
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
|
filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
|
||||||
reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
|
reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
|
||||||
tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
|
tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
|
||||||
tabvct.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
|
tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
|
||||||
|
|
||||||
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
|
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
|
||||||
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h
|
engmsg.h filamap.h filamdbf.h filamfix.h filamgz.h filamtxt.h
|
||||||
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
|
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
|
||||||
mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
|
mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
|
||||||
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
|
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
|
||||||
taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h
|
taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvir.h tabxcl.h
|
||||||
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
|
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Definitions that are shared for all OSes
|
# Definitions that are shared for all OSes
|
||||||
#
|
#
|
||||||
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
|
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
|
||||||
add_definitions( -DHUGE_SUPPORT -DZIP_SUPPORT -DPIVOT_SUPPORT )
|
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -89,6 +89,18 @@ ELSE(NOT UNIX)
|
|||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# VCT: the VEC format might be not supported in future versions
|
||||||
|
#
|
||||||
|
|
||||||
|
OPTION(CONNECT_WITH_VCT "Compile CONNECT storage engine with VCT support" ON)
|
||||||
|
|
||||||
|
IF(CONNECT_WITH_VCT)
|
||||||
|
SET(CONNECT_SOURCES ${CONNECT_SOURCES} filamvct.cpp tabvct.cpp filamvct.h tabvct.h)
|
||||||
|
add_definitions(-DVCT_SUPPORT)
|
||||||
|
ENDIF(CONNECT_WITH_VCT)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# XML
|
# XML
|
||||||
#
|
#
|
||||||
@@ -236,9 +248,9 @@ ENDIF(CONNECT_WITH_ODBC)
|
|||||||
# JDBC
|
# JDBC
|
||||||
#
|
#
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
OPTION(CONNECT_WITH_JDBC "some comment" OFF)
|
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine without JDBC support" OFF)
|
||||||
ELSE()
|
ELSE()
|
||||||
OPTION(CONNECT_WITH_JDBC "some comment" ON)
|
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(CONNECT_WITH_JDBC)
|
IF(CONNECT_WITH_JDBC)
|
||||||
@@ -252,18 +264,33 @@ IF(CONNECT_WITH_JDBC)
|
|||||||
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
|
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
|
||||||
jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h
|
jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h
|
||||||
JdbcInterface.java ApacheInterface.java MariadbInterface.java
|
JdbcInterface.java ApacheInterface.java MariadbInterface.java
|
||||||
MysqlInterface.java OracleInterface.java PostgresqlInterface.java)
|
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
|
||||||
|
JavaWrappers.jar)
|
||||||
# TODO: Find how to compile and install the java wrapper classes
|
# TODO: Find how to compile and install the java wrapper classes
|
||||||
# Find required libraries and include directories
|
# Find required libraries and include directories
|
||||||
SET (JAVA_SOURCES JdbcInterface.java)
|
SET (JAVA_SOURCES JdbcInterface.java)
|
||||||
add_jar(JdbcInterface ${JAVA_SOURCES})
|
add_jar(JdbcInterface ${JAVA_SOURCES})
|
||||||
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||||
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
|
||||||
|
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||||
add_definitions(-DJDBC_SUPPORT)
|
add_definitions(-DJDBC_SUPPORT)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(JDBC_LIBRARY "")
|
SET(JDBC_LIBRARY "")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(CONNECT_WITH_JDBC)
|
ENDIF(CONNECT_WITH_JDBC)
|
||||||
|
|
||||||
|
#
|
||||||
|
# ZIP
|
||||||
|
#
|
||||||
|
|
||||||
|
OPTION(CONNECT_WITH_ZIP "Compile CONNECT storage engine with ZIP support" ON)
|
||||||
|
|
||||||
|
IF(CONNECT_WITH_ZIP)
|
||||||
|
SET(CONNECT_SOURCES ${CONNECT_SOURCES} filamzip.cpp tabzip.cpp unzip.c ioapi.c zip.c
|
||||||
|
filamzip.h tabzip.h ioapi.h unzip.h zip.h)
|
||||||
|
add_definitions(-DZIP_SUPPORT -DNOCRYPT)
|
||||||
|
ENDIF(CONNECT_WITH_ZIP)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# XMAP
|
# XMAP
|
||||||
|
BIN
storage/connect/JavaWrappers.jar
Normal file
BIN
storage/connect/JavaWrappers.jar
Normal file
Binary file not shown.
@@ -82,6 +82,9 @@ public class JdbcInterface {
|
|||||||
System.out.println("URL=" + parms[1]);
|
System.out.println("URL=" + parms[1]);
|
||||||
|
|
||||||
CheckURL(parms[1], null);
|
CheckURL(parms[1], null);
|
||||||
|
|
||||||
|
// This is required for drivers using context class loaders
|
||||||
|
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
|
||||||
|
|
||||||
if (parms[2] != null && !parms[2].isEmpty()) {
|
if (parms[2] != null && !parms[2].isEmpty()) {
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
@@ -220,6 +223,19 @@ public class JdbcInterface {
|
|||||||
|
|
||||||
} // end of SetTimestampParm
|
} // end of SetTimestampParm
|
||||||
|
|
||||||
|
public int SetNullParm(int i, int typ) {
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
pstmt.setNull(i, typ);
|
||||||
|
} catch (Exception e) {
|
||||||
|
SetErrmsg(e);
|
||||||
|
rc = -1;
|
||||||
|
} // end try/catch
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
} // end of SetNullParm
|
||||||
|
|
||||||
public int ExecutePrep() {
|
public int ExecutePrep() {
|
||||||
int n = -3;
|
int n = -3;
|
||||||
|
|
||||||
|
@@ -89,30 +89,43 @@ DOMDOC::DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
|
|||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Initialize XML parser and check library compatibility. */
|
/* Initialize XML parser and check library compatibility. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool DOMDOC::Initialize(PGLOBAL g)
|
bool DOMDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
|
||||||
{
|
{
|
||||||
if (TestHr(g, CoInitialize(NULL)))
|
if (zipped && InitZip(g, entry))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (TestHr(g, CoInitialize(NULL)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (TestHr(g, Docp.CreateInstance("msxml2.domdocument")))
|
if (TestHr(g, Docp.CreateInstance("msxml2.domdocument")))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return MakeNSlist(g);
|
return MakeNSlist(g);
|
||||||
} // end of Initialize
|
} // end of Initialize
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Parse the XML file and construct node tree in memory. */
|
/* Parse the XML file and construct node tree in memory. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool DOMDOC::ParseFile(char *fn)
|
bool DOMDOC::ParseFile(PGLOBAL g, char *fn)
|
||||||
{
|
{
|
||||||
// Load the document
|
bool b;
|
||||||
|
|
||||||
Docp->async = false;
|
Docp->async = false;
|
||||||
|
|
||||||
if (!(bool)Docp->load((_bstr_t)fn))
|
if (zip) {
|
||||||
|
// Parse an in memory document
|
||||||
|
char *xdoc = GetMemDoc(g, fn);
|
||||||
|
|
||||||
|
b = (xdoc) ? (bool)Docp->loadXML((_bstr_t)xdoc) : false;
|
||||||
|
} else
|
||||||
|
// Load the document
|
||||||
|
b = (bool)Docp->load((_bstr_t)fn);
|
||||||
|
|
||||||
|
if (!b)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // end of ParseFile
|
} // end of ParseFile
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/* Create or reuse an Xblock for this document. */
|
/* Create or reuse an Xblock for this document. */
|
||||||
@@ -239,6 +252,7 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn)
|
|||||||
void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
|
void DOMDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
|
||||||
{
|
{
|
||||||
CloseXMLFile(g, xp, false);
|
CloseXMLFile(g, xp, false);
|
||||||
|
CloseZip();
|
||||||
} // end of Close
|
} // end of Close
|
||||||
|
|
||||||
/* ----------------------- class DOMNODE ------------------------ */
|
/* ----------------------- class DOMNODE ------------------------ */
|
||||||
@@ -616,13 +630,13 @@ PXNODE DOMNODELIST::GetItem(PGLOBAL g, int n, PXNODE np)
|
|||||||
/* Reset the pointer on the deleted item. */
|
/* Reset the pointer on the deleted item. */
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
bool DOMNODELIST::DropItem(PGLOBAL g, int n)
|
bool DOMNODELIST::DropItem(PGLOBAL g, int n)
|
||||||
{
|
{
|
||||||
if (Listp == NULL || Listp->length <= n)
|
if (Listp == NULL || Listp->length < n)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Listp->item[n] = NULL; La propriété n'a pas de méthode 'set'
|
//Listp->item[n] = NULL; La propriété n'a pas de méthode 'set'
|
||||||
return false;
|
return false;
|
||||||
} // end of DeleteItem
|
} // end of DeleteItem
|
||||||
|
|
||||||
/* ----------------------- class DOMATTR ------------------------ */
|
/* ----------------------- class DOMATTR ------------------------ */
|
||||||
|
|
||||||
|
@@ -37,8 +37,8 @@ class DOMDOC : public XMLDOCUMENT {
|
|||||||
virtual void SetNofree(bool b) {} // Only libxml2
|
virtual void SetNofree(bool b) {} // Only libxml2
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual bool Initialize(PGLOBAL g);
|
virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
|
||||||
virtual bool ParseFile(char *fn);
|
virtual bool ParseFile(PGLOBAL g, char *fn);
|
||||||
virtual bool NewDoc(PGLOBAL g, char *ver);
|
virtual bool NewDoc(PGLOBAL g, char *ver);
|
||||||
virtual void AddComment(PGLOBAL g, char *com);
|
virtual void AddComment(PGLOBAL g, char *com);
|
||||||
virtual PXNODE GetRoot(PGLOBAL g);
|
virtual PXNODE GetRoot(PGLOBAL g);
|
||||||
|
@@ -87,7 +87,7 @@ int MAPFAM::GetFileLength(PGLOBAL g)
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = (To_Fb) ? To_Fb->Length : TXTFAM::GetFileLength(g);
|
len = (To_Fb && To_Fb->Count) ? To_Fb->Length : TXTFAM::GetFileLength(g);
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("Mapped file length=%d\n", len);
|
htrc("Mapped file length=%d\n", len);
|
||||||
@@ -319,11 +319,13 @@ int MAPFAM::SkipRecord(PGLOBAL g, bool header)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MAPFAM::ReadBuffer(PGLOBAL g)
|
int MAPFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int len;
|
int rc, len;
|
||||||
|
|
||||||
// Are we at the end of the memory
|
// Are we at the end of the memory
|
||||||
if (Mempos >= Top)
|
if (Mempos >= Top)
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
|
||||||
if (!Placed) {
|
if (!Placed) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -341,8 +343,10 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
switch (Tdbp->TestBlock(g)) {
|
switch (Tdbp->TestBlock(g)) {
|
||||||
case RC_EF:
|
case RC_EF:
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
case RC_NF:
|
return rc;
|
||||||
|
|
||||||
|
case RC_NF:
|
||||||
// Skip this record
|
// Skip this record
|
||||||
if ((rc = SkipRecord(g, false)) != RC_OK)
|
if ((rc = SkipRecord(g, false)) != RC_OK)
|
||||||
return rc;
|
return rc;
|
||||||
@@ -413,7 +417,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
|
|
||||||
if (Tpos == Spos) {
|
if (Tpos == Spos) {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* First line to delete. Move of eventual preceeding lines is */
|
/* First line to delete. Move of eventual preceding lines is */
|
||||||
/* not required here, just setting of future Spos and Tpos. */
|
/* not required here, just setting of future Spos and Tpos. */
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Tpos = Spos = Fpos;
|
Tpos = Spos = Fpos;
|
||||||
@@ -498,7 +502,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
|
|||||||
void MAPFAM::CloseTableFile(PGLOBAL g, bool)
|
void MAPFAM::CloseTableFile(PGLOBAL g, bool)
|
||||||
{
|
{
|
||||||
PlugCloseFile(g, To_Fb);
|
PlugCloseFile(g, To_Fb);
|
||||||
To_Fb = NULL; // To get correct file size in Cardinality
|
//To_Fb = NULL; // To get correct file size in Cardinality
|
||||||
|
|
||||||
if (trace)
|
if (trace)
|
||||||
htrc("MAP Close: closing %s count=%d\n",
|
htrc("MAP Close: closing %s count=%d\n",
|
||||||
@@ -569,7 +573,7 @@ int MBKFAM::GetRowID(void)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MBKFAM::ReadBuffer(PGLOBAL g)
|
int MBKFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int len;
|
int rc, len;
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Sequential block reading when Placed is not true. */
|
/* Sequential block reading when Placed is not true. */
|
||||||
@@ -577,8 +581,10 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
if (Placed) {
|
if (Placed) {
|
||||||
Placed = false;
|
Placed = false;
|
||||||
} else if (Mempos >= Top) { // Are we at the end of the memory
|
} else if (Mempos >= Top) { // Are we at the end of the memory
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
} else if (++CurNum < Nrec) {
|
return rc;
|
||||||
|
|
||||||
|
} else if (++CurNum < Nrec) {
|
||||||
Fpos = Mempos;
|
Fpos = Mempos;
|
||||||
} else {
|
} else {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -588,7 +594,8 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
next:
|
next:
|
||||||
if (++CurBlk >= Block)
|
if (++CurBlk >= Block)
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
|
return rc;
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Before reading a new block, check whether block optimization */
|
/* Before reading a new block, check whether block optimization */
|
||||||
@@ -596,8 +603,11 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
switch (Tdbp->TestBlock(g)) {
|
switch (Tdbp->TestBlock(g)) {
|
||||||
case RC_EF:
|
case RC_EF:
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
case RC_NF:
|
return rc;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case RC_NF:
|
||||||
goto next;
|
goto next;
|
||||||
} // endswitch rc
|
} // endswitch rc
|
||||||
|
|
||||||
@@ -697,14 +707,18 @@ int MPXFAM::InitDelete(PGLOBAL, int fpos, int)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MPXFAM::ReadBuffer(PGLOBAL g)
|
int MPXFAM::ReadBuffer(PGLOBAL g)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Sequential block reading when Placed is not true. */
|
/* Sequential block reading when Placed is not true. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
if (Placed) {
|
if (Placed) {
|
||||||
Placed = false;
|
Placed = false;
|
||||||
} else if (Mempos >= Top) { // Are we at the end of the memory
|
} else if (Mempos >= Top) { // Are we at the end of the memory
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
} else if (++CurNum < Nrec) {
|
return rc;
|
||||||
|
|
||||||
|
} else if (++CurNum < Nrec) {
|
||||||
Fpos = Mempos;
|
Fpos = Mempos;
|
||||||
} else {
|
} else {
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
@@ -714,7 +728,7 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
|
|
||||||
next:
|
next:
|
||||||
if (++CurBlk >= Block)
|
if (++CurBlk >= Block)
|
||||||
return RC_EF;
|
return GetNext(g);
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Before reading a new block, check whether block optimization */
|
/* Before reading a new block, check whether block optimization */
|
||||||
@@ -722,8 +736,11 @@ int MPXFAM::ReadBuffer(PGLOBAL g)
|
|||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
switch (Tdbp->TestBlock(g)) {
|
switch (Tdbp->TestBlock(g)) {
|
||||||
case RC_EF:
|
case RC_EF:
|
||||||
return RC_EF;
|
if ((rc = GetNext(g)) != RC_OK)
|
||||||
case RC_NF:
|
return rc;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case RC_NF:
|
||||||
goto next;
|
goto next;
|
||||||
} // endswitch rc
|
} // endswitch rc
|
||||||
|
|
||||||
|
@@ -41,7 +41,8 @@ class DllExport MAPFAM : public TXTFAM {
|
|||||||
virtual int SkipRecord(PGLOBAL g, bool header);
|
virtual int SkipRecord(PGLOBAL g, bool header);
|
||||||
virtual bool OpenTableFile(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual bool DeferReading(void) {return false;}
|
virtual bool DeferReading(void) {return false;}
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual int GetNext(PGLOBAL g) {return RC_EF;}
|
||||||
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
||||||
|
1426
storage/connect/filamgz.cpp
Normal file
1426
storage/connect/filamgz.cpp
Normal file
File diff suppressed because it is too large
Load Diff
170
storage/connect/filamgz.h
Normal file
170
storage/connect/filamgz.h
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
/*************** FilAmGz H Declares Source Code File (.H) **************/
|
||||||
|
/* Name: FILAMGZ.H Version 1.3 */
|
||||||
|
/* */
|
||||||
|
/* (C) Copyright to the author Olivier BERTRAND 2005-2016 */
|
||||||
|
/* */
|
||||||
|
/* This file contains the GZIP access method classes declares. */
|
||||||
|
/***********************************************************************/
|
||||||
|
#ifndef __FILAMGZ_H
|
||||||
|
#define __FILAMGZ_H
|
||||||
|
|
||||||
|
#include "zlib.h"
|
||||||
|
|
||||||
|
typedef class GZFAM *PGZFAM;
|
||||||
|
typedef class ZBKFAM *PZBKFAM;
|
||||||
|
typedef class ZIXFAM *PZIXFAM;
|
||||||
|
typedef class ZLBFAM *PZLBFAM;
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* This is the access method class declaration for not optimized */
|
||||||
|
/* variable record length files compressed using the gzip library */
|
||||||
|
/* functions. File is accessed record by record (row). */
|
||||||
|
/***********************************************************************/
|
||||||
|
class DllExport GZFAM : public TXTFAM {
|
||||||
|
// friend class DOSCOL;
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
GZFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
|
||||||
|
GZFAM(PGZFAM txfp);
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
virtual AMT GetAmType(void) {return TYPE_AM_GZ;}
|
||||||
|
virtual int GetPos(void);
|
||||||
|
virtual int GetNextPos(void);
|
||||||
|
virtual PTXF Duplicate(PGLOBAL g)
|
||||||
|
{return (PTXF)new(g) GZFAM(this);}
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
virtual void Reset(void);
|
||||||
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
|
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
||||||
|
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
|
||||||
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
|
virtual int GetRowID(void);
|
||||||
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
|
virtual bool SetPos(PGLOBAL g, int recpos);
|
||||||
|
virtual int SkipRecord(PGLOBAL g, bool header);
|
||||||
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
|
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
||||||
|
virtual void Rewind(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int Zerror(PGLOBAL g); // GZ error function
|
||||||
|
|
||||||
|
// Members
|
||||||
|
gzFile Zfile; // Points to GZ file structure
|
||||||
|
z_off_t Zpos; // Uncompressed file position
|
||||||
|
}; // end of class GZFAM
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* This is the access method class declaration for optimized variable */
|
||||||
|
/* record length files compressed using the gzip library functions. */
|
||||||
|
/* The File is accessed by block (requires an opt file). */
|
||||||
|
/***********************************************************************/
|
||||||
|
class DllExport ZBKFAM : public GZFAM {
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
ZBKFAM(PDOSDEF tdp);
|
||||||
|
ZBKFAM(PZBKFAM txfp);
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
virtual int GetPos(void);
|
||||||
|
virtual int GetNextPos(void) {return 0;}
|
||||||
|
virtual PTXF Duplicate(PGLOBAL g)
|
||||||
|
{return (PTXF)new(g) ZBKFAM(this);}
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
virtual int Cardinality(PGLOBAL g);
|
||||||
|
virtual int MaxBlkSize(PGLOBAL g, int s);
|
||||||
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
|
virtual int GetRowID(void);
|
||||||
|
virtual bool RecordPos(PGLOBAL g);
|
||||||
|
virtual int SkipRecord(PGLOBAL g, bool header);
|
||||||
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
|
virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
|
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
||||||
|
virtual void Rewind(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Members
|
||||||
|
char *CurLine; // Position of current line in buffer
|
||||||
|
char *NxtLine; // Position of Next line in buffer
|
||||||
|
bool Closing; // True when closing on Insert
|
||||||
|
}; // end of class ZBKFAM
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* This is the access method class declaration for fixed record */
|
||||||
|
/* length files compressed using the gzip library functions. */
|
||||||
|
/* The file is always accessed by block. */
|
||||||
|
/***********************************************************************/
|
||||||
|
class DllExport ZIXFAM : public ZBKFAM {
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
ZIXFAM(PDOSDEF tdp);
|
||||||
|
ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
virtual int GetNextPos(void) {return 0;}
|
||||||
|
virtual PTXF Duplicate(PGLOBAL g)
|
||||||
|
{return (PTXF)new(g) ZIXFAM(this);}
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
virtual int Cardinality(PGLOBAL g);
|
||||||
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// No additional Members
|
||||||
|
}; // end of class ZIXFAM
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
|
||||||
|
/* fixed/variable files compressed using the zlib library functions. */
|
||||||
|
/* Physically these are written and read using the same technique */
|
||||||
|
/* than blocked variable files, only the contain of each block is */
|
||||||
|
/* compressed using the deflate zlib function. The purpose of this */
|
||||||
|
/* specific format is to have a fast mechanism for direct access of */
|
||||||
|
/* records so blocked optimization is fast and direct access (joins) */
|
||||||
|
/* is allowed. Note that the block length is written ahead of each */
|
||||||
|
/* block to enable reading when optimization file is not available. */
|
||||||
|
/***********************************************************************/
|
||||||
|
class DllExport ZLBFAM : public BLKFAM {
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
ZLBFAM(PDOSDEF tdp);
|
||||||
|
ZLBFAM(PZLBFAM txfp);
|
||||||
|
|
||||||
|
// Implementation
|
||||||
|
virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;}
|
||||||
|
virtual int GetPos(void);
|
||||||
|
virtual int GetNextPos(void);
|
||||||
|
virtual PTXF Duplicate(PGLOBAL g)
|
||||||
|
{return (PTXF)new(g) ZLBFAM(this);}
|
||||||
|
inline void SetOptimized(bool b) {Optimized = b;}
|
||||||
|
|
||||||
|
// Methods
|
||||||
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
|
virtual bool SetPos(PGLOBAL g, int recpos);
|
||||||
|
virtual bool AllocateBuffer(PGLOBAL g);
|
||||||
|
virtual int ReadBuffer(PGLOBAL g);
|
||||||
|
virtual int WriteBuffer(PGLOBAL g);
|
||||||
|
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
||||||
|
virtual void Rewind(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool WriteCompressedBuffer(PGLOBAL g);
|
||||||
|
int ReadCompressedBuffer(PGLOBAL g, void *rdbuf);
|
||||||
|
|
||||||
|
// Members
|
||||||
|
z_streamp Zstream; // Compression/decompression stream
|
||||||
|
Byte *Zbuffer; // Compressed block buffer
|
||||||
|
int *Zlenp; // Pointer to block length
|
||||||
|
bool Optimized; // true when opt file is available
|
||||||
|
}; // end of class ZLBFAM
|
||||||
|
|
||||||
|
#endif // __FILAMGZ_H
|
File diff suppressed because it is too large
Load Diff
@@ -1,170 +1,117 @@
|
|||||||
/************** FilAmZip H Declares Source Code File (.H) **************/
|
/************** filamzip H Declares Source Code File (.H) **************/
|
||||||
/* Name: FILAMZIP.H Version 1.2 */
|
/* Name: filamzip.h Version 1.0 */
|
||||||
/* */
|
/* */
|
||||||
/* (C) Copyright to the author Olivier BERTRAND 2005-2014 */
|
/* (C) Copyright to the author Olivier BERTRAND 2016 */
|
||||||
/* */
|
/* */
|
||||||
/* This file contains the GZIP access method classes declares. */
|
/* This file contains the ZIP file access method classes declares. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#ifndef __FILAMZIP_H
|
#ifndef __FILAMZIP_H
|
||||||
#define __FILAMZIP_H
|
#define __FILAMZIP_H
|
||||||
|
|
||||||
#include "zlib.h"
|
#include "block.h"
|
||||||
|
#include "filamap.h"
|
||||||
|
#include "unzip.h"
|
||||||
|
|
||||||
|
#define DLLEXPORT extern "C"
|
||||||
|
|
||||||
typedef class ZIPFAM *PZIPFAM;
|
typedef class ZIPFAM *PZIPFAM;
|
||||||
typedef class ZBKFAM *PZBKFAM;
|
typedef class ZPXFAM *PZPXFAM;
|
||||||
typedef class ZIXFAM *PZIXFAM;
|
|
||||||
typedef class ZLBFAM *PZLBFAM;
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* This is the access method class declaration for not optimized */
|
/* This is the ZIP utility fonctions class. */
|
||||||
/* variable record length files compressed using the gzip library */
|
|
||||||
/* functions. File is accessed record by record (row). */
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport ZIPFAM : public TXTFAM {
|
class DllExport ZIPUTIL : public BLOCK {
|
||||||
// friend class DOSCOL;
|
public:
|
||||||
public:
|
// Constructor
|
||||||
// Constructor
|
ZIPUTIL(PSZ tgt, bool mul);
|
||||||
ZIPFAM(PDOSDEF tdp) : TXTFAM(tdp) {Zfile = NULL; Zpos = 0;}
|
//ZIPUTIL(ZIPUTIL *zutp);
|
||||||
ZIPFAM(PZIPFAM txfp);
|
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual AMT GetAmType(void) {return TYPE_AM_ZIP;}
|
//PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
|
||||||
virtual int GetPos(void);
|
|
||||||
virtual int GetNextPos(void);
|
|
||||||
virtual PTXF Duplicate(PGLOBAL g)
|
|
||||||
{return (PTXF)new(g) ZIPFAM(this);}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual void Reset(void);
|
virtual bool OpenTable(PGLOBAL g, MODE mode, char *fn);
|
||||||
virtual int GetFileLength(PGLOBAL g);
|
bool open(PGLOBAL g, char *fn);
|
||||||
virtual int Cardinality(PGLOBAL g) {return (g) ? -1 : 0;}
|
bool openEntry(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
|
void close(void);
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
void closeEntry(void);
|
||||||
virtual int GetRowID(void);
|
bool WildMatch(PSZ pat, PSZ str);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
int findEntry(PGLOBAL g, bool next);
|
||||||
virtual bool SetPos(PGLOBAL g, int recpos);
|
int nextEntry(PGLOBAL g);
|
||||||
virtual int SkipRecord(PGLOBAL g, bool header);
|
|
||||||
virtual bool OpenTableFile(PGLOBAL g);
|
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
|
||||||
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
|
||||||
virtual void Rewind(void);
|
|
||||||
|
|
||||||
protected:
|
// Members
|
||||||
int Zerror(PGLOBAL g); // GZ error function
|
unzFile zipfile; // The ZIP container file
|
||||||
|
PSZ target; // The target file name
|
||||||
// Members
|
unz_file_info finfo; // The current file info
|
||||||
gzFile Zfile; // Points to GZ file structure
|
PFBLOCK fp;
|
||||||
z_off_t Zpos; // Uncompressed file position
|
char *memory;
|
||||||
}; // end of class ZIPFAM
|
uint size;
|
||||||
|
int multiple; // Multiple targets
|
||||||
|
bool entryopen; // True when open current entry
|
||||||
|
char fn[FILENAME_MAX]; // The current entry file name
|
||||||
|
char mapCaseTable[256];
|
||||||
|
}; // end of ZIPFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* This is the access method class declaration for optimized variable */
|
/* This is the ZIP file access method. */
|
||||||
/* record length files compressed using the gzip library functions. */
|
|
||||||
/* The File is accessed by block (requires an opt file). */
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport ZBKFAM : public ZIPFAM {
|
class DllExport ZIPFAM : public MAPFAM {
|
||||||
public:
|
friend class ZPXFAM;
|
||||||
// Constructor
|
public:
|
||||||
ZBKFAM(PDOSDEF tdp);
|
// Constructors
|
||||||
ZBKFAM(PZBKFAM txfp);
|
ZIPFAM(PDOSDEF tdp);
|
||||||
|
ZIPFAM(PZIPFAM txfp);
|
||||||
|
ZIPFAM(PDOSDEF tdp, PZPXFAM txfp);
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual int GetPos(void);
|
virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
|
||||||
virtual int GetNextPos(void) {return 0;}
|
virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZIPFAM(this); }
|
||||||
virtual PTXF Duplicate(PGLOBAL g)
|
|
||||||
{return (PTXF)new(g) ZBKFAM(this);}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int MaxBlkSize(PGLOBAL g, int s);
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
//virtual int MaxBlkSize(PGLOBAL g, int s) {return s;}
|
||||||
virtual int GetRowID(void);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual bool RecordPos(PGLOBAL g);
|
virtual bool DeferReading(void) { return false; }
|
||||||
virtual int SkipRecord(PGLOBAL g, bool header);
|
virtual int GetNext(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
//virtual int ReadBuffer(PGLOBAL g);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
//virtual int WriteBuffer(PGLOBAL g);
|
||||||
virtual int DeleteRecords(PGLOBAL g, int irc);
|
//virtual int DeleteRecords(PGLOBAL g, int irc);
|
||||||
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
//virtual void CloseTableFile(PGLOBAL g, bool abort);
|
||||||
virtual void Rewind(void);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Members
|
// Members
|
||||||
char *CurLine; // Position of current line in buffer
|
ZIPUTIL *zutp;
|
||||||
char *NxtLine; // Position of Next line in buffer
|
PSZ target;
|
||||||
bool Closing; // True when closing on Insert
|
bool mul;
|
||||||
}; // end of class ZBKFAM
|
}; // end of ZIPFAM
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* This is the access method class declaration for fixed record */
|
/* This is the fixed ZIP file access method. */
|
||||||
/* length files compressed using the gzip library functions. */
|
|
||||||
/* The file is always accessed by block. */
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
class DllExport ZIXFAM : public ZBKFAM {
|
class DllExport ZPXFAM : public MPXFAM {
|
||||||
public:
|
friend class ZIPFAM;
|
||||||
// Constructor
|
public:
|
||||||
ZIXFAM(PDOSDEF tdp);
|
// Constructors
|
||||||
ZIXFAM(PZIXFAM txfp) : ZBKFAM(txfp) {}
|
ZPXFAM(PDOSDEF tdp);
|
||||||
|
ZPXFAM(PZPXFAM txfp);
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
virtual int GetNextPos(void) {return 0;}
|
virtual AMT GetAmType(void) { return TYPE_AM_ZIP; }
|
||||||
virtual PTXF Duplicate(PGLOBAL g)
|
virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)ZPXFAM(this); }
|
||||||
{return (PTXF)new(g) ZIXFAM(this);}
|
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
virtual int Cardinality(PGLOBAL g);
|
virtual int GetFileLength(PGLOBAL g);
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
virtual int Cardinality(PGLOBAL g);
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
virtual bool OpenTableFile(PGLOBAL g);
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
virtual int GetNext(PGLOBAL g);
|
||||||
|
//virtual int ReadBuffer(PGLOBAL g);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// No additional Members
|
// Members
|
||||||
}; // end of class ZIXFAM
|
ZIPUTIL *zutp;
|
||||||
|
PSZ target;
|
||||||
/***********************************************************************/
|
bool mul;
|
||||||
/* This is the DOS/UNIX Access Method class declaration for PlugDB */
|
}; // end of ZPXFAM
|
||||||
/* fixed/variable files compressed using the zlib library functions. */
|
|
||||||
/* Physically these are written and read using the same technique */
|
|
||||||
/* than blocked variable files, only the contain of each block is */
|
|
||||||
/* compressed using the deflate zlib function. The purpose of this */
|
|
||||||
/* specific format is to have a fast mechanism for direct access of */
|
|
||||||
/* records so blocked optimization is fast and direct access (joins) */
|
|
||||||
/* is allowed. Note that the block length is written ahead of each */
|
|
||||||
/* block to enable reading when optimization file is not available. */
|
|
||||||
/***********************************************************************/
|
|
||||||
class DllExport ZLBFAM : public BLKFAM {
|
|
||||||
public:
|
|
||||||
// Constructor
|
|
||||||
ZLBFAM(PDOSDEF tdp);
|
|
||||||
ZLBFAM(PZLBFAM txfp);
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
virtual AMT GetAmType(void) {return TYPE_AM_ZLIB;}
|
|
||||||
virtual int GetPos(void);
|
|
||||||
virtual int GetNextPos(void);
|
|
||||||
virtual PTXF Duplicate(PGLOBAL g)
|
|
||||||
{return (PTXF)new(g) ZLBFAM(this);}
|
|
||||||
inline void SetOptimized(bool b) {Optimized = b;}
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
virtual int GetFileLength(PGLOBAL g);
|
|
||||||
virtual bool SetPos(PGLOBAL g, int recpos);
|
|
||||||
virtual bool AllocateBuffer(PGLOBAL g);
|
|
||||||
virtual int ReadBuffer(PGLOBAL g);
|
|
||||||
virtual int WriteBuffer(PGLOBAL g);
|
|
||||||
virtual void CloseTableFile(PGLOBAL g, bool abort);
|
|
||||||
virtual void Rewind(void);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool WriteCompressedBuffer(PGLOBAL g);
|
|
||||||
int ReadCompressedBuffer(PGLOBAL g, void *rdbuf);
|
|
||||||
|
|
||||||
// Members
|
|
||||||
z_streamp Zstream; // Compression/decompression stream
|
|
||||||
Byte *Zbuffer; // Compressed block buffer
|
|
||||||
int *Zlenp; // Pointer to block length
|
|
||||||
bool Optimized; // true when opt file is available
|
|
||||||
}; // end of class ZLBFAM
|
|
||||||
|
|
||||||
#endif // __FILAMZIP_H
|
#endif // __FILAMZIP_H
|
||||||
|
@@ -171,9 +171,9 @@
|
|||||||
#define JSONMAX 10 // JSON Default max grp size
|
#define JSONMAX 10 // JSON Default max grp size
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char version[]= "Version 1.04.0008 August 10, 2016";
|
char version[]= "Version 1.05.0001 December 13, 2016";
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
char compver[]= "Version 1.04.0008 " __DATE__ " " __TIME__;
|
char compver[]= "Version 1.05.0001 " __DATE__ " " __TIME__;
|
||||||
char slash= '\\';
|
char slash= '\\';
|
||||||
#else // !__WIN__
|
#else // !__WIN__
|
||||||
char slash= '/';
|
char slash= '/';
|
||||||
@@ -512,13 +512,13 @@ ha_create_table_option connect_table_option_list[]=
|
|||||||
HA_TOPTION_NUMBER("QUOTED", quoted, (ulonglong) -1, 0, 3, 1),
|
HA_TOPTION_NUMBER("QUOTED", quoted, (ulonglong) -1, 0, 3, 1),
|
||||||
HA_TOPTION_NUMBER("ENDING", ending, (ulonglong) -1, 0, INT_MAX32, 1),
|
HA_TOPTION_NUMBER("ENDING", ending, (ulonglong) -1, 0, INT_MAX32, 1),
|
||||||
HA_TOPTION_NUMBER("COMPRESS", compressed, 0, 0, 2, 1),
|
HA_TOPTION_NUMBER("COMPRESS", compressed, 0, 0, 2, 1),
|
||||||
//HA_TOPTION_BOOL("COMPRESS", compressed, 0),
|
|
||||||
HA_TOPTION_BOOL("MAPPED", mapped, 0),
|
HA_TOPTION_BOOL("MAPPED", mapped, 0),
|
||||||
HA_TOPTION_BOOL("HUGE", huge, 0),
|
HA_TOPTION_BOOL("HUGE", huge, 0),
|
||||||
HA_TOPTION_BOOL("SPLIT", split, 0),
|
HA_TOPTION_BOOL("SPLIT", split, 0),
|
||||||
HA_TOPTION_BOOL("READONLY", readonly, 0),
|
HA_TOPTION_BOOL("READONLY", readonly, 0),
|
||||||
HA_TOPTION_BOOL("SEPINDEX", sepindex, 0),
|
HA_TOPTION_BOOL("SEPINDEX", sepindex, 0),
|
||||||
HA_TOPTION_END
|
HA_TOPTION_BOOL("ZIPPED", zipped, 0),
|
||||||
|
HA_TOPTION_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -532,7 +532,6 @@ ha_create_table_option connect_field_option_list[]=
|
|||||||
{
|
{
|
||||||
HA_FOPTION_NUMBER("FLAG", offset, (ulonglong) -1, 0, INT_MAX32, 1),
|
HA_FOPTION_NUMBER("FLAG", offset, (ulonglong) -1, 0, INT_MAX32, 1),
|
||||||
HA_FOPTION_NUMBER("MAX_DIST", freq, 0, 0, INT_MAX32, 1), // BLK_INDX
|
HA_FOPTION_NUMBER("MAX_DIST", freq, 0, 0, INT_MAX32, 1), // BLK_INDX
|
||||||
//HA_FOPTION_NUMBER("DISTRIB", opt, 0, 0, 2, 1), // used for BLK_INDX
|
|
||||||
HA_FOPTION_NUMBER("FIELD_LENGTH", fldlen, 0, 0, INT_MAX32, 1),
|
HA_FOPTION_NUMBER("FIELD_LENGTH", fldlen, 0, 0, INT_MAX32, 1),
|
||||||
HA_FOPTION_STRING("DATE_FORMAT", dateformat),
|
HA_FOPTION_STRING("DATE_FORMAT", dateformat),
|
||||||
HA_FOPTION_STRING("FIELD_FORMAT", fieldformat),
|
HA_FOPTION_STRING("FIELD_FORMAT", fieldformat),
|
||||||
@@ -678,7 +677,6 @@ static int connect_init_func(void *p)
|
|||||||
connect_hton= (handlerton *)p;
|
connect_hton= (handlerton *)p;
|
||||||
connect_hton->state= SHOW_OPTION_YES;
|
connect_hton->state= SHOW_OPTION_YES;
|
||||||
connect_hton->create= connect_create_handler;
|
connect_hton->create= connect_create_handler;
|
||||||
//connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED | HTON_NO_PARTITION;
|
|
||||||
connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED;
|
connect_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED;
|
||||||
connect_hton->table_options= connect_table_option_list;
|
connect_hton->table_options= connect_table_option_list;
|
||||||
connect_hton->field_options= connect_field_option_list;
|
connect_hton->field_options= connect_field_option_list;
|
||||||
@@ -1135,7 +1133,9 @@ bool GetBooleanTableOption(PGLOBAL g, PTOS options, char *opname, bool bdef)
|
|||||||
opval= options->sepindex;
|
opval= options->sepindex;
|
||||||
else if (!stricmp(opname, "Header"))
|
else if (!stricmp(opname, "Header"))
|
||||||
opval= (options->header != 0); // Is Boolean for some table types
|
opval= (options->header != 0); // Is Boolean for some table types
|
||||||
else if (options->oplist)
|
else if (!stricmp(opname, "Zipped"))
|
||||||
|
opval = options->zipped;
|
||||||
|
else if (options->oplist)
|
||||||
if ((pv= GetListOption(g, opname, options->oplist)))
|
if ((pv= GetListOption(g, opname, options->oplist)))
|
||||||
opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0);
|
opval= (!*pv || *pv == 'y' || *pv == 'Y' || atoi(pv) != 0);
|
||||||
|
|
||||||
@@ -1242,8 +1242,10 @@ char *ha_connect::GetStringOption(char *opname, char *sdef)
|
|||||||
|
|
||||||
if (opval && (!stricmp(opname, "connect")
|
if (opval && (!stricmp(opname, "connect")
|
||||||
|| !stricmp(opname, "tabname")
|
|| !stricmp(opname, "tabname")
|
||||||
|| !stricmp(opname, "filename")))
|
|| !stricmp(opname, "filename")
|
||||||
opval = GetRealString(opval);
|
|| !stricmp(opname, "optname")
|
||||||
|
|| !stricmp(opname, "entry")))
|
||||||
|
opval = GetRealString(opval);
|
||||||
|
|
||||||
if (!opval) {
|
if (!opval) {
|
||||||
if (sdef && !strcmp(sdef, "*")) {
|
if (sdef && !strcmp(sdef, "*")) {
|
||||||
@@ -4165,7 +4167,8 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
|
|||||||
case TAB_DIR:
|
case TAB_DIR:
|
||||||
case TAB_MAC:
|
case TAB_MAC:
|
||||||
case TAB_WMI:
|
case TAB_WMI:
|
||||||
case TAB_OEM:
|
case TAB_ZIP:
|
||||||
|
case TAB_OEM:
|
||||||
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
#ifdef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
@@ -5173,13 +5176,13 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
char v=0, spc= ',', qch= 0;
|
char v=0, spc= ',', qch= 0;
|
||||||
const char *fncn= "?";
|
const char *fncn= "?";
|
||||||
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
|
const char *user, *fn, *db, *host, *pwd, *sep, *tbl, *src;
|
||||||
const char *col, *ocl, *rnk, *pic, *fcl, *skc;
|
const char *col, *ocl, *rnk, *pic, *fcl, *skc, *zfn;
|
||||||
char *tab, *dsn, *shm, *dpath;
|
char *tab, *dsn, *shm, *dpath;
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
char *nsp= NULL, *cls= NULL;
|
char *nsp= NULL, *cls= NULL;
|
||||||
#endif // __WIN__
|
#endif // __WIN__
|
||||||
int port= 0, hdr= 0, mxr= 0, mxe= 0, rc= 0;
|
//int hdr, mxe;
|
||||||
int cop __attribute__((unused))= 0, lrecl= 0;
|
int port = 0, mxr = 0, rc = 0, mul = 0, lrecl = 0;
|
||||||
#if defined(ODBC_SUPPORT)
|
#if defined(ODBC_SUPPORT)
|
||||||
POPARM sop= NULL;
|
POPARM sop= NULL;
|
||||||
char *ucnc= NULL;
|
char *ucnc= NULL;
|
||||||
@@ -5190,7 +5193,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
PJPARM sjp= NULL;
|
PJPARM sjp= NULL;
|
||||||
char *driver= NULL;
|
char *driver= NULL;
|
||||||
char *url= NULL;
|
char *url= NULL;
|
||||||
char *tabtyp = NULL;
|
//char *prop= NULL;
|
||||||
|
char *tabtyp= NULL;
|
||||||
#endif // JDBC_SUPPORT
|
#endif // JDBC_SUPPORT
|
||||||
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
|
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
|
||||||
bool bif, ok= false, dbf= false;
|
bool bif, ok= false, dbf= false;
|
||||||
@@ -5210,7 +5214,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
if (!g)
|
if (!g)
|
||||||
return HA_ERR_INTERNAL_ERROR;
|
return HA_ERR_INTERNAL_ERROR;
|
||||||
|
|
||||||
user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= dsn= NULL;
|
user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= zfn= dsn= NULL;
|
||||||
|
|
||||||
// Get the useful create options
|
// Get the useful create options
|
||||||
ttp= GetTypeID(topt->type);
|
ttp= GetTypeID(topt->type);
|
||||||
@@ -5223,7 +5227,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
sep= topt->separator;
|
sep= topt->separator;
|
||||||
spc= (!sep) ? ',' : *sep;
|
spc= (!sep) ? ',' : *sep;
|
||||||
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
|
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
|
||||||
hdr= (int)topt->header;
|
mul = (int)topt->multiple;
|
||||||
tbl= topt->tablist;
|
tbl= topt->tablist;
|
||||||
col= topt->colist;
|
col= topt->colist;
|
||||||
|
|
||||||
@@ -5256,13 +5260,16 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
#if defined(JDBC_SUPPORT)
|
#if defined(JDBC_SUPPORT)
|
||||||
driver= GetListOption(g, "Driver", topt->oplist, NULL);
|
driver= GetListOption(g, "Driver", topt->oplist, NULL);
|
||||||
// url= GetListOption(g, "URL", topt->oplist, NULL);
|
// url= GetListOption(g, "URL", topt->oplist, NULL);
|
||||||
|
// prop = GetListOption(g, "Properties", topt->oplist, NULL);
|
||||||
tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
|
tabtyp = GetListOption(g, "Tabtype", topt->oplist, NULL);
|
||||||
#endif // JDBC_SUPPORT
|
#endif // JDBC_SUPPORT
|
||||||
mxe= atoi(GetListOption(g,"maxerr", topt->oplist, "0"));
|
|
||||||
#if defined(PROMPT_OK)
|
#if defined(PROMPT_OK)
|
||||||
cop= atoi(GetListOption(g, "checkdsn", topt->oplist, "0"));
|
cop= atoi(GetListOption(g, "checkdsn", topt->oplist, "0"));
|
||||||
#endif // PROMPT_OK
|
#endif // PROMPT_OK
|
||||||
} else {
|
#if defined(ZIP_SUPPORT)
|
||||||
|
zfn = GetListOption(g, "Zipfile", topt->oplist, NULL);
|
||||||
|
#endif // ZIP_SUPPORT
|
||||||
|
} else {
|
||||||
host= "localhost";
|
host= "localhost";
|
||||||
user= (ttp == TAB_ODBC ? NULL : "root");
|
user= (ttp == TAB_ODBC ? NULL : "root");
|
||||||
} // endif option_list
|
} // endif option_list
|
||||||
@@ -5366,6 +5373,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
jdef->SetName(create_info->alias);
|
jdef->SetName(create_info->alias);
|
||||||
sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM));
|
sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM));
|
||||||
sjp->Driver= driver;
|
sjp->Driver= driver;
|
||||||
|
// sjp->Properties = prop;
|
||||||
sjp->Fsize= 0;
|
sjp->Fsize= 0;
|
||||||
sjp->Scrollable= false;
|
sjp->Scrollable= false;
|
||||||
|
|
||||||
@@ -5468,7 +5476,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
case TAB_XML:
|
case TAB_XML:
|
||||||
#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
|
#endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT
|
||||||
case TAB_JSON:
|
case TAB_JSON:
|
||||||
if (!fn)
|
if (!fn && !zfn && !mul)
|
||||||
sprintf(g->Message, "Missing %s file name", topt->type);
|
sprintf(g->Message, "Missing %s file name", topt->type);
|
||||||
else
|
else
|
||||||
ok= true;
|
ok= true;
|
||||||
@@ -5582,7 +5590,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
NULL, port, fnc == FNC_COL);
|
NULL, port, fnc == FNC_COL);
|
||||||
break;
|
break;
|
||||||
case TAB_CSV:
|
case TAB_CSV:
|
||||||
qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL);
|
qrp = CSVColumns(g, dpath, topt, fnc == FNC_COL);
|
||||||
break;
|
break;
|
||||||
#if defined(__WIN__)
|
#if defined(__WIN__)
|
||||||
case TAB_WMI:
|
case TAB_WMI:
|
||||||
@@ -6947,7 +6955,7 @@ maria_declare_plugin(connect)
|
|||||||
0x0104, /* version number (1.04) */
|
0x0104, /* version number (1.04) */
|
||||||
NULL, /* status variables */
|
NULL, /* status variables */
|
||||||
connect_system_variables, /* system variables */
|
connect_system_variables, /* system variables */
|
||||||
"1.04.0008", /* string version */
|
"1.05.0001", /* string version */
|
||||||
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
||||||
}
|
}
|
||||||
maria_declare_plugin_end;
|
maria_declare_plugin_end;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user