mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '10.5' into 10.6
This commit is contained in:
131
client/mysql.cc
131
client/mysql.cc
@@ -171,6 +171,9 @@ static int connect_flag=CLIENT_INTERACTIVE;
|
||||
static my_bool opt_binary_mode= FALSE;
|
||||
static my_bool opt_connect_expired_password= FALSE;
|
||||
static int interrupted_query= 0;
|
||||
#ifdef USE_LIBEDIT_INTERFACE
|
||||
static int sigint_received= 0;
|
||||
#endif
|
||||
static char *current_host,*current_db,*current_user=0,*opt_password=0,
|
||||
*current_prompt=0, *delimiter_str= 0,
|
||||
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
|
||||
@@ -1073,6 +1076,8 @@ extern "C" sig_handler handle_sigint(int sig);
|
||||
static sig_handler window_resize(int sig);
|
||||
#endif
|
||||
|
||||
static void end_in_sig_handler(int sig);
|
||||
static bool kill_query(const char *reason);
|
||||
|
||||
const char DELIMITER_NAME[]= "delimiter";
|
||||
const uint DELIMITER_NAME_LEN= sizeof(DELIMITER_NAME) - 1;
|
||||
@@ -1379,30 +1384,35 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This function handles sigint calls
|
||||
If query is in process, kill query
|
||||
If 'source' is executed, abort source command
|
||||
no query in process, terminate like previous behavior
|
||||
void end_in_sig_handler(int sig)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
When SIGINT is raised on Windows, the OS creates a new thread to handle the
|
||||
interrupt. Once that thread completes, the main thread continues running
|
||||
only to find that it's resources have already been free'd when the sigint
|
||||
handler called mysql_end().
|
||||
*/
|
||||
mysql_thread_end();
|
||||
#else
|
||||
mysql_end(sig);
|
||||
#endif
|
||||
}
|
||||
|
||||
sig_handler handle_sigint(int sig)
|
||||
|
||||
/*
|
||||
Kill a running query. Returns true if we were unable to connect to the server.
|
||||
*/
|
||||
bool kill_query(const char *reason)
|
||||
{
|
||||
char kill_buffer[40];
|
||||
MYSQL *kill_mysql= NULL;
|
||||
|
||||
/* terminate if no query being executed, or we already tried interrupting */
|
||||
if (!executing_query || (interrupted_query == 2))
|
||||
{
|
||||
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
kill_mysql= mysql_init(kill_mysql);
|
||||
if (!do_connect(kill_mysql,current_host, current_user, opt_password, "", 0))
|
||||
{
|
||||
tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n");
|
||||
goto err;
|
||||
tee_fprintf(stdout, "%s -- sorry, cannot connect to server to kill query, giving up ...\n", reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* First time try to kill the query, second time the connection */
|
||||
@@ -1417,27 +1427,62 @@ sig_handler handle_sigint(int sig)
|
||||
(interrupted_query == 1) ? "QUERY " : "",
|
||||
mysql_thread_id(&mysql));
|
||||
if (verbose)
|
||||
tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n",
|
||||
tee_fprintf(stdout, "%s -- sending \"%s\" to server ...\n", reason,
|
||||
kill_buffer);
|
||||
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
|
||||
mysql_close(kill_mysql);
|
||||
tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
|
||||
if (interrupted_query == 1)
|
||||
tee_fprintf(stdout, "%s -- query killed.\n", reason);
|
||||
else
|
||||
tee_fprintf(stdout, "%s -- connection killed.\n", reason);
|
||||
|
||||
if (in_com_source)
|
||||
aborted= 1; // Abort source command
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
err:
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
This function handles sigint calls
|
||||
If query is in process, kill query
|
||||
If 'source' is executed, abort source command
|
||||
no query in process, regenerate prompt.
|
||||
*/
|
||||
sig_handler handle_sigint(int sig)
|
||||
{
|
||||
/*
|
||||
When SIGINT is raised on Windows, the OS creates a new thread to handle the
|
||||
interrupt. Once that thread completes, the main thread continues running
|
||||
only to find that it's resources have already been free'd when the sigint
|
||||
handler called mysql_end().
|
||||
On Unix only, if no query is being executed just clear the prompt,
|
||||
don't exit. On Windows we exit.
|
||||
*/
|
||||
mysql_thread_end();
|
||||
if (!executing_query)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
tee_fprintf(stdout, "^C\n");
|
||||
#ifdef USE_LIBEDIT_INTERFACE
|
||||
/* Libedit will regenerate it outside of the signal handler. */
|
||||
sigint_received= 1;
|
||||
#else
|
||||
mysql_end(sig);
|
||||
rl_on_new_line(); // Regenerate the prompt on a newline
|
||||
rl_replace_line("", 0); // Clear the previous text
|
||||
rl_redisplay();
|
||||
#endif
|
||||
#else // WIN32
|
||||
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
|
||||
end_in_sig_handler(sig);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
When executing a query, this newline makes the prompt look like so:
|
||||
^C
|
||||
Ctrl-C -- query killed.
|
||||
*/
|
||||
tee_fprintf(stdout, "\n");
|
||||
if (kill_query("Ctrl-C"))
|
||||
{
|
||||
aborted= 1;
|
||||
end_in_sig_handler(sig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2004,6 +2049,15 @@ static int get_options(int argc, char **argv)
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
#if !defined(_WIN32) && defined(USE_LIBEDIT_INTERFACE)
|
||||
static inline void reset_prompt(char *in_string, bool *ml_comment) {
|
||||
glob_buffer.length(0);
|
||||
*ml_comment = false;
|
||||
*in_string = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int read_and_execute(bool interactive)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@@ -2119,7 +2173,30 @@ static int read_and_execute(bool interactive)
|
||||
if (line)
|
||||
free(line);
|
||||
line= readline(prompt);
|
||||
#endif /* defined(_WIN32) */
|
||||
#ifdef USE_LIBEDIT_INTERFACE
|
||||
/*
|
||||
libedit handles interrupts different than libreadline.
|
||||
libreadline has its own signal handlers, thus a sigint during readline
|
||||
doesn't force readline to return null string.
|
||||
|
||||
However libedit returns null if the interrupt signal is raised.
|
||||
We can also get an empty string when ctrl+d is pressed (EoF).
|
||||
|
||||
We need this sigint_received flag, to differentiate between the two
|
||||
cases. This flag is only set during our handle_sigint function when
|
||||
LIBEDIT_INTERFACE is used.
|
||||
*/
|
||||
if (!line && sigint_received)
|
||||
{
|
||||
// User asked to clear the input.
|
||||
sigint_received= 0;
|
||||
reset_prompt(&in_string, &ml_comment);
|
||||
continue;
|
||||
}
|
||||
// For safety, we always mark this as cleared.
|
||||
sigint_received= 0;
|
||||
#endif
|
||||
#endif /* defined(__WIN__) */
|
||||
|
||||
/*
|
||||
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
|
||||
|
@@ -102,11 +102,7 @@ IF(NOT VERSION)
|
||||
SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(64BIT)
|
||||
SET(DEFAULT_MACHINE "x86_64")
|
||||
ELSE()
|
||||
SET(DEFAULT_MACHINE "i386")
|
||||
ENDIF()
|
||||
SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
|
||||
ENDIF()
|
||||
|
||||
IF(DEFAULT_MACHINE MATCHES "i386")
|
||||
|
@@ -114,6 +114,9 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE)
|
||||
{
|
||||
rl_completion_func_t *func1= (rl_completion_func_t*)0;
|
||||
rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
|
||||
rl_on_new_line();
|
||||
rl_replace_line(\"\", 0);
|
||||
rl_redisplay();
|
||||
}"
|
||||
NEW_READLINE_INTERFACE)
|
||||
|
||||
|
@@ -73,6 +73,7 @@
|
||||
#cmakedefine HAVE_SYS_IOCTL_H 1
|
||||
#cmakedefine HAVE_SYS_MALLOC_H 1
|
||||
#cmakedefine HAVE_SYS_MMAN_H 1
|
||||
#cmakedefine HAVE_SYS_MNTENT_H 1
|
||||
#cmakedefine HAVE_SYS_NDIR_H 1
|
||||
#cmakedefine HAVE_SYS_PTE_H 1
|
||||
#cmakedefine HAVE_SYS_PTEM_H 1
|
||||
|
@@ -28,6 +28,11 @@
|
||||
#define NO_OLD_TIMEVAL_NAME
|
||||
#define HAVE_SECURE_RENEGOTIATION
|
||||
#define HAVE_EXTENDED_MASTER
|
||||
/*
|
||||
Following is workaround about a WolfSSL 5.6.6 bug.
|
||||
The bug is about undefined sessionCtxSz during compilation.
|
||||
*/
|
||||
#define WOLFSSL_SESSION_ID_CTX
|
||||
|
||||
/* TLSv1.3 definitions (all needed to build) */
|
||||
#define WOLFSSL_TLS13
|
||||
|
Submodule extra/wolfssl/wolfssl updated: 3b3c175af0...66596ad9e1
@@ -1460,6 +1460,39 @@ f
|
||||
foo
|
||||
SET @@COLLATION_CONNECTION= @old_collation_connection;
|
||||
#
|
||||
# MDEV-32587 JSON_VALID fail to validate integer zero in scientific notation
|
||||
#
|
||||
select JSON_VALID(' {"number": 1E-4}');
|
||||
JSON_VALID(' {"number": 1E-4}')
|
||||
1
|
||||
select JSON_VALID(' {"number": 0E-4}');
|
||||
JSON_VALID(' {"number": 0E-4}')
|
||||
1
|
||||
select JSON_VALID(' {"number": 0.0}');
|
||||
JSON_VALID(' {"number": 0.0}')
|
||||
1
|
||||
select JSON_VALID(' {"number": 0.1E-4}');
|
||||
JSON_VALID(' {"number": 0.1E-4}')
|
||||
1
|
||||
select JSON_VALID(' {"number": 0e-4}');
|
||||
JSON_VALID(' {"number": 0e-4}')
|
||||
1
|
||||
select JSON_VALID(' {"number": -0E-4}');
|
||||
JSON_VALID(' {"number": -0E-4}')
|
||||
1
|
||||
select JSON_VALUE(' {"number": 0E-4}', '$.number');
|
||||
JSON_VALUE(' {"number": 0E-4}', '$.number')
|
||||
0E-4
|
||||
select JSON_VALID(' {"number": 00E-4}');
|
||||
JSON_VALID(' {"number": 00E-4}')
|
||||
0
|
||||
select JSON_VALID(' {"number": 01E-4}');
|
||||
JSON_VALID(' {"number": 01E-4}')
|
||||
0
|
||||
select JSON_VALID(' {"number": 0E-4.0}');
|
||||
JSON_VALID(' {"number": 0E-4.0}')
|
||||
0
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
#
|
||||
|
@@ -947,6 +947,22 @@ SELECT JSON_VALUE('["foo"]', '$**[0]') AS f;
|
||||
|
||||
SET @@COLLATION_CONNECTION= @old_collation_connection;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32587 JSON_VALID fail to validate integer zero in scientific notation
|
||||
--echo #
|
||||
# Passing
|
||||
select JSON_VALID(' {"number": 1E-4}');
|
||||
select JSON_VALID(' {"number": 0E-4}');
|
||||
select JSON_VALID(' {"number": 0.0}');
|
||||
select JSON_VALID(' {"number": 0.1E-4}');
|
||||
select JSON_VALID(' {"number": 0e-4}');
|
||||
select JSON_VALID(' {"number": -0E-4}');
|
||||
select JSON_VALUE(' {"number": 0E-4}', '$.number');
|
||||
# Failing
|
||||
select JSON_VALID(' {"number": 00E-4}');
|
||||
select JSON_VALID(' {"number": 01E-4}');
|
||||
select JSON_VALID(' {"number": 0E-4.0}');
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
@@ -5286,3 +5286,30 @@ ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-28651 quote(NULL) returns incorrect result in view ('NU' instead of 'NULL')
|
||||
#
|
||||
CREATE VIEW v1 AS SELECT quote(NULL);
|
||||
SELECT * FROM v1;
|
||||
quote(NULL)
|
||||
NULL
|
||||
DESCRIBE v1;
|
||||
Field Type Null Key Default Extra
|
||||
quote(NULL) varbinary(4) YES NULL
|
||||
CREATE TABLE t1 AS SELECT * FROM v1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`quote(NULL)` varbinary(4) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
SELECT * FROM t1;
|
||||
quote(NULL)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
@@ -2335,3 +2335,25 @@ SELECT DECODE(NULL, NULL, NULL);
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-28651 quote(NULL) returns incorrect result in view ('NU' instead of 'NULL')
|
||||
--echo #
|
||||
|
||||
CREATE VIEW v1 AS SELECT quote(NULL);
|
||||
SELECT * FROM v1;
|
||||
DESCRIBE v1;
|
||||
CREATE TABLE t1 AS SELECT * FROM v1;
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
DROP VIEW v1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
@@ -1,14 +1,9 @@
|
||||
SET SQL_MODE="";
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET @old_log_output= @@global.log_output;
|
||||
SET @old_slow_query_log= @@global.slow_query_log;
|
||||
SET @old_general_log= @@global.general_log;
|
||||
SET @old_long_query_time= @@session.long_query_time;
|
||||
use mysql;
|
||||
SET @saved_long_query_time = @@long_query_time;
|
||||
SET @saved_log_output = @@log_output;
|
||||
SET @saved_general_log = @@GLOBAL.general_log;
|
||||
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
|
||||
truncate table general_log;
|
||||
select * from general_log;
|
||||
event_time user_host thread_id server_id command_type argument
|
||||
@@ -120,6 +115,9 @@ show open tables;
|
||||
Database Table In_use Name_locked
|
||||
SET GLOBAL GENERAL_LOG=ON;
|
||||
SET GLOBAL SLOW_QUERY_LOG=ON;
|
||||
#
|
||||
# Bug#23924 general_log truncates queries with character set introducers.
|
||||
#
|
||||
truncate table mysql.general_log;
|
||||
set names binary;
|
||||
select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
|
||||
@@ -131,6 +129,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query set names binary
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
|
||||
set names utf8;
|
||||
#
|
||||
# Bug #16905 Log tables: unicode statements are logged incorrectly
|
||||
#
|
||||
truncate table mysql.general_log;
|
||||
set names utf8;
|
||||
create table bug16905 (s char(15) character set utf8 default 'пусто');
|
||||
@@ -142,6 +143,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query create table bug16905 (s char(15) characte
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое')
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
|
||||
drop table bug16905;
|
||||
#
|
||||
# Bug #17600: Invalid data logged into mysql.slow_log
|
||||
#
|
||||
truncate table mysql.slow_log;
|
||||
set session long_query_time=1;
|
||||
select sleep(2);
|
||||
@@ -150,7 +154,11 @@ sleep(2)
|
||||
select * from mysql.slow_log;
|
||||
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
|
||||
TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0
|
||||
set @@session.long_query_time = @saved_long_query_time;
|
||||
set @@session.long_query_time = @old_long_query_time;
|
||||
#
|
||||
# Bug #18559 log tables cannot change engine, and gets deadlocked when
|
||||
# dropping w/ log on
|
||||
#
|
||||
alter table mysql.general_log engine=myisam;
|
||||
ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
|
||||
alter table mysql.slow_log engine=myisam;
|
||||
@@ -232,7 +240,7 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query truncate table mysql.slow_log
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2)
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @saved_long_query_time
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @old_long_query_time
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam
|
||||
TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log
|
||||
@@ -300,17 +308,20 @@ ON UPDATE CURRENT_TIMESTAMP,
|
||||
set global general_log='ON';
|
||||
set global slow_query_log='ON';
|
||||
use test;
|
||||
#
|
||||
# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
|
||||
#
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
use mysql;
|
||||
lock tables general_log read local, help_category read local;
|
||||
ERROR HY000: You can't use locks with log tables
|
||||
unlock tables;
|
||||
#
|
||||
# Bug #17544 Cannot do atomic log rotate and
|
||||
# Bug #21785 Server crashes after rename of the log table
|
||||
#
|
||||
SET SESSION long_query_time = 1000;
|
||||
drop table if exists mysql.renamed_general_log;
|
||||
drop table if exists mysql.renamed_slow_log;
|
||||
drop table if exists mysql.general_log_new;
|
||||
drop table if exists mysql.slow_log_new;
|
||||
use mysql;
|
||||
RENAME TABLE general_log TO renamed_general_log;
|
||||
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
|
||||
@@ -356,13 +367,16 @@ set global slow_query_log='ON';
|
||||
ERROR 42S02: Table 'mysql.slow_log' doesn't exist
|
||||
RENAME TABLE general_log2 TO general_log;
|
||||
RENAME TABLE slow_log2 TO slow_log;
|
||||
SET SESSION long_query_time = @saved_long_query_time;
|
||||
SET SESSION long_query_time = @old_long_query_time;
|
||||
set global general_log='ON';
|
||||
set global slow_query_log='ON';
|
||||
flush logs;
|
||||
flush logs;
|
||||
drop table renamed_general_log, renamed_slow_log;
|
||||
use test;
|
||||
#
|
||||
# Bug #21966 Strange warnings on repair of the log tables
|
||||
#
|
||||
use mysql;
|
||||
repair table general_log;
|
||||
Table Op Msg_type Msg_text
|
||||
@@ -380,6 +394,10 @@ slow_log
|
||||
slow_log_new
|
||||
drop table slow_log_new, general_log_new;
|
||||
use test;
|
||||
#
|
||||
# Bug#69953 / MDEV-4851
|
||||
# Log tables should be modifable on LOG_OUTPUT != TABLE
|
||||
#
|
||||
SET GLOBAL LOG_OUTPUT = 'FILE';
|
||||
SET GLOBAL slow_query_log = 1;
|
||||
SET GLOBAL general_log = 1;
|
||||
@@ -388,6 +406,10 @@ ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
|
||||
SET GLOBAL LOG_OUTPUT = 'NONE';
|
||||
ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
||||
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
||||
#
|
||||
# Bug#27857 (Log tables supplies the wrong value for generating
|
||||
# AUTO_INCREMENT numbers)
|
||||
#
|
||||
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
||||
SET GLOBAL general_log = 0;
|
||||
FLUSH LOGS;
|
||||
@@ -451,16 +473,15 @@ START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own sl
|
||||
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 3
|
||||
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 4
|
||||
SET GLOBAL slow_query_log = 0;
|
||||
SET SESSION long_query_time =@saved_long_query_time;
|
||||
SET SESSION long_query_time =@old_long_query_time;
|
||||
FLUSH LOGS;
|
||||
ALTER TABLE mysql.slow_log DROP COLUMN seq;
|
||||
ALTER TABLE mysql.slow_log ENGINE = CSV;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
drop procedure if exists proc25422_truncate_slow;
|
||||
drop procedure if exists proc25422_truncate_general;
|
||||
drop procedure if exists proc25422_alter_slow;
|
||||
drop procedure if exists proc25422_alter_general;
|
||||
#
|
||||
# Bug#25422 (Hang with log tables)
|
||||
#
|
||||
use test//
|
||||
create procedure proc25422_truncate_slow (loops int)
|
||||
begin
|
||||
@@ -485,26 +506,26 @@ end//
|
||||
create procedure proc25422_alter_slow (loops int)
|
||||
begin
|
||||
declare v1 int default 0;
|
||||
declare old_log_state int default @@global.slow_query_log;
|
||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||
while v1 < loops do
|
||||
set @old_log_state = @@global.slow_query_log;
|
||||
set global slow_query_log = 'OFF';
|
||||
alter table mysql.slow_log engine = CSV;
|
||||
set global slow_query_log = @old_log_state;
|
||||
set global slow_query_log = old_log_state;
|
||||
set v1 = v1 + 1;
|
||||
end while;
|
||||
end//
|
||||
create procedure proc25422_alter_general (loops int)
|
||||
begin
|
||||
declare v1 int default 0;
|
||||
declare old_log_state int default @@global.general_log;
|
||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||
while v1 < loops do
|
||||
set @old_log_state = @@global.general_log;
|
||||
set global general_log = 'OFF';
|
||||
alter table mysql.general_log engine = CSV;
|
||||
set global general_log = @old_log_state;
|
||||
set global general_log = old_log_state;
|
||||
set v1 = v1 + 1;
|
||||
end while;
|
||||
end//
|
||||
@@ -563,17 +584,19 @@ drop procedure proc25422_truncate_slow;
|
||||
drop procedure proc25422_truncate_general;
|
||||
drop procedure proc25422_alter_slow;
|
||||
drop procedure proc25422_alter_general;
|
||||
#
|
||||
# Bug#23044 (Warnings on flush of a log table)
|
||||
#
|
||||
FLUSH TABLE mysql.general_log;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
FLUSH TABLE mysql.slow_log;
|
||||
show warnings;
|
||||
Level Code Message
|
||||
DROP TABLE IF EXISTS `db_17876.slow_log_data`;
|
||||
DROP TABLE IF EXISTS `db_17876.general_log_data`;
|
||||
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
|
||||
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
|
||||
DROP DATABASE IF EXISTS `db_17876`;
|
||||
#
|
||||
# Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
|
||||
# thread)
|
||||
#
|
||||
CREATE DATABASE db_17876;
|
||||
CREATE TABLE `db_17876.slow_log_data` (
|
||||
`start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
@@ -686,6 +709,9 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
|
||||
DROP DATABASE IF EXISTS `db_17876`;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
#
|
||||
# Bug#21557 entries in the general query log truncated at 1000 characters.
|
||||
#
|
||||
select CONNECTION_ID() into @thread_id;
|
||||
truncate table mysql.general_log;
|
||||
set global general_log = on;
|
||||
@@ -902,9 +928,9 @@ select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 0
|
||||
set global general_log = off
|
||||
deallocate prepare long_query;
|
||||
set global general_log = @old_general_log;
|
||||
DROP TABLE IF EXISTS log_count;
|
||||
DROP TABLE IF EXISTS slow_log_copy;
|
||||
DROP TABLE IF EXISTS general_log_copy;
|
||||
#
|
||||
# Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||
#
|
||||
CREATE TABLE log_count (count BIGINT(21));
|
||||
SET GLOBAL general_log = ON;
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
@@ -926,9 +952,12 @@ CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
|
||||
DROP TABLE general_log_copy;
|
||||
SET GLOBAL general_log = @saved_general_log;
|
||||
SET GLOBAL slow_query_log = @saved_slow_query_log;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
DROP TABLE log_count;
|
||||
#
|
||||
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
|
||||
#
|
||||
SET SESSION long_query_time = 0;
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
FLUSH LOGS;
|
||||
@@ -954,9 +983,10 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
|
||||
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
|
||||
DROP TABLE t1;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
#
|
||||
# Bug #47924 main.log_tables times out sporadically
|
||||
#
|
||||
use mysql;
|
||||
drop table if exists renamed_general_log;
|
||||
drop table if exists renamed_slow_log;
|
||||
RENAME TABLE general_log TO renamed_general_log;
|
||||
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
|
||||
RENAME TABLE slow_log TO renamed_slow_log;
|
||||
@@ -964,7 +994,34 @@ ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log
|
||||
use test;
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
SET @@session.long_query_time= @old_long_query_time;
|
||||
#
|
||||
# MDEV-33267 User with minimal permissions can intentionally corrupt mysql.slow_log table
|
||||
#
|
||||
truncate mysql.slow_log;
|
||||
set global log_output= 'TABLE';
|
||||
create user u@localhost;
|
||||
set slow_query_log=on, long_query_time=0.1;
|
||||
select 'before evil-doing', sleep(0.2);
|
||||
before evil-doing sleep(0.2)
|
||||
before evil-doing 0
|
||||
connect con1,localhost,u,,;
|
||||
set @@timestamp= 2147483647;
|
||||
set slow_query_log=on, long_query_time=0.1;
|
||||
select 'evil-doing', sleep(1.1);
|
||||
evil-doing sleep(1.1)
|
||||
evil-doing 0
|
||||
disconnect con1;
|
||||
connection default;
|
||||
select 'after evil-doing', sleep(0.2);
|
||||
after evil-doing sleep(0.2)
|
||||
after evil-doing 0
|
||||
select distinct sql_text from mysql.slow_log where sql_text like '%evil%';
|
||||
sql_text
|
||||
select 'before evil-doing', sleep(0.2)
|
||||
select 'evil-doing', sleep(1.1)
|
||||
select 'after evil-doing', sleep(0.2)
|
||||
set global log_output=default;
|
||||
drop user u@localhost;
|
||||
SET @@global.log_output= @old_log_output;
|
||||
SET @@global.slow_query_log= @old_slow_query_log;
|
||||
SET @@global.general_log= @old_general_log;
|
||||
|
@@ -1,13 +1,9 @@
|
||||
# this test needs multithreaded mysqltest
|
||||
-- source include/not_embedded.inc
|
||||
#
|
||||
# Basic log tables test
|
||||
#
|
||||
# check that CSV engine was compiled in
|
||||
|
||||
--source include/have_csv.inc
|
||||
|
||||
SET SQL_MODE="";
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET @old_log_output= @@global.log_output;
|
||||
SET @old_slow_query_log= @@global.slow_query_log;
|
||||
SET @old_general_log= @@global.general_log;
|
||||
@@ -16,16 +12,9 @@ SET @old_long_query_time= @@session.long_query_time;
|
||||
--disable_ps_protocol
|
||||
use mysql;
|
||||
|
||||
# Capture initial settings of system variables
|
||||
# so that we can revert to old state after manipulation for testing
|
||||
# NOTE: PLEASE USE THESE VALUES TO 'RESET' SYSTEM VARIABLES
|
||||
# Capturing old values within the tests results in loss of values
|
||||
# due to people not paying attention to previous tests' changes, captures
|
||||
# or improper cleanup
|
||||
SET @saved_long_query_time = @@long_query_time;
|
||||
SET @saved_log_output = @@log_output;
|
||||
SET @saved_general_log = @@GLOBAL.general_log;
|
||||
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
|
||||
#
|
||||
# Basic log tables test
|
||||
#
|
||||
|
||||
#
|
||||
# Check that log tables work and we can do basic selects. This also
|
||||
@@ -147,9 +136,9 @@ show open tables;
|
||||
SET GLOBAL GENERAL_LOG=ON;
|
||||
SET GLOBAL SLOW_QUERY_LOG=ON;
|
||||
|
||||
#
|
||||
# Bug#23924 general_log truncates queries with character set introducers.
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#23924 general_log truncates queries with character set introducers.
|
||||
--echo #
|
||||
truncate table mysql.general_log;
|
||||
set names binary;
|
||||
select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
|
||||
@@ -157,9 +146,9 @@ select _koi8r'
|
||||
select * from mysql.general_log;
|
||||
set names utf8;
|
||||
|
||||
#
|
||||
# Bug #16905 Log tables: unicode statements are logged incorrectly
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #16905 Log tables: unicode statements are logged incorrectly
|
||||
--echo #
|
||||
|
||||
truncate table mysql.general_log;
|
||||
set names utf8;
|
||||
@@ -169,21 +158,21 @@ insert into bug16905 values ('новое');
|
||||
select * from mysql.general_log;
|
||||
drop table bug16905;
|
||||
|
||||
#
|
||||
# Bug #17600: Invalid data logged into mysql.slow_log
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #17600: Invalid data logged into mysql.slow_log
|
||||
--echo #
|
||||
|
||||
truncate table mysql.slow_log;
|
||||
set session long_query_time=1;
|
||||
select sleep(2);
|
||||
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
|
||||
select * from mysql.slow_log;
|
||||
set @@session.long_query_time = @saved_long_query_time;
|
||||
set @@session.long_query_time = @old_long_query_time;
|
||||
|
||||
#
|
||||
# Bug #18559 log tables cannot change engine, and gets deadlocked when
|
||||
# dropping w/ log on
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #18559 log tables cannot change engine, and gets deadlocked when
|
||||
--echo # dropping w/ log on
|
||||
--echo #
|
||||
|
||||
# check that appropriate error messages are given when one attempts to alter
|
||||
# or drop a log tables, while corresponding logs are enabled
|
||||
@@ -322,9 +311,9 @@ set global general_log='ON';
|
||||
set global slow_query_log='ON';
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
|
||||
--echo #
|
||||
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
@@ -333,18 +322,12 @@ use mysql;
|
||||
lock tables general_log read local, help_category read local;
|
||||
unlock tables;
|
||||
|
||||
#
|
||||
# Bug #17544 Cannot do atomic log rotate and
|
||||
# Bug #21785 Server crashes after rename of the log table
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #17544 Cannot do atomic log rotate and
|
||||
--echo # Bug #21785 Server crashes after rename of the log table
|
||||
--echo #
|
||||
|
||||
SET SESSION long_query_time = 1000;
|
||||
--disable_warnings
|
||||
drop table if exists mysql.renamed_general_log;
|
||||
drop table if exists mysql.renamed_slow_log;
|
||||
drop table if exists mysql.general_log_new;
|
||||
drop table if exists mysql.slow_log_new;
|
||||
--enable_warnings
|
||||
|
||||
use mysql;
|
||||
# Should result in error
|
||||
@@ -399,7 +382,7 @@ set global slow_query_log='ON';
|
||||
|
||||
RENAME TABLE general_log2 TO general_log;
|
||||
RENAME TABLE slow_log2 TO slow_log;
|
||||
SET SESSION long_query_time = @saved_long_query_time;
|
||||
SET SESSION long_query_time = @old_long_query_time;
|
||||
|
||||
# this should work
|
||||
set global general_log='ON';
|
||||
@@ -427,13 +410,6 @@ use test;
|
||||
# TODO: improve filtering of expected errors in master.err in
|
||||
# mysql-test-run.pl (based on the test name ?), and uncomment this test.
|
||||
|
||||
# --disable_warnings
|
||||
# drop table if exists mysql.bad_general_log;
|
||||
# drop table if exists mysql.bad_slow_log;
|
||||
# drop table if exists mysql.general_log_hide;
|
||||
# drop table if exists mysql.slow_log_hide;
|
||||
# --enable_warnings
|
||||
#
|
||||
# create table mysql.bad_general_log (a int) engine= CSV;
|
||||
# create table mysql.bad_slow_log (a int) engine= CSV;
|
||||
#
|
||||
@@ -459,9 +435,9 @@ use test;
|
||||
# drop table mysql.bad_general_log;
|
||||
# drop table mysql.bad_slow_log;
|
||||
|
||||
#
|
||||
# Bug #21966 Strange warnings on repair of the log tables
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #21966 Strange warnings on repair of the log tables
|
||||
--echo #
|
||||
|
||||
use mysql;
|
||||
# check that no warning occurs on repair of the log tables
|
||||
@@ -474,11 +450,10 @@ show tables like "%log%";
|
||||
drop table slow_log_new, general_log_new;
|
||||
use test;
|
||||
|
||||
#
|
||||
# Bug#69953 / MDEV-4851
|
||||
# Log tables should be modifable on LOG_OUTPUT != TABLE
|
||||
#
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#69953 / MDEV-4851
|
||||
--echo # Log tables should be modifable on LOG_OUTPUT != TABLE
|
||||
--echo #
|
||||
|
||||
SET GLOBAL LOG_OUTPUT = 'FILE';
|
||||
SET GLOBAL slow_query_log = 1;
|
||||
@@ -492,10 +467,10 @@ ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
|
||||
ALTER TABLE mysql.general_log DROP COLUMN comment_text;
|
||||
|
||||
|
||||
#
|
||||
# Bug#27857 (Log tables supplies the wrong value for generating
|
||||
# AUTO_INCREMENT numbers)
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#27857 (Log tables supplies the wrong value for generating
|
||||
--echo # AUTO_INCREMENT numbers)
|
||||
--echo #
|
||||
|
||||
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
||||
|
||||
@@ -554,7 +529,7 @@ SELECT "My own slow query", sleep(2);
|
||||
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
|
||||
|
||||
SET GLOBAL slow_query_log = 0;
|
||||
SET SESSION long_query_time =@saved_long_query_time;
|
||||
SET SESSION long_query_time =@old_long_query_time;
|
||||
FLUSH LOGS;
|
||||
|
||||
ALTER TABLE mysql.slow_log DROP COLUMN seq;
|
||||
@@ -563,16 +538,9 @@ ALTER TABLE mysql.slow_log ENGINE = CSV;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
|
||||
#
|
||||
# Bug#25422 (Hang with log tables)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists proc25422_truncate_slow;
|
||||
drop procedure if exists proc25422_truncate_general;
|
||||
drop procedure if exists proc25422_alter_slow;
|
||||
drop procedure if exists proc25422_alter_general;
|
||||
--enable_warnings
|
||||
--echo #
|
||||
--echo # Bug#25422 (Hang with log tables)
|
||||
--echo #
|
||||
|
||||
delimiter //;
|
||||
|
||||
@@ -602,14 +570,14 @@ end//
|
||||
create procedure proc25422_alter_slow (loops int)
|
||||
begin
|
||||
declare v1 int default 0;
|
||||
declare old_log_state int default @@global.slow_query_log;
|
||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||
|
||||
while v1 < loops do
|
||||
set @old_log_state = @@global.slow_query_log;
|
||||
set global slow_query_log = 'OFF';
|
||||
alter table mysql.slow_log engine = CSV;
|
||||
set global slow_query_log = @old_log_state;
|
||||
set global slow_query_log = old_log_state;
|
||||
set v1 = v1 + 1;
|
||||
end while;
|
||||
end//
|
||||
@@ -617,14 +585,14 @@ end//
|
||||
create procedure proc25422_alter_general (loops int)
|
||||
begin
|
||||
declare v1 int default 0;
|
||||
declare old_log_state int default @@global.general_log;
|
||||
declare ER_BAD_LOG_STATEMENT condition for 1575;
|
||||
declare continue handler for ER_BAD_LOG_STATEMENT begin end;
|
||||
|
||||
while v1 < loops do
|
||||
set @old_log_state = @@global.general_log;
|
||||
set global general_log = 'OFF';
|
||||
alter table mysql.general_log engine = CSV;
|
||||
set global general_log = @old_log_state;
|
||||
set global general_log = old_log_state;
|
||||
set v1 = v1 + 1;
|
||||
end while;
|
||||
end//
|
||||
@@ -713,9 +681,9 @@ drop procedure proc25422_alter_general;
|
||||
--enable_ps_protocol
|
||||
|
||||
|
||||
#
|
||||
# Bug#23044 (Warnings on flush of a log table)
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#23044 (Warnings on flush of a log table)
|
||||
--echo #
|
||||
|
||||
FLUSH TABLE mysql.general_log;
|
||||
show warnings;
|
||||
@@ -723,18 +691,10 @@ show warnings;
|
||||
FLUSH TABLE mysql.slow_log;
|
||||
show warnings;
|
||||
|
||||
#
|
||||
# Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
|
||||
# thread)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS `db_17876.slow_log_data`;
|
||||
DROP TABLE IF EXISTS `db_17876.general_log_data`;
|
||||
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
|
||||
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
|
||||
DROP DATABASE IF EXISTS `db_17876`;
|
||||
--enable_warnings
|
||||
--echo #
|
||||
--echo # Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
|
||||
--echo # thread)
|
||||
--echo #
|
||||
|
||||
CREATE DATABASE db_17876;
|
||||
|
||||
@@ -872,9 +832,9 @@ DROP DATABASE IF EXISTS `db_17876`;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
|
||||
#
|
||||
# Bug#21557 entries in the general query log truncated at 1000 characters.
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug#21557 entries in the general query log truncated at 1000 characters.
|
||||
--echo #
|
||||
|
||||
select CONNECTION_ID() into @thread_id;
|
||||
--disable_ps_protocol
|
||||
@@ -993,15 +953,9 @@ AND (command_type = 'Query' OR command_type= 'Execute');
|
||||
deallocate prepare long_query;
|
||||
set global general_log = @old_general_log;
|
||||
|
||||
#
|
||||
# Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS log_count;
|
||||
DROP TABLE IF EXISTS slow_log_copy;
|
||||
DROP TABLE IF EXISTS general_log_copy;
|
||||
--enable_warnings
|
||||
--echo #
|
||||
--echo # Bug#34306: Can't make copy of log tables when server binary log is enabled
|
||||
--echo #
|
||||
|
||||
CREATE TABLE log_count (count BIGINT(21));
|
||||
|
||||
@@ -1031,14 +985,14 @@ INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
|
||||
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
|
||||
DROP TABLE general_log_copy;
|
||||
|
||||
SET GLOBAL general_log = @saved_general_log;
|
||||
SET GLOBAL slow_query_log = @saved_slow_query_log;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
|
||||
DROP TABLE log_count;
|
||||
|
||||
#
|
||||
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #31700: thd->examined_row_count not incremented for 'const' type queries
|
||||
--echo #
|
||||
|
||||
SET SESSION long_query_time = 0;
|
||||
SET GLOBAL slow_query_log = ON;
|
||||
@@ -1065,16 +1019,12 @@ DROP TABLE t1;
|
||||
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
|
||||
#
|
||||
# Bug #47924 main.log_tables times out sporadically
|
||||
#
|
||||
--echo #
|
||||
--echo # Bug #47924 main.log_tables times out sporadically
|
||||
--echo #
|
||||
|
||||
use mysql;
|
||||
# Should result in error
|
||||
--disable_warnings
|
||||
drop table if exists renamed_general_log;
|
||||
drop table if exists renamed_slow_log;
|
||||
--enable_warnings
|
||||
--error ER_CANT_RENAME_LOG_TABLE
|
||||
RENAME TABLE general_log TO renamed_general_log;
|
||||
--error ER_CANT_RENAME_LOG_TABLE
|
||||
@@ -1084,7 +1034,24 @@ use test;
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
|
||||
SET @@session.long_query_time= @old_long_query_time;
|
||||
--echo #
|
||||
--echo # MDEV-33267 User with minimal permissions can intentionally corrupt mysql.slow_log table
|
||||
--echo #
|
||||
truncate mysql.slow_log;
|
||||
set global log_output= 'TABLE';
|
||||
create user u@localhost;
|
||||
set slow_query_log=on, long_query_time=0.1;
|
||||
select 'before evil-doing', sleep(0.2);
|
||||
--connect (con1,localhost,u,,)
|
||||
set @@timestamp= 2147483647;
|
||||
set slow_query_log=on, long_query_time=0.1;
|
||||
select 'evil-doing', sleep(1.1);
|
||||
--disconnect con1
|
||||
--connection default
|
||||
select 'after evil-doing', sleep(0.2);
|
||||
select distinct sql_text from mysql.slow_log where sql_text like '%evil%';
|
||||
set global log_output=default;
|
||||
drop user u@localhost;
|
||||
|
||||
SET @@global.log_output= @old_log_output;
|
||||
SET @@global.slow_query_log= @old_slow_query_log;
|
||||
|
@@ -653,5 +653,29 @@ f1 f2 f3 f4 f5 f6 f7
|
||||
4 00004 0001009089999 netstes psit e
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-29954 Unique hash key on column prefix is computed incorrectly
|
||||
#
|
||||
create table t1 (c char(10),unique key a using hash (c(1)));
|
||||
insert into t1 values (0);
|
||||
check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-32837 long unique does not work like unique key when using replace
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b c
|
||||
2 2 2
|
||||
3 1 1
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
3 2 2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
@@ -634,6 +634,27 @@ replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netst
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29954 Unique hash key on column prefix is computed incorrectly
|
||||
--echo #
|
||||
create table t1 (c char(10),unique key a using hash (c(1)));
|
||||
insert into t1 values (0);
|
||||
check table t1 extended;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32837 long unique does not work like unique key when using replace
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
95
mysql-test/main/long_unique_bugs_no_sp_protocol.result
Normal file
95
mysql-test/main/long_unique_bugs_no_sp_protocol.result
Normal file
@@ -0,0 +1,95 @@
|
||||
#
|
||||
# Start of 10.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-32837 long unique does not work like unique key when using replace
|
||||
#
|
||||
#
|
||||
# Normal unique key + long unique key
|
||||
#
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
Variable_name Value
|
||||
Handler_delete 1
|
||||
Handler_read_key 2
|
||||
Handler_read_rnd 1
|
||||
Handler_write 1
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b c
|
||||
2 2 2
|
||||
3 1 1
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
Variable_name Value
|
||||
Handler_delete 1
|
||||
Handler_read_key 3
|
||||
Handler_read_rnd 2
|
||||
Handler_update 1
|
||||
Handler_write 1
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
3 2 2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Two long unique keys
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY a (a) USING HASH,UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
Variable_name Value
|
||||
Handler_read_key 3
|
||||
Handler_read_rnd 1
|
||||
Handler_update 1
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b c
|
||||
2 2 2
|
||||
3 1 1
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
Variable_name Value
|
||||
Handler_delete 1
|
||||
Handler_read_key 4
|
||||
Handler_read_rnd 2
|
||||
Handler_update 1
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
3 2 2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# One long unique key
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
Variable_name Value
|
||||
Handler_read_key 1
|
||||
Handler_read_rnd 1
|
||||
Handler_update 1
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b c
|
||||
2 2 2
|
||||
3 1 1
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
Variable_name Value
|
||||
Handler_read_key 1
|
||||
Handler_read_rnd 1
|
||||
Handler_update 1
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
3 1 1
|
||||
3 2 2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
68
mysql-test/main/long_unique_bugs_no_sp_protocol.test
Normal file
68
mysql-test/main/long_unique_bugs_no_sp_protocol.test
Normal file
@@ -0,0 +1,68 @@
|
||||
if (`SELECT $SP_PROTOCOL > 0`)
|
||||
{
|
||||
--skip Test requires: sp-protocol disabled
|
||||
}
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32837 long unique does not work like unique key when using replace
|
||||
--echo #
|
||||
|
||||
# This test produces different Handler commands in the SHOW STATUS output
|
||||
# with --sp-protocol. So it's here, in this *.test file with --sp-protocol disabled.
|
||||
|
||||
--echo #
|
||||
--echo # Normal unique key + long unique key
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Two long unique keys
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY a (a) USING HASH,UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # One long unique key
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,1,1);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
FLUSH STATUS;
|
||||
REPLACE INTO t1 VALUES (3,2,2);
|
||||
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
24
mysql-test/main/mysql-interactive.result
Normal file
24
mysql-test/main/mysql-interactive.result
Normal file
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# regression introduced by MDEV-14448
|
||||
#
|
||||
delimiter $
|
||||
select 1;
|
||||
$
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MariaDB connection id is X
|
||||
Server version: Y
|
||||
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
||||
|
||||
MariaDB [(none)]> delimiter $
|
||||
MariaDB [(none)]> select 1;
|
||||
-> $
|
||||
+---+
|
||||
| 1 |
|
||||
+---+
|
||||
| 1 |
|
||||
+---+
|
||||
1 row in set
|
||||
|
||||
MariaDB [(none)]>
|
29
mysql-test/main/mysql-interactive.test
Normal file
29
mysql-test/main/mysql-interactive.test
Normal file
@@ -0,0 +1,29 @@
|
||||
--echo #
|
||||
--echo # regression introduced by MDEV-14448
|
||||
--echo #
|
||||
source include/not_embedded.inc;
|
||||
source include/not_windows.inc;
|
||||
|
||||
error 0,1;
|
||||
exec $MYSQL -V|grep -q readline;
|
||||
if ($sys_errno == 1)
|
||||
{
|
||||
# strangely enough
|
||||
skip does not work with libedit;
|
||||
}
|
||||
|
||||
write_file $MYSQL_TMP_DIR/mysql_in;
|
||||
delimiter $
|
||||
select 1;
|
||||
$
|
||||
EOF
|
||||
let TERM=dumb;
|
||||
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//;
|
||||
error 0,127;
|
||||
exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
|
||||
if ($sys_errno == 127)
|
||||
{
|
||||
remove_file $MYSQL_TMP_DIR/mysql_in;
|
||||
skip no socat;
|
||||
}
|
||||
remove_file $MYSQL_TMP_DIR/mysql_in;
|
@@ -8955,6 +8955,21 @@ DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# MDEV-33270: Call of SP invoking another SP with a parameter
|
||||
# requiring type conversion
|
||||
#
|
||||
SET NAMES latin1;
|
||||
CREATE PROCEDURE p1 (a text) BEGIN SELECT a; END |
|
||||
CREATE PROCEDURE p2 () CALL p1(concat('x',_utf8'x')) |
|
||||
CALL p2();
|
||||
a
|
||||
xx
|
||||
CALL p2();
|
||||
a
|
||||
xx
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
# End of 10.4 tests
|
||||
#
|
||||
#
|
||||
|
@@ -10566,6 +10566,26 @@ DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33270: Call of SP invoking another SP with a parameter
|
||||
--echo # requiring type conversion
|
||||
--echo #
|
||||
|
||||
SET NAMES latin1;
|
||||
|
||||
--delimiter |
|
||||
|
||||
CREATE PROCEDURE p1 (a text) BEGIN SELECT a; END |
|
||||
CREATE PROCEDURE p2 () CALL p1(concat('x',_utf8'x')) |
|
||||
|
||||
--delimiter ;
|
||||
|
||||
CALL p2();
|
||||
CALL p2();
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
||||
|
@@ -600,6 +600,22 @@ DROP TEMPORARY TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-31523: Using two temporary tables in OPTIMIZE TABLE lead to crash
|
||||
#
|
||||
CREATE TEMPORARY TABLE t1 (c INT) ENGINE=MyISAM;
|
||||
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=MyISAM;
|
||||
optimize TABLE t1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status Table is already up to date
|
||||
test.t2 optimize status Table is already up to date
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
# in 11.2 and above here should be listed above used temporary tables
|
||||
DROP TEMPORARY TABLE t1, t2;
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
create function f1() returns int
|
||||
begin
|
||||
drop temporary table t1, t2;
|
||||
|
@@ -657,6 +657,22 @@ DROP TEMPORARY TABLE t1;
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31523: Using two temporary tables in OPTIMIZE TABLE lead to crash
|
||||
--echo #
|
||||
|
||||
CREATE TEMPORARY TABLE t1 (c INT) ENGINE=MyISAM;
|
||||
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=MyISAM;
|
||||
optimize TABLE t1,t2;
|
||||
SHOW TABLES;
|
||||
--echo # in 11.2 and above here should be listed above used temporary tables
|
||||
|
||||
DROP TEMPORARY TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
||||
#
|
||||
# DROP TEMPORARY TABLE fails in the middle
|
||||
#
|
||||
|
@@ -3100,6 +3100,7 @@ sub mysql_install_db {
|
||||
mtr_add_arg($args, "--core-file");
|
||||
mtr_add_arg($args, "--console");
|
||||
mtr_add_arg($args, "--character-set-server=latin1");
|
||||
mtr_add_arg($args, "--disable-performance-schema");
|
||||
|
||||
if ( $opt_debug )
|
||||
{
|
||||
|
@@ -1772,6 +1772,85 @@ Level Code Message
|
||||
Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')"
|
||||
Warnings:
|
||||
Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')"
|
||||
CALL p3('REGEXP_REPLACE(''test'',''t'','''')');
|
||||
----------
|
||||
sql_mode='' qualifier=''
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select regexp_replace('test','t','') AS `REGEXP_REPLACE('test','t','')`
|
||||
----------
|
||||
sql_mode='' qualifier='unknown_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT unknown_schema.REGEXP_REPLACE('test','t','')
|
||||
errmsg
|
||||
ERROR: FUNCTION unknown_schema.REGEXP_REPLACE does not exist
|
||||
----------
|
||||
sql_mode='' qualifier='mariadb_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT mariadb_schema.REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select regexp_replace('test','t','') AS `mariadb_schema.REGEXP_REPLACE('test','t','')`
|
||||
----------
|
||||
sql_mode='' qualifier='maxdb_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT maxdb_schema.REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select regexp_replace('test','t','') AS `maxdb_schema.REGEXP_REPLACE('test','t','')`
|
||||
----------
|
||||
sql_mode='' qualifier='oracle_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT oracle_schema.REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select oracle_schema.regexp_replace('test','t','') AS `oracle_schema.REGEXP_REPLACE('test','t','')`
|
||||
----------
|
||||
sql_mode='ORACLE' qualifier=''
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select regexp_replace('test','t','') AS "REGEXP_REPLACE('test','t','')"
|
||||
----------
|
||||
sql_mode='ORACLE' qualifier='unknown_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT unknown_schema.REGEXP_REPLACE('test','t','')
|
||||
errmsg
|
||||
ERROR: FUNCTION unknown_schema.REGEXP_REPLACE does not exist
|
||||
----------
|
||||
sql_mode='ORACLE' qualifier='mariadb_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT mariadb_schema.REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select mariadb_schema.regexp_replace('test','t','') AS "mariadb_schema.REGEXP_REPLACE('test','t','')"
|
||||
----------
|
||||
sql_mode='ORACLE' qualifier='maxdb_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT maxdb_schema.REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select mariadb_schema.regexp_replace('test','t','') AS "maxdb_schema.REGEXP_REPLACE('test','t','')"
|
||||
----------
|
||||
sql_mode='ORACLE' qualifier='oracle_schema.'
|
||||
query
|
||||
EXPLAIN EXTENDED SELECT oracle_schema.REGEXP_REPLACE('test','t','')
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Level Code Message
|
||||
Note 1003 select regexp_replace('test','t','') AS "oracle_schema.REGEXP_REPLACE('test','t','')"
|
||||
Warnings:
|
||||
Note 1003 select regexp_replace('test','t','') AS "oracle_schema.REGEXP_REPLACE('test','t','')"
|
||||
CALL p3('CONCAT_OPERATOR_ORACLE(''a'')');
|
||||
----------
|
||||
sql_mode='' qualifier=''
|
||||
|
34
mysql-test/suite/compat/oracle/r/func_regexp_replace.result
Normal file
34
mysql-test/suite/compat/oracle/r/func_regexp_replace.result
Normal file
@@ -0,0 +1,34 @@
|
||||
SET sql_mode=ORACLE;
|
||||
#
|
||||
# MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode
|
||||
#
|
||||
CREATE TABLE t1 (replacement VARCHAR(10));
|
||||
INSERT INTO t1 VALUES (NULL), ('');
|
||||
SELECT replacement, REGEXP_REPLACE('abba','a',replacement) FROM t1 ORDER BY replacement;
|
||||
replacement REGEXP_REPLACE('abba','a',replacement)
|
||||
NULL bb
|
||||
bb
|
||||
DROP TABLE t1;
|
||||
SELECT REGEXP_REPLACE('abba','a',null);
|
||||
REGEXP_REPLACE('abba','a',null)
|
||||
bb
|
||||
EXPLAIN EXTENDED SELECT REPLACE('abba','a',null) ;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select replace('abba','a',NULL) AS "REPLACE('abba','a',null)"
|
||||
CREATE VIEW v1 AS SELECT REPLACE('abba','a',null) ;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select replace('abba','a',NULL) AS "REPLACE('abba','a',null)" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
REPLACE('abba','a',null)
|
||||
bb
|
||||
SET sql_mode=DEFAULT;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select oracle_schema.replace('abba','a',NULL) AS `REPLACE('abba','a',null)` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
REPLACE('abba','a',null)
|
||||
bb
|
||||
DROP VIEW v1;
|
@@ -165,6 +165,7 @@ CALL p3('TRIM(1,2)');
|
||||
CALL p3('TRIM(''a'')');
|
||||
CALL p3('TRIM(BOTH '' '' FROM ''a'')');
|
||||
|
||||
CALL p3('REGEXP_REPLACE(''test'',''t'','''')');
|
||||
|
||||
# Deprecated compatibility XXX_ORACLE functions.
|
||||
# These functions are implemented as simple native functions
|
||||
|
26
mysql-test/suite/compat/oracle/t/func_regexp_replace.test
Normal file
26
mysql-test/suite/compat/oracle/t/func_regexp_replace.test
Normal file
@@ -0,0 +1,26 @@
|
||||
SET sql_mode=ORACLE;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode
|
||||
--echo #
|
||||
|
||||
#SELECT REGEXP_REPLACE(null,'a','b') ;
|
||||
#SELECT REGEXP_REPLACE('ab',null,'b') ;
|
||||
#SELECT REGEXP_REPLACE('ab','a',null) ;
|
||||
#SELECT REGEXP_REPLACE('ab',null,null) ;
|
||||
|
||||
CREATE TABLE t1 (replacement VARCHAR(10));
|
||||
INSERT INTO t1 VALUES (NULL), ('');
|
||||
SELECT replacement, REGEXP_REPLACE('abba','a',replacement) FROM t1 ORDER BY replacement;
|
||||
DROP TABLE t1;
|
||||
|
||||
SELECT REGEXP_REPLACE('abba','a',null);
|
||||
EXPLAIN EXTENDED SELECT REPLACE('abba','a',null) ;
|
||||
|
||||
CREATE VIEW v1 AS SELECT REPLACE('abba','a',null) ;
|
||||
SHOW CREATE VIEW v1;
|
||||
SELECT * FROM v1;
|
||||
SET sql_mode=DEFAULT;
|
||||
SHOW CREATE VIEW v1;
|
||||
SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
@@ -10,7 +10,7 @@ performance_schema
|
||||
sys
|
||||
test
|
||||
USE DATABASE nond6;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATABASE nond6' at line 1
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nond6' at line 1
|
||||
DROP DATABASE d6;
|
||||
SHOW DATABASES;
|
||||
Database
|
||||
|
@@ -1,5 +1,16 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
select @@rpl_semi_sync_master_enabled;
|
||||
@@rpl_semi_sync_master_enabled
|
||||
0
|
||||
connection slave;
|
||||
select @@rpl_semi_sync_slave_enabled;
|
||||
@@rpl_semi_sync_slave_enabled
|
||||
0
|
||||
show status like "rpl_semi_sync_slave_status";
|
||||
Variable_name Value
|
||||
Rpl_semi_sync_slave_status OFF
|
||||
connection master;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.t1'
|
||||
|
@@ -3085,8 +3085,10 @@ eval SHOW CREATE VIEW test1.v$level;
|
||||
# the following line as written as '--eror ER_TOO_MANY_TABLES' and the command
|
||||
# is successful so assuming no expected error was intended
|
||||
# --error ER_TOO_MANY_TABLES
|
||||
--disable_ps2_protocol
|
||||
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$level;
|
||||
--enable_ps2_protocol
|
||||
let $message= The output of following EXPLAIN is deactivated, because the result
|
||||
differs on some platforms
|
||||
FIXME Is this a bug ? ;
|
||||
@@ -3116,16 +3118,20 @@ SELECT f1 as f2, f2 as f1 FROM test2.t1;
|
||||
CREATE OR REPLACE VIEW test2.v0 AS
|
||||
SELECT CAST('0001-01-01' AS DATE) as f1, f2 FROM test3.t1;
|
||||
eval SHOW CREATE VIEW test1.v$toplevel;
|
||||
--disable_ps2_protocol
|
||||
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
|
||||
--enable_ps2_protocol
|
||||
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
|
||||
# 2.3.3 UCS2 string instead of common string
|
||||
CREATE OR REPLACE VIEW test3.v0 AS
|
||||
SELECT f1 , CONVERT('ßÄäÖöÜü§' USING UCS2) as f2 FROM test1.t1;
|
||||
eval SHOW CREATE VIEW test1.v$toplevel;
|
||||
--disable_ps2_protocol
|
||||
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
|
||||
--enable_ps2_protocol
|
||||
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
|
||||
|
||||
@@ -3133,8 +3139,10 @@ eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CREATE OR REPLACE VIEW test3.v0 AS
|
||||
SELECT CONVERT('ßÄäÖöÜü§' USING UCS2) as f1, f2 FROM test1.t1;
|
||||
eval SHOW CREATE VIEW test1.v$toplevel;
|
||||
--disable_ps2_protocol
|
||||
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
|
||||
--enable_ps2_protocol
|
||||
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
|
||||
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
|
||||
--enable_result_log
|
||||
|
@@ -120,7 +120,6 @@ Filename::tab#.ibd
|
||||
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
|
||||
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
|
||||
#::# | Freshly allocated page | -
|
||||
#::# | Freshly allocated page | -
|
||||
# Variables used by page type dump for ibdata1
|
||||
|
||||
Variables (--variable-name=value)
|
||||
@@ -154,7 +153,6 @@ Filename::tab#.ibd
|
||||
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
|
||||
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
|
||||
#::# | Freshly allocated page | -
|
||||
#::# | Freshly allocated page | -
|
||||
[6]: check the valid lower bound values for option
|
||||
# allow-mismatches,page,start-page,end-page
|
||||
[9]: check the both short and long options "page" and "start-page" when
|
||||
|
@@ -38,8 +38,9 @@ connection master;
|
||||
include/rpl_start_server.inc [server_number=1]
|
||||
# Master has restarted successfully
|
||||
connection slave;
|
||||
include/wait_for_slave_io_to_start.inc
|
||||
include/wait_for_slave_sql_to_start.inc
|
||||
include/stop_slave_sql.inc
|
||||
include/stop_slave_io.inc
|
||||
include/start_slave.inc
|
||||
select * from ti;
|
||||
a
|
||||
1
|
||||
|
@@ -3,7 +3,8 @@ include/master-slave.inc
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
SET @save_dbug= @@GLOBAL.debug_dbug;
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
|
||||
SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
|
||||
include/start_slave.inc
|
||||
# Future events must be logged at least 2 seconds after
|
||||
# the slave starts
|
||||
@@ -15,11 +16,6 @@ insert into t1 values (1);
|
||||
# event in its relay log
|
||||
flush logs;
|
||||
connection slave;
|
||||
# Ignore FDEs that happen before the CREATE/INSERT commands
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
# On the next FDE, the slave should have the master CREATE/INSERT events
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
select count(*)=1 from t1;
|
||||
|
@@ -67,10 +67,26 @@ connection master;
|
||||
save_master_pos;
|
||||
|
||||
--connection slave
|
||||
|
||||
# Left to its own devices, the IO thread may or may not stop in error,
|
||||
# depending on what it is doing when its connection to the primary is killed
|
||||
# (e.g. a failed read results in an error, whereas if the IO thread is idly
|
||||
# waiting for events when the connection dies, it will enter into a reconnect
|
||||
# loop and reconnect). So we manually stop/start the IO thread to ensure it is
|
||||
# in a consistent state
|
||||
#
|
||||
# FIXME: We shouldn't need to stop/start the SQL thread here, but due to
|
||||
# MDEV-33268, we have to. So after fixing 33268, this should only stop/start
|
||||
# the IO thread. Note the SQL thread must be stopped first due to an invalid
|
||||
# DBUG_ASSERT in the IO thread's stop logic that depends on the state of the
|
||||
# SQL thread (also reported and to be fixed in the same ticket).
|
||||
#
|
||||
--source include/stop_slave_sql.inc
|
||||
--let rpl_allow_error=1
|
||||
--source include/wait_for_slave_io_to_start.inc
|
||||
--source include/stop_slave_io.inc
|
||||
--let rpl_allow_error=
|
||||
--source include/wait_for_slave_sql_to_start.inc
|
||||
--source include/start_slave.inc
|
||||
|
||||
sync_with_master;
|
||||
select * from ti;
|
||||
select * from tm;
|
||||
|
@@ -27,7 +27,8 @@
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
SET @save_dbug= @@GLOBAL.debug_dbug;
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master";
|
||||
SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
|
||||
SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
|
||||
--source include/start_slave.inc
|
||||
|
||||
--let $sleep_time=2
|
||||
@@ -46,12 +47,6 @@ insert into t1 values (1);
|
||||
flush logs;
|
||||
|
||||
--connection slave
|
||||
--echo # Ignore FDEs that happen before the CREATE/INSERT commands
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
|
||||
|
||||
--echo # On the next FDE, the slave should have the master CREATE/INSERT events
|
||||
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
|
||||
select count(*)=1 from t1;
|
||||
@@ -132,6 +127,7 @@ while (!$caught_up)
|
||||
}
|
||||
sleep 0.1;
|
||||
}
|
||||
set debug_sync="RESET";
|
||||
--enable_query_log
|
||||
|
||||
--connection master
|
||||
|
@@ -5,6 +5,8 @@ CHECK_SYMBOL_EXISTS (getmntent "sys/mnttab.h" HAVE_GETMNTENT_IN_SYS_MNTAB)
|
||||
CHECK_SYMBOL_EXISTS (setmntent "mntent.h" HAVE_SETMNTENT)
|
||||
CHECK_SYMBOL_EXISTS (getmntinfo "sys/types.h;sys/mount.h" HAVE_GETMNTINFO)
|
||||
|
||||
CHECK_INCLUDE_FILES (sys/mntent.h HAVE_SYS_MNTENT_H)
|
||||
|
||||
IF (HAVE_GETMNTINFO)
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <sys/types.h>
|
||||
|
@@ -19,19 +19,18 @@
|
||||
#include <sys/types.h>
|
||||
#if defined(HAVE_GETMNTENT)
|
||||
#include <mntent.h>
|
||||
#elif defined(HAVE_SYS_MNTENT)
|
||||
#include <sys/mntent.h>
|
||||
#elif !defined(HAVE_GETMNTINFO_TAKES_statvfs)
|
||||
#elif defined(HAVE_GETMNTINFO) && !defined(HAVE_GETMNTINFO_TAKES_statvfs)
|
||||
/* getmntinfo (the not NetBSD variants) */
|
||||
#include <sys/param.h>
|
||||
#if defined(HAVE_SYS_UCRED)
|
||||
#include <sys/ucred.h>
|
||||
#endif
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
#if defined(HAVE_GETMNTENT_IN_SYS_MNTAB)
|
||||
#include <sys/mnttab.h>
|
||||
#define HAVE_GETMNTENT
|
||||
#if defined(HAVE_SYS_MNTENT_H)
|
||||
#include <sys/mntent.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <sql_class.h>
|
||||
#include <sql_i_s.h>
|
||||
|
@@ -1166,9 +1166,9 @@ is_local_ip()
|
||||
# the domain name check:
|
||||
if [ "${2:-0}" -eq 0 ]; then
|
||||
# We consider all the names of a given host to be local addresses:
|
||||
[ "$1" = "$(hostname -s)" -o \
|
||||
"$1" = "$(hostname -f)" -o \
|
||||
"$1" = "$(hostname -d)" ] && return 0
|
||||
[ "$1" = "$(hostname -s 2>/dev/null)" -o \
|
||||
"$1" = "$(hostname -f 2>/dev/null)" -o \
|
||||
"$1" = "$(hostname -d 2>/dev/null)" ] && return 0
|
||||
fi
|
||||
# If the address contains anything other than digits
|
||||
# and separators, it is not a local address:
|
||||
|
@@ -475,9 +475,9 @@ EOF
|
||||
# Preparing binlog files for transfer:
|
||||
wsrep_log_info "Preparing binlog files for transfer:"
|
||||
tar_type=0
|
||||
if tar --help | grep -qw -F -- '--transform'; then
|
||||
if tar --help 2>/dev/null | grep -qw -F -- '--transform'; then
|
||||
tar_type=1
|
||||
elif tar --version | grep -qw -E '^bsdtar'; then
|
||||
elif tar --version 2>/dev/null | grep -qw -E '^bsdtar'; then
|
||||
tar_type=2
|
||||
fi
|
||||
if [ $tar_type -eq 2 ]; then
|
||||
@@ -980,7 +980,7 @@ EOF
|
||||
fi
|
||||
# Extracting binlog files:
|
||||
wsrep_log_info "Extracting binlog files:"
|
||||
if tar --version | grep -qw -E '^bsdtar'; then
|
||||
if tar --version 2>/dev/null | grep -qw -E '^bsdtar'; then
|
||||
tar -tf "$BINLOG_TAR_FILE" > "$tmpfile" && \
|
||||
tar -xvf "$BINLOG_TAR_FILE" > /dev/null || RC=$?
|
||||
else
|
||||
|
15
sql/field.cc
15
sql/field.cc
@@ -7633,7 +7633,20 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr) const
|
||||
a_ptr, field_length,
|
||||
b_ptr, field_length,
|
||||
Field_string::char_length(),
|
||||
MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES);
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
int Field_string::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
|
||||
size_t prefix_char_len) const
|
||||
{
|
||||
size_t field_len= table->field[field_index]->field_length;
|
||||
|
||||
return field_charset()->coll->strnncollsp_nchars(field_charset(),
|
||||
a_ptr, field_len,
|
||||
b_ptr, field_len,
|
||||
prefix_char_len,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -4070,6 +4070,8 @@ public:
|
||||
String *val_str(String *, String *) override;
|
||||
my_decimal *val_decimal(my_decimal *) override;
|
||||
int cmp(const uchar *,const uchar *) const override;
|
||||
int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_char_len) const
|
||||
override;
|
||||
void sort_string(uchar *buff,uint length) override;
|
||||
void update_data_type_statistics(Data_type_statistics *st) const override
|
||||
{
|
||||
@@ -4092,9 +4094,6 @@ public:
|
||||
bool compatible_field_size(uint field_metadata, const Relay_log_info *rli,
|
||||
uint16 mflags, int *order_var) const override;
|
||||
uint row_pack_length() const override { return field_length; }
|
||||
int pack_cmp(const uchar *a,const uchar *b,uint key_length,
|
||||
bool insert_or_update);
|
||||
int pack_cmp(const uchar *b,uint key_length,bool insert_or_update);
|
||||
uint packed_col_length(const uchar *to, uint length) override;
|
||||
uint max_packed_col_length(uint max_length) override;
|
||||
uint size_of() const override { return sizeof *this; }
|
||||
|
@@ -2675,7 +2675,10 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
|
||||
return TRUE;
|
||||
|
||||
if (!thd->stmt_arena->is_conventional() &&
|
||||
thd->lex->current_select->first_cond_optimization)
|
||||
((!thd->lex->current_select &&
|
||||
(thd->stmt_arena->is_stmt_prepare_or_first_sp_execute() ||
|
||||
thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute())) ||
|
||||
thd->lex->current_select->first_cond_optimization))
|
||||
{
|
||||
Query_arena *arena, backup;
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
|
13
sql/item.h
13
sql/item.h
@@ -1016,6 +1016,19 @@ public:
|
||||
expressions with subqueries in the ORDER/GROUP clauses.
|
||||
*/
|
||||
String *val_str() { return val_str(&str_value); }
|
||||
String *val_str_null_to_empty(String *to)
|
||||
{
|
||||
String *res= val_str(to);
|
||||
if (res)
|
||||
return res;
|
||||
to->set_charset(collation.collation);
|
||||
to->length(0);
|
||||
return to;
|
||||
}
|
||||
String *val_str_null_to_empty(String *to, bool null_to_empty)
|
||||
{
|
||||
return null_to_empty ? val_str_null_to_empty(to) : val_str(to);
|
||||
}
|
||||
virtual Item_func *get_item_func() { return NULL; }
|
||||
|
||||
const MY_LOCALE *locale_from_val_str();
|
||||
|
@@ -1909,7 +1909,10 @@ protected:
|
||||
class Create_func_regexp_replace : public Create_func_arg3
|
||||
{
|
||||
public:
|
||||
virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3);
|
||||
Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override
|
||||
{
|
||||
return new (thd->mem_root) Item_func_regexp_replace(thd, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
static Create_func_regexp_replace s_singleton;
|
||||
|
||||
@@ -1918,6 +1921,28 @@ protected:
|
||||
virtual ~Create_func_regexp_replace() = default;
|
||||
};
|
||||
|
||||
Create_func_regexp_replace Create_func_regexp_replace::s_singleton;
|
||||
|
||||
|
||||
class Create_func_regexp_replace_oracle : public Create_func_arg3
|
||||
{
|
||||
public:
|
||||
Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override
|
||||
{
|
||||
return new (thd->mem_root) Item_func_regexp_replace_oracle(thd, arg1,
|
||||
arg2, arg3);
|
||||
}
|
||||
|
||||
static Create_func_regexp_replace_oracle s_singleton;
|
||||
|
||||
protected:
|
||||
Create_func_regexp_replace_oracle() = default;
|
||||
virtual ~Create_func_regexp_replace_oracle() = default;
|
||||
};
|
||||
|
||||
Create_func_regexp_replace_oracle
|
||||
Create_func_regexp_replace_oracle::s_singleton;
|
||||
|
||||
|
||||
class Create_func_regexp_substr : public Create_func_arg2
|
||||
{
|
||||
@@ -5061,15 +5086,6 @@ Create_func_regexp_instr::create_2_arg(THD *thd, Item *arg1, Item *arg2)
|
||||
}
|
||||
|
||||
|
||||
Create_func_regexp_replace Create_func_regexp_replace::s_singleton;
|
||||
|
||||
Item*
|
||||
Create_func_regexp_replace::create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3)
|
||||
{
|
||||
return new (thd->mem_root) Item_func_regexp_replace(thd, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
|
||||
Create_func_regexp_substr Create_func_regexp_substr::s_singleton;
|
||||
|
||||
Item*
|
||||
@@ -6091,6 +6107,8 @@ const Native_func_registry func_array_oracle_overrides[] =
|
||||
{ { STRING_WITH_LEN("LENGTH") }, BUILDER(Create_func_char_length)},
|
||||
{ { STRING_WITH_LEN("LPAD") }, BUILDER(Create_func_lpad_oracle)},
|
||||
{ { STRING_WITH_LEN("LTRIM") }, BUILDER(Create_func_ltrim_oracle)},
|
||||
{ { STRING_WITH_LEN("REGEXP_REPLACE") },
|
||||
BUILDER(Create_func_regexp_replace_oracle)},
|
||||
{ { STRING_WITH_LEN("RPAD") }, BUILDER(Create_func_rpad_oracle)},
|
||||
{ { STRING_WITH_LEN("RTRIM") }, BUILDER(Create_func_rtrim_oracle)},
|
||||
{ {0, 0}, NULL}
|
||||
|
@@ -1146,8 +1146,7 @@ bool Item_func_reverse::fix_length_and_dec()
|
||||
Fix that this works with binary strings when using USE_MB
|
||||
*/
|
||||
|
||||
String *Item_func_replace::val_str_internal(String *str,
|
||||
String *empty_string_for_null)
|
||||
String *Item_func_replace::val_str_internal(String *str, bool null_to_empty)
|
||||
{
|
||||
DBUG_ASSERT(fixed());
|
||||
String *res,*res2,*res3;
|
||||
@@ -1165,13 +1164,8 @@ String *Item_func_replace::val_str_internal(String *str,
|
||||
res=args[0]->val_str(str);
|
||||
if (args[0]->null_value)
|
||||
goto null;
|
||||
res2=args[1]->val_str(&tmp_value);
|
||||
if (args[1]->null_value)
|
||||
{
|
||||
if (!empty_string_for_null)
|
||||
if (!(res2= args[1]->val_str_null_to_empty(&tmp_value, null_to_empty)))
|
||||
goto null;
|
||||
res2= empty_string_for_null;
|
||||
}
|
||||
res->set_charset(collation.collation);
|
||||
|
||||
#ifdef USE_MB
|
||||
@@ -1188,12 +1182,8 @@ String *Item_func_replace::val_str_internal(String *str,
|
||||
if (binary_cmp && (offset=res->strstr(*res2)) < 0)
|
||||
return res;
|
||||
#endif
|
||||
if (!(res3=args[2]->val_str(&tmp_value2)))
|
||||
{
|
||||
if (!empty_string_for_null)
|
||||
if (!(res3= args[2]->val_str_null_to_empty(&tmp_value2, null_to_empty)))
|
||||
goto null;
|
||||
res3= empty_string_for_null;
|
||||
}
|
||||
from_length= res2->length();
|
||||
to_length= res3->length();
|
||||
|
||||
@@ -1276,7 +1266,7 @@ redo:
|
||||
}
|
||||
while ((offset=res->strstr(*res2,(uint) offset)) >= 0);
|
||||
}
|
||||
if (empty_string_for_null && !res->length())
|
||||
if (null_to_empty && !res->length())
|
||||
goto null;
|
||||
|
||||
return res;
|
||||
@@ -1375,19 +1365,21 @@ bool Item_func_regexp_replace::append_replacement(String *str,
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_regexp_replace::val_str(String *str)
|
||||
String *Item_func_regexp_replace::val_str_internal(String *str,
|
||||
bool null_to_empty)
|
||||
{
|
||||
DBUG_ASSERT(fixed());
|
||||
char buff0[MAX_FIELD_WIDTH];
|
||||
char buff2[MAX_FIELD_WIDTH];
|
||||
String tmp0(buff0,sizeof(buff0),&my_charset_bin);
|
||||
String tmp2(buff2,sizeof(buff2),&my_charset_bin);
|
||||
String *source= args[0]->val_str(&tmp0);
|
||||
String *replace= args[2]->val_str(&tmp2);
|
||||
String *source, *replace;
|
||||
LEX_CSTRING src, rpl;
|
||||
size_t startoffset= 0;
|
||||
|
||||
if ((null_value= (args[0]->null_value || args[2]->null_value ||
|
||||
if ((null_value=
|
||||
(!(source= args[0]->val_str(&tmp0)) ||
|
||||
!(replace= args[2]->val_str_null_to_empty(&tmp2, null_to_empty)) ||
|
||||
re.recompile(args[1]))))
|
||||
return (String *) 0;
|
||||
|
||||
|
@@ -398,12 +398,13 @@ public:
|
||||
class Item_func_replace :public Item_str_func
|
||||
{
|
||||
String tmp_value,tmp_value2;
|
||||
protected:
|
||||
String *val_str_internal(String *str, bool null_to_empty);
|
||||
public:
|
||||
Item_func_replace(THD *thd, Item *org, Item *find, Item *replace):
|
||||
Item_str_func(thd, org, find, replace) {}
|
||||
String *val_str(String *to) override { return val_str_internal(to, NULL); };
|
||||
String *val_str(String *to) override { return val_str_internal(to, false); };
|
||||
bool fix_length_and_dec() override;
|
||||
String *val_str_internal(String *str, String *empty_string_for_null);
|
||||
const Schema *schema() const override { return &mariadb_schema; }
|
||||
void print(String *str, enum_query_type query_type) override
|
||||
{
|
||||
@@ -427,7 +428,7 @@ public:
|
||||
Item_func_replace_oracle(THD *thd, Item *org, Item *find, Item *replace):
|
||||
Item_func_replace(thd, org, find, replace) {}
|
||||
String *val_str(String *to) override
|
||||
{ return val_str_internal(to, &tmp_emtpystr); };
|
||||
{ return val_str_internal(to, true); };
|
||||
const Schema *schema() const override { return &oracle_schema_ref; }
|
||||
void print(String *str, enum_query_type query_type) override
|
||||
{
|
||||
@@ -451,10 +452,18 @@ class Item_func_regexp_replace :public Item_str_func
|
||||
bool append_replacement(String *str,
|
||||
const LEX_CSTRING *source,
|
||||
const LEX_CSTRING *replace);
|
||||
protected:
|
||||
String *val_str_internal(String *str, bool null_to_empty);
|
||||
public:
|
||||
Item_func_regexp_replace(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c)
|
||||
{}
|
||||
const Schema *schema() const override { return &mariadb_schema; }
|
||||
void print(String *str, enum_query_type query_type) override
|
||||
{
|
||||
print_sql_mode_qualified_name(str, query_type);
|
||||
print_args_parenthesized(str, query_type);
|
||||
}
|
||||
void cleanup() override
|
||||
{
|
||||
DBUG_ENTER("Item_func_regexp_replace::cleanup");
|
||||
@@ -462,7 +471,10 @@ public:
|
||||
re.cleanup();
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
String *val_str(String *str) override;
|
||||
String *val_str(String *str) override
|
||||
{
|
||||
return val_str_internal(str, false);
|
||||
}
|
||||
bool fix_length_and_dec() override;
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
@@ -473,6 +485,26 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_regexp_replace_oracle: public Item_func_regexp_replace
|
||||
{
|
||||
public:
|
||||
Item_func_regexp_replace_oracle(THD *thd, Item *a, Item *b, Item *c)
|
||||
:Item_func_regexp_replace(thd, a, b, c)
|
||||
{}
|
||||
const Schema *schema() const { return &oracle_schema_ref; }
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
bool rc= Item_func_regexp_replace::fix_length_and_dec();
|
||||
set_maybe_null(); // Empty result is converted to NULL
|
||||
return rc;
|
||||
}
|
||||
String *val_str(String *str)
|
||||
{
|
||||
return val_str_internal(str, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Item_func_regexp_substr :public Item_str_func
|
||||
{
|
||||
Regexp_processor_pcre re;
|
||||
@@ -1740,6 +1772,9 @@ public:
|
||||
collation.set(args[0]->collation);
|
||||
ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 +
|
||||
2 * collation.collation->mbmaxlen;
|
||||
// NULL argument is returned as a string "NULL" without quotes
|
||||
if (args[0]->maybe_null())
|
||||
set_if_bigger(max_result_length, 4 * collation.collation->mbmaxlen);
|
||||
max_length= (uint32) MY_MIN(max_result_length, MAX_BLOB_WIDTH);
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -605,7 +605,7 @@ int key_rec_cmp(void *key_p, uchar *first_rec, uchar *second_rec)
|
||||
}
|
||||
/*
|
||||
No null values in the fields
|
||||
We use the virtual method cmp_max with a max length parameter.
|
||||
We use the virtual method cmp_prefix with a max length parameter.
|
||||
For most field types this translates into a cmp without
|
||||
max length. The exceptions are the BLOB and VARCHAR field types
|
||||
that take the max length into account.
|
||||
|
@@ -1337,7 +1337,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, size_t query_length,
|
||||
query_utime= (current_utime - thd->start_utime);
|
||||
lock_utime= (thd->utime_after_lock - thd->start_utime);
|
||||
my_hrtime_t current_time= { hrtime_from_time(thd->start_time) +
|
||||
thd->start_time_sec_part + query_utime };
|
||||
thd->start_time_sec_part };
|
||||
|
||||
if (!query || thd->get_command() == COM_STMT_PREPARE)
|
||||
{
|
||||
|
15
sql/slave.cc
15
sql/slave.cc
@@ -4385,6 +4385,15 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
{
|
||||
Gtid_log_event *gev= static_cast<Gtid_log_event *>(ev);
|
||||
|
||||
#ifdef ENABLED_DEBUG_SYNC
|
||||
DBUG_EXECUTE_IF(
|
||||
"pause_sql_thread_on_relay_fde_after_trans",
|
||||
{
|
||||
DBUG_SET("-d,pause_sql_thread_on_relay_fde_after_trans");
|
||||
DBUG_SET("+d,pause_sql_thread_on_next_relay_fde");
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
For GTID, allocate a new sub_id for the given domain_id.
|
||||
The sub_id must be allocated in increasing order of binlog order.
|
||||
@@ -4537,12 +4546,14 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
#endif /* WITH_WSREP */
|
||||
#ifdef ENABLED_DEBUG_SYNC
|
||||
DBUG_EXECUTE_IF(
|
||||
"pause_sql_thread_on_fde",
|
||||
if (ev && typ == FORMAT_DESCRIPTION_EVENT) {
|
||||
"pause_sql_thread_on_next_relay_fde",
|
||||
if (ev && typ == FORMAT_DESCRIPTION_EVENT &&
|
||||
((Format_description_log_event *) ev)->is_relay_log_event()) {
|
||||
DBUG_ASSERT(!debug_sync_set_action(
|
||||
thd,
|
||||
STRING_WITH_LEN(
|
||||
"now SIGNAL paused_on_fde WAIT_FOR sql_thread_continue")));
|
||||
DBUG_SET("-d,pause_sql_thread_on_next_relay_fde");
|
||||
});
|
||||
#endif
|
||||
|
||||
|
@@ -819,7 +819,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
if (lock_type == TL_WRITE && table->mdl_request.type > MDL_SHARED_WRITE)
|
||||
{
|
||||
if (table->table->s->tmp_table)
|
||||
thd->close_unused_temporary_table_instances(tables);
|
||||
thd->close_unused_temporary_table_instances(table);
|
||||
else
|
||||
{
|
||||
/* Store information about table for ddl log */
|
||||
|
@@ -1735,7 +1735,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
|
||||
|
||||
/* Check if there is more uniq keys after field */
|
||||
|
||||
static int last_uniq_key(TABLE *table,uint keynr)
|
||||
static int last_uniq_key(TABLE *table, const KEY *key, uint keynr)
|
||||
{
|
||||
/*
|
||||
When an underlying storage engine informs that the unique key
|
||||
@@ -1755,7 +1755,7 @@ static int last_uniq_key(TABLE *table,uint keynr)
|
||||
return 0;
|
||||
|
||||
while (++keynr < table->s->keys)
|
||||
if (table->key_info[keynr].flags & HA_NOSAME)
|
||||
if (key[keynr].flags & HA_NOSAME)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -2071,8 +2071,27 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink)
|
||||
tables which have ON UPDATE but have no ON DELETE triggers,
|
||||
we just should not expose this fact to users by invoking
|
||||
ON UPDATE triggers.
|
||||
|
||||
Note, TABLE_SHARE and TABLE see long uniques differently:
|
||||
- TABLE_SHARE sees as HA_KEY_ALG_LONG_HASH and HA_NOSAME
|
||||
- TABLE sees as usual non-unique indexes
|
||||
*/
|
||||
if (last_uniq_key(table,key_nr) &&
|
||||
bool is_long_unique= table->s->key_info &&
|
||||
table->s->key_info[key_nr].algorithm ==
|
||||
HA_KEY_ALG_LONG_HASH;
|
||||
if ((is_long_unique ?
|
||||
/*
|
||||
We have a long unique. Test that there are no in-engine
|
||||
uniques and the current long unique is the last long unique.
|
||||
*/
|
||||
!(table->key_info[0].flags & HA_NOSAME) &&
|
||||
last_uniq_key(table, table->s->key_info, key_nr) :
|
||||
/*
|
||||
We have a normal key - not a long unique.
|
||||
Test is the current normal key is unique and
|
||||
it is the last normal unique.
|
||||
*/
|
||||
last_uniq_key(table, table->key_info, key_nr)) &&
|
||||
!table->file->referenced_by_foreign_key() &&
|
||||
(!table->triggers || !table->triggers->has_delete_triggers()))
|
||||
{
|
||||
|
@@ -4813,9 +4813,12 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
|
||||
{
|
||||
Query_arena_stmt on_stmt_arena(thd);
|
||||
changed_elements|= TOUCHED_SEL_COND;
|
||||
/*
|
||||
TODO: return after MDEV-33218 fix
|
||||
DBUG_ASSERT(
|
||||
active_arena->is_stmt_prepare_or_first_stmt_execute() ||
|
||||
active_arena->state == Query_arena::STMT_SP_QUERY_ARGUMENTS);
|
||||
*/
|
||||
if (group_list.first)
|
||||
{
|
||||
if (!group_list_ptrs)
|
||||
|
@@ -1289,12 +1289,11 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
|
||||
if (keypart->key_part_flag & HA_PART_KEY_SEG)
|
||||
{
|
||||
int length= keypart->length/keypart->field->charset()->mbmaxlen;
|
||||
Field *kpf= table->field[keypart->field->field_index];
|
||||
list_item= new (mem_root) Item_func_left(thd,
|
||||
new (mem_root) Item_field(thd, keypart->field),
|
||||
new (mem_root) Item_field(thd, kpf),
|
||||
new (mem_root) Item_int(thd, length));
|
||||
list_item->fix_fields(thd, NULL);
|
||||
keypart->field->vcol_info=
|
||||
table->field[keypart->field->field_index]->vcol_info;
|
||||
}
|
||||
else
|
||||
list_item= new (mem_root) Item_field(thd, keypart->field);
|
||||
|
@@ -1579,6 +1579,11 @@ void THD::close_unused_temporary_table_instances(const TABLE_LIST *tl)
|
||||
{
|
||||
/* Note: removing current list element doesn't invalidate iterator. */
|
||||
share->all_tmp_tables.remove(table);
|
||||
/*
|
||||
At least one instance should be left (guaratead by calling this
|
||||
function for table which is opened and the table is under processing)
|
||||
*/
|
||||
DBUG_ASSERT(share->all_tmp_tables.front());
|
||||
free_temporary_table(table);
|
||||
}
|
||||
}
|
||||
|
Submodule storage/columnstore/columnstore updated: b989238ff7...fcd637addc
@@ -14,8 +14,8 @@
|
||||
Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
|
||||
Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
|
||||
Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
|
||||
It is used when recreting zip archive with RAW when deleting items from a zip.
|
||||
ZIP64 data is automaticly added to items that needs it, and existing ZIP64 data need to be removed.
|
||||
It is used when recreating zip archive with RAW when deleting items from a zip.
|
||||
ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed.
|
||||
Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
|
||||
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
|
||||
|
||||
@@ -25,15 +25,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include "zlib.h"
|
||||
#include "zip.h"
|
||||
#include "my_attribute.h"
|
||||
|
||||
#ifdef STDC
|
||||
# include <stddef.h>
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
extern int errno;
|
||||
@@ -48,7 +46,7 @@
|
||||
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||
|
||||
#ifndef VERSIONMADEBY
|
||||
# define VERSIONMADEBY (0x0) /* platform depedent */
|
||||
# define VERSIONMADEBY (0x0) /* platform dependent */
|
||||
#endif
|
||||
|
||||
#ifndef Z_BUFSIZE
|
||||
@@ -62,9 +60,6 @@
|
||||
#ifndef ALLOC
|
||||
# define ALLOC(size) (malloc(size))
|
||||
#endif
|
||||
#ifndef TRYFREE
|
||||
# define TRYFREE(p) {if (p) free(p);}
|
||||
#endif
|
||||
|
||||
/*
|
||||
#define SIZECENTRALDIRITEM (0x2e)
|
||||
@@ -117,7 +112,7 @@ typedef struct linkedlist_datablock_internal_s
|
||||
struct linkedlist_datablock_internal_s* next_datablock;
|
||||
uLong avail_in_this_block;
|
||||
uLong filled_in_this_block;
|
||||
uLong unused; /* for future use and alignement */
|
||||
uLong unused; /* for future use and alignment */
|
||||
unsigned char data[SIZEDATA_INDATABLOCK];
|
||||
} linkedlist_datablock_internal;
|
||||
|
||||
@@ -139,40 +134,40 @@ typedef struct
|
||||
uInt pos_in_buffered_data; /* last written byte in buffered_data */
|
||||
|
||||
ZPOS64_T pos_local_header; /* offset of the local header of the file
|
||||
currenty writing */
|
||||
currently writing */
|
||||
char* central_header; /* central header data for the current file */
|
||||
uLong size_centralExtra;
|
||||
uLong size_centralheader; /* size of the central header for cur file */
|
||||
uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */
|
||||
uLong flag; /* flag of the file currently writing */
|
||||
|
||||
int method; /* compression method of file currenty wr.*/
|
||||
int method; /* compression method of file currently wr.*/
|
||||
int raw; /* 1 for directly writing raw data */
|
||||
Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
|
||||
uLong dosDate;
|
||||
uLong crc32;
|
||||
int encrypt;
|
||||
int zip64; /* Add ZIP64 extened information in the extra field */
|
||||
int zip64; /* Add ZIP64 extended information in the extra field */
|
||||
ZPOS64_T pos_zip64extrainfo;
|
||||
ZPOS64_T totalCompressedData;
|
||||
ZPOS64_T totalUncompressedData;
|
||||
#ifndef NOCRYPT
|
||||
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
|
||||
const z_crc_t* pcrc_32_tab;
|
||||
int crypt_header_size;
|
||||
unsigned crypt_header_size;
|
||||
#endif
|
||||
} curfile64_info;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zlib_filefunc64_32_def z_filefunc;
|
||||
voidpf filestream; /* io structore of the zipfile */
|
||||
voidpf filestream; /* io structure of the zipfile */
|
||||
linkedlist_data central_dir;/* datablock with central dir in construction*/
|
||||
int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
|
||||
curfile64_info ci; /* info on the file curretly writing */
|
||||
curfile64_info ci; /* info on the file currently writing */
|
||||
|
||||
ZPOS64_T begin_pos; /* position of the beginning of the zipfile */
|
||||
ZPOS64_T add_position_when_writting_offset;
|
||||
ZPOS64_T add_position_when_writing_offset;
|
||||
ZPOS64_T number_entry;
|
||||
|
||||
#ifndef NO_ADDFILEINEXISTINGZIP
|
||||
@@ -187,8 +182,7 @@ typedef struct
|
||||
#include "crypt.h"
|
||||
#endif
|
||||
|
||||
local linkedlist_datablock_internal* allocate_new_datablock()
|
||||
{
|
||||
local linkedlist_datablock_internal* allocate_new_datablock(void) {
|
||||
linkedlist_datablock_internal* ldi;
|
||||
ldi = (linkedlist_datablock_internal*)
|
||||
ALLOC(sizeof(linkedlist_datablock_internal));
|
||||
@@ -201,30 +195,26 @@ local linkedlist_datablock_internal* allocate_new_datablock()
|
||||
return ldi;
|
||||
}
|
||||
|
||||
local void free_datablock(linkedlist_datablock_internal* ldi)
|
||||
{
|
||||
local void free_datablock(linkedlist_datablock_internal* ldi) {
|
||||
while (ldi!=NULL)
|
||||
{
|
||||
linkedlist_datablock_internal* ldinext = ldi->next_datablock;
|
||||
TRYFREE(ldi);
|
||||
free(ldi);
|
||||
ldi = ldinext;
|
||||
}
|
||||
}
|
||||
|
||||
local void init_linkedlist(linkedlist_data* ll)
|
||||
{
|
||||
local void init_linkedlist(linkedlist_data* ll) {
|
||||
ll->first_block = ll->last_block = NULL;
|
||||
}
|
||||
|
||||
local void free_linkedlist(linkedlist_data* ll)
|
||||
{
|
||||
local void free_linkedlist(linkedlist_data* ll) {
|
||||
free_datablock(ll->first_block);
|
||||
ll->first_block = ll->last_block = NULL;
|
||||
}
|
||||
|
||||
|
||||
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||
{
|
||||
local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) {
|
||||
linkedlist_datablock_internal* ldi;
|
||||
const unsigned char* from_copy;
|
||||
|
||||
@@ -239,7 +229,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||
}
|
||||
|
||||
ldi = ll->last_block;
|
||||
from_copy = (unsigned char*)buf;
|
||||
from_copy = (const unsigned char*)buf;
|
||||
|
||||
while (len>0)
|
||||
{
|
||||
@@ -284,9 +274,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len)
|
||||
nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T)
|
||||
*/
|
||||
|
||||
local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte));
|
||||
local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)
|
||||
{
|
||||
local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) {
|
||||
unsigned char buf[8];
|
||||
int n;
|
||||
for (n = 0; n < nbByte; n++)
|
||||
@@ -302,15 +290,13 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||
}
|
||||
}
|
||||
|
||||
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
|
||||
if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,(uLong)nbByte)!=(uLong)nbByte)
|
||||
return ZIP_ERRNO;
|
||||
else
|
||||
return ZIP_OK;
|
||||
}
|
||||
|
||||
local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte));
|
||||
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
||||
{
|
||||
local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) {
|
||||
unsigned char* buf=(unsigned char*)dest;
|
||||
int n;
|
||||
for (n = 0; n < nbByte; n++) {
|
||||
@@ -330,25 +316,21 @@ local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte)
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm)
|
||||
{
|
||||
local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) {
|
||||
uLong year = (uLong)ptm->tm_year;
|
||||
if (year>=1980)
|
||||
year-=1980;
|
||||
else if (year>=80)
|
||||
year-=80;
|
||||
return
|
||||
(uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
|
||||
((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
|
||||
(uLong) (((uLong)(ptm->tm_mday) + (32 * (uLong)(ptm->tm_mon+1)) + (512 * year)) << 16) |
|
||||
(((uLong)ptm->tm_sec/2) + (32 * (uLong)ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi));
|
||||
|
||||
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi)
|
||||
{
|
||||
local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) {
|
||||
unsigned char c;
|
||||
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
|
||||
if (err==1)
|
||||
@@ -369,10 +351,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo
|
||||
/* ===========================================================================
|
||||
Reads a long in LSB order from the given gz_stream. Sets
|
||||
*/
|
||||
local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
|
||||
|
||||
local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
||||
{
|
||||
local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
||||
uLong x ;
|
||||
int i = 0;
|
||||
int err;
|
||||
@@ -391,10 +370,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||
return err;
|
||||
}
|
||||
|
||||
local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX));
|
||||
|
||||
local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX)
|
||||
{
|
||||
local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) {
|
||||
uLong x ;
|
||||
int i = 0;
|
||||
int err;
|
||||
@@ -421,11 +397,8 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||
return err;
|
||||
}
|
||||
|
||||
local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX));
|
||||
|
||||
|
||||
local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)
|
||||
{
|
||||
local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) {
|
||||
ZPOS64_T x;
|
||||
int i = 0;
|
||||
int err;
|
||||
@@ -476,10 +449,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
|
||||
Locate the Central directory of a zipfile (at the end, just before
|
||||
the global comment)
|
||||
*/
|
||||
local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
||||
|
||||
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
||||
{
|
||||
local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||
unsigned char* buf;
|
||||
ZPOS64_T uSizeFile;
|
||||
ZPOS64_T uBackRead;
|
||||
@@ -519,18 +489,18 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||
if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
|
||||
break;
|
||||
|
||||
for (i=(int)uReadSize-3; (i--)>0;) {
|
||||
for (i=(int)uReadSize-3; (i--)>0;)
|
||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
|
||||
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
|
||||
{
|
||||
uPosFound = uReadPos+i;
|
||||
uPosFound = uReadPos+(unsigned)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (uPosFound!=0)
|
||||
break;
|
||||
}
|
||||
TRYFREE(buf);
|
||||
free(buf);
|
||||
return uPosFound;
|
||||
}
|
||||
|
||||
@@ -538,10 +508,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||
Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before
|
||||
the global comment)
|
||||
*/
|
||||
local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
||||
|
||||
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
||||
{
|
||||
local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
|
||||
unsigned char* buf;
|
||||
ZPOS64_T uSizeFile;
|
||||
ZPOS64_T uBackRead;
|
||||
@@ -587,7 +554,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
// Signature "0x07064b50" Zip64 end of central directory locater
|
||||
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07))
|
||||
{
|
||||
uPosFound = uReadPos+i;
|
||||
uPosFound = uReadPos+(unsigned)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -596,7 +563,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
break;
|
||||
}
|
||||
|
||||
TRYFREE(buf);
|
||||
free(buf);
|
||||
if (uPosFound == 0)
|
||||
return 0;
|
||||
|
||||
@@ -638,8 +605,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
return relativeOffset;
|
||||
}
|
||||
|
||||
static int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||
{
|
||||
local int LoadCentralDirectoryRecord(zip64_internal* pziinit) {
|
||||
int err=ZIP_OK;
|
||||
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
|
||||
|
||||
@@ -649,9 +615,9 @@ static int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||
uLong uL;
|
||||
|
||||
uLong number_disk; /* number of the current dist, used for
|
||||
spaning ZIP, unsupported, always 0*/
|
||||
spanning ZIP, unsupported, always 0*/
|
||||
uLong number_disk_with_CD; /* number the the disk with central dir, used
|
||||
for spaning ZIP, unsupported, always 0*/
|
||||
for spanning ZIP, unsupported, always 0*/
|
||||
ZPOS64_T number_entry;
|
||||
ZPOS64_T number_entry_CD; /* total number of entries in
|
||||
the central dir
|
||||
@@ -808,7 +774,7 @@ static int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||
}
|
||||
|
||||
byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir);
|
||||
pziinit->add_position_when_writting_offset = byte_before_the_zipfile;
|
||||
pziinit->add_position_when_writing_offset = byte_before_the_zipfile;
|
||||
|
||||
{
|
||||
ZPOS64_T size_central_dir_to_read = size_central_dir;
|
||||
@@ -831,7 +797,7 @@ static int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||
|
||||
size_central_dir_to_read-=read_this;
|
||||
}
|
||||
TRYFREE(buf_read);
|
||||
free(buf_read);
|
||||
}
|
||||
pziinit->begin_pos = byte_before_the_zipfile;
|
||||
pziinit->number_entry = number_entry_CD;
|
||||
@@ -847,8 +813,7 @@ static int LoadCentralDirectoryRecord(zip64_internal* pziinit)
|
||||
|
||||
|
||||
/************************************************************/
|
||||
static zipFile zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def)
|
||||
{
|
||||
extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) {
|
||||
zip64_internal ziinit;
|
||||
zip64_internal* zi;
|
||||
int err=ZIP_OK;
|
||||
@@ -876,7 +841,7 @@ static zipFile zipOpen3 (const void *pathname, int append, zipcharpc* globalcomm
|
||||
ziinit.in_opened_file_inzip = 0;
|
||||
ziinit.ci.stream_initialised = 0;
|
||||
ziinit.number_entry = 0;
|
||||
ziinit.add_position_when_writting_offset = 0;
|
||||
ziinit.add_position_when_writing_offset = 0;
|
||||
init_linkedlist(&(ziinit.central_dir));
|
||||
|
||||
|
||||
@@ -906,9 +871,9 @@ static zipFile zipOpen3 (const void *pathname, int append, zipcharpc* globalcomm
|
||||
if (err != ZIP_OK)
|
||||
{
|
||||
# ifndef NO_ADDFILEINEXISTINGZIP
|
||||
TRYFREE(ziinit.globalcomment);
|
||||
free(ziinit.globalcomment);
|
||||
# endif /* !NO_ADDFILEINEXISTINGZIP*/
|
||||
TRYFREE(zi);
|
||||
free(zi);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
@@ -918,8 +883,7 @@ static zipFile zipOpen3 (const void *pathname, int append, zipcharpc* globalcomm
|
||||
}
|
||||
}
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def)
|
||||
{
|
||||
extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) {
|
||||
if (pzlib_filefunc32_def != NULL)
|
||||
{
|
||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||
@@ -930,8 +894,7 @@ extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* gl
|
||||
return zipOpen3(pathname, append, globalcomment, NULL);
|
||||
}
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def)
|
||||
{
|
||||
extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) {
|
||||
if (pzlib_filefunc_def != NULL)
|
||||
{
|
||||
zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
|
||||
@@ -946,18 +909,15 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc*
|
||||
|
||||
|
||||
|
||||
extern zipFile ZEXPORT zipOpen (const char* pathname, int append)
|
||||
{
|
||||
extern zipFile ZEXPORT zipOpen(const char* pathname, int append) {
|
||||
return zipOpen3((const void*)pathname,append,NULL,NULL);
|
||||
}
|
||||
|
||||
extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append)
|
||||
{
|
||||
extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) {
|
||||
return zipOpen3(pathname,append,NULL,NULL);
|
||||
}
|
||||
|
||||
static int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
|
||||
{
|
||||
local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) {
|
||||
/* write the local header */
|
||||
int err;
|
||||
uInt size_filename = (uInt)strlen(filename);
|
||||
@@ -1035,8 +995,8 @@ static int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt
|
||||
// Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file)
|
||||
zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream);
|
||||
|
||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2);
|
||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2);
|
||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)HeaderID,2);
|
||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)DataSize,2);
|
||||
|
||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8);
|
||||
err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8);
|
||||
@@ -1053,24 +1013,24 @@ static int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt
|
||||
It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize
|
||||
unnecessary allocations.
|
||||
*/
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void* extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int raw,
|
||||
int windowBits,int memLevel, int strategy,
|
||||
const char* password, uLong crcForCrypting __attribute__((unused)),
|
||||
uLong versionMadeBy, uLong flagBase, int zip64)
|
||||
{
|
||||
const char* password, uLong crcForCrypting,
|
||||
uLong versionMadeBy, uLong flagBase, int zip64) {
|
||||
zip64_internal* zi;
|
||||
uInt size_filename;
|
||||
uInt size_comment;
|
||||
uInt i;
|
||||
int err = ZIP_OK;
|
||||
|
||||
#ifdef NOCRYPT
|
||||
# ifdef NOCRYPT
|
||||
(crcForCrypting);
|
||||
if (password != NULL)
|
||||
return ZIP_PARAMERROR;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
if (file == NULL)
|
||||
return ZIP_PARAMERROR;
|
||||
@@ -1164,7 +1124,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
||||
if(zi->ci.pos_local_header >= 0xffffffff)
|
||||
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4);
|
||||
else
|
||||
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writting_offset,4);
|
||||
zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writing_offset,4);
|
||||
|
||||
for (i=0;i<size_filename;i++)
|
||||
*(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
|
||||
@@ -1262,15 +1222,14 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename,
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void* extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int raw,
|
||||
int windowBits,int memLevel, int strategy,
|
||||
const char* password, uLong crcForCrypting,
|
||||
uLong versionMadeBy, uLong flagBase)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
uLong versionMadeBy, uLong flagBase) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, raw,
|
||||
@@ -1278,14 +1237,13 @@ extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, con
|
||||
password, crcForCrypting, versionMadeBy, flagBase, 0);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void* extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int raw,
|
||||
int windowBits,int memLevel, int strategy,
|
||||
const char* password, uLong crcForCrypting)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
const char* password, uLong crcForCrypting) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, raw,
|
||||
@@ -1298,9 +1256,8 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c
|
||||
const void* extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int raw,
|
||||
int windowBits,int memLevel, int strategy,
|
||||
const char* password, uLong crcForCrypting, int zip64)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
const char* password, uLong crcForCrypting, int zip64) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, raw,
|
||||
@@ -1311,9 +1268,8 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c
|
||||
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void* extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int raw)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
const char* comment, int method, int level, int raw) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, raw,
|
||||
@@ -1324,9 +1280,8 @@ extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, cons
|
||||
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void* extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int raw, int zip64)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
const char* comment, int method, int level, int raw, int zip64) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, raw,
|
||||
@@ -1334,12 +1289,11 @@ extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, c
|
||||
NULL, 0, VERSIONMADEBY, 0, zip64);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void*extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level, int zip64)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
const char* comment, int method, int level, int zip64) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, 0,
|
||||
@@ -1347,12 +1301,11 @@ extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, co
|
||||
NULL, 0, VERSIONMADEBY, 0, zip64);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local, uInt size_extrafield_local,
|
||||
const void*extrafield_global, uInt size_extrafield_global,
|
||||
const char* comment, int method, int level)
|
||||
{
|
||||
return zipOpenNewFileInZip4_64 (file, filename, zipfi,
|
||||
const char* comment, int method, int level) {
|
||||
return zipOpenNewFileInZip4_64(file, filename, zipfi,
|
||||
extrafield_local, size_extrafield_local,
|
||||
extrafield_global, size_extrafield_global,
|
||||
comment, method, level, 0,
|
||||
@@ -1360,8 +1313,7 @@ extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, cons
|
||||
NULL, 0, VERSIONMADEBY, 0, 0);
|
||||
}
|
||||
|
||||
local int zip64FlushWriteBuffer(zip64_internal* zi)
|
||||
{
|
||||
local int zip64FlushWriteBuffer(zip64_internal* zi) {
|
||||
int err=ZIP_OK;
|
||||
|
||||
if (zi->ci.encrypt != 0)
|
||||
@@ -1399,8 +1351,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi)
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len)
|
||||
{
|
||||
extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) {
|
||||
zip64_internal* zi;
|
||||
int err=ZIP_OK;
|
||||
|
||||
@@ -1450,7 +1401,7 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||
else
|
||||
#endif
|
||||
{
|
||||
zi->ci.stream.next_in = (Bytef*)buf;
|
||||
zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf;
|
||||
zi->ci.stream.avail_in = len;
|
||||
|
||||
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
|
||||
@@ -1501,17 +1452,15 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32)
|
||||
{
|
||||
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) {
|
||||
return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32);
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32)
|
||||
{
|
||||
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) {
|
||||
zip64_internal* zi;
|
||||
ZPOS64_T compressed_size;
|
||||
uLong invalidValue = 0xffffffff;
|
||||
short datasize = 0;
|
||||
unsigned datasize = 0;
|
||||
int err=ZIP_OK;
|
||||
|
||||
if (file == NULL)
|
||||
@@ -1742,15 +1691,13 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZip (zipFile file)
|
||||
{
|
||||
extern int ZEXPORT zipCloseFileInZip(zipFile file) {
|
||||
return zipCloseFileInZipRaw (file,0,0);
|
||||
}
|
||||
|
||||
static int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
|
||||
{
|
||||
local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) {
|
||||
int err = ZIP_OK;
|
||||
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
|
||||
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset;
|
||||
|
||||
err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4);
|
||||
|
||||
@@ -1769,8 +1716,7 @@ static int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T
|
||||
return err;
|
||||
}
|
||||
|
||||
static int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
||||
{
|
||||
local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
||||
int err = ZIP_OK;
|
||||
|
||||
uLong Zip64DataSize = 44;
|
||||
@@ -1803,13 +1749,13 @@ static int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size
|
||||
|
||||
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
|
||||
{
|
||||
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
|
||||
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
||||
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
static int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
|
||||
{
|
||||
|
||||
local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) {
|
||||
int err = ZIP_OK;
|
||||
|
||||
/*signature*/
|
||||
@@ -1844,20 +1790,19 @@ static int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_cent
|
||||
|
||||
if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */
|
||||
{
|
||||
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
|
||||
ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
||||
if(pos >= 0xffffffff)
|
||||
{
|
||||
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4);
|
||||
}
|
||||
else
|
||||
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
|
||||
err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
||||
{
|
||||
local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) {
|
||||
int err = ZIP_OK;
|
||||
uInt size_global_comment = 0;
|
||||
|
||||
@@ -1874,8 +1819,7 @@ static int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||
{
|
||||
extern int ZEXPORT zipClose(zipFile file, const char* global_comment) {
|
||||
zip64_internal* zi;
|
||||
int err = 0;
|
||||
uLong size_centraldir = 0;
|
||||
@@ -1916,7 +1860,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||
}
|
||||
free_linkedlist(&(zi->central_dir));
|
||||
|
||||
pos = centraldir_pos_inzip - zi->add_position_when_writting_offset;
|
||||
pos = centraldir_pos_inzip - zi->add_position_when_writing_offset;
|
||||
if(pos >= 0xffffffff || zi->number_entry > 0xFFFF)
|
||||
{
|
||||
ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream);
|
||||
@@ -1936,15 +1880,14 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment)
|
||||
err = ZIP_ERRNO;
|
||||
|
||||
#ifndef NO_ADDFILEINEXISTINGZIP
|
||||
TRYFREE(zi->globalcomment);
|
||||
free(zi->globalcomment);
|
||||
#endif
|
||||
TRYFREE(zi);
|
||||
free(zi);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader)
|
||||
{
|
||||
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) {
|
||||
char* p = pData;
|
||||
int size = 0;
|
||||
char* pNewHeader;
|
||||
@@ -1954,10 +1897,10 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
||||
|
||||
int retVal = ZIP_OK;
|
||||
|
||||
if(pData == NULL || *dataLen < 4)
|
||||
if(pData == NULL || dataLen == NULL || *dataLen < 4)
|
||||
return ZIP_PARAMERROR;
|
||||
|
||||
pNewHeader = (char*)ALLOC(*dataLen);
|
||||
pNewHeader = (char*)ALLOC((unsigned)*dataLen);
|
||||
pTmp = pNewHeader;
|
||||
|
||||
while(p < (pData + *dataLen))
|
||||
@@ -1996,7 +1939,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe
|
||||
else
|
||||
retVal = ZIP_ERRNO;
|
||||
|
||||
TRYFREE(pNewHeader);
|
||||
free(pNewHeader);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
@@ -88,12 +88,12 @@ typedef voidp zipFile;
|
||||
/* tm_zip contain date/time info */
|
||||
typedef struct tm_zip_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
int tm_sec; /* seconds after the minute - [0,59] */
|
||||
int tm_min; /* minutes after the hour - [0,59] */
|
||||
int tm_hour; /* hours since midnight - [0,23] */
|
||||
int tm_mday; /* day of the month - [1,31] */
|
||||
int tm_mon; /* months since January - [0,11] */
|
||||
int tm_year; /* years - [1980..2044] */
|
||||
} tm_zip;
|
||||
|
||||
typedef struct
|
||||
@@ -113,8 +113,8 @@ typedef const char* zipcharpc;
|
||||
#define APPEND_STATUS_CREATEAFTER (1)
|
||||
#define APPEND_STATUS_ADDINZIP (2)
|
||||
|
||||
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
||||
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
||||
extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
|
||||
extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
|
||||
/*
|
||||
Create a zipfile.
|
||||
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
||||
@@ -131,20 +131,25 @@ extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
|
||||
|
||||
/* Note : there is no delete function into a zipfile.
|
||||
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
||||
Of course, you can use RAW reading and writing to copy the file you did not want delete
|
||||
*/
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
||||
extern zipFile ZEXPORT zipOpen2(const char *pathname,
|
||||
int append,
|
||||
zipcharpc* globalcomment,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
zlib_filefunc_def* pzlib_filefunc_def);
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
|
||||
extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
|
||||
int append,
|
||||
zipcharpc* globalcomment,
|
||||
zlib_filefunc64_def* pzlib_filefunc_def));
|
||||
zlib_filefunc64_def* pzlib_filefunc_def);
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
||||
extern zipFile ZEXPORT zipOpen3(const void *pathname,
|
||||
int append,
|
||||
zipcharpc* globalcomment,
|
||||
zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -153,9 +158,9 @@ extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level));
|
||||
int level);
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -165,7 +170,7 @@ extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level,
|
||||
int zip64));
|
||||
int zip64);
|
||||
|
||||
/*
|
||||
Open a file in the ZIP for writing.
|
||||
@@ -184,7 +189,7 @@ extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -194,10 +199,10 @@ extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level,
|
||||
int raw));
|
||||
int raw);
|
||||
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -208,12 +213,12 @@ extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
|
||||
int method,
|
||||
int level,
|
||||
int raw,
|
||||
int zip64));
|
||||
int zip64);
|
||||
/*
|
||||
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -228,9 +233,9 @@ extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
||||
int memLevel,
|
||||
int strategy,
|
||||
const char* password,
|
||||
uLong crcForCrypting));
|
||||
uLong crcForCrypting);
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -246,8 +251,7 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
||||
int strategy,
|
||||
const char* password,
|
||||
uLong crcForCrypting,
|
||||
int zip64
|
||||
));
|
||||
int zip64);
|
||||
|
||||
/*
|
||||
Same than zipOpenNewFileInZip2, except
|
||||
@@ -256,7 +260,7 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
|
||||
crcForCrypting : crc of file to compress (needed for crypting)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip4(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -273,11 +277,10 @@ extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
|
||||
const char* password,
|
||||
uLong crcForCrypting,
|
||||
uLong versionMadeBy,
|
||||
uLong flagBase
|
||||
));
|
||||
uLong flagBase);
|
||||
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
||||
extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
@@ -295,8 +298,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
||||
uLong crcForCrypting,
|
||||
uLong versionMadeBy,
|
||||
uLong flagBase,
|
||||
int zip64
|
||||
));
|
||||
int zip64);
|
||||
/*
|
||||
Same than zipOpenNewFileInZip4, except
|
||||
versionMadeBy : value for Version made by field
|
||||
@@ -304,25 +306,25 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
||||
extern int ZEXPORT zipWriteInFileInZip(zipFile file,
|
||||
const void* buf,
|
||||
unsigned len));
|
||||
unsigned len);
|
||||
/*
|
||||
Write data in the zipfile
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
||||
extern int ZEXPORT zipCloseFileInZip(zipFile file);
|
||||
/*
|
||||
Close the current file in the zipfile
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
||||
extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
|
||||
uLong uncompressed_size,
|
||||
uLong crc32));
|
||||
uLong crc32);
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
||||
extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
|
||||
ZPOS64_T uncompressed_size,
|
||||
uLong crc32));
|
||||
uLong crc32);
|
||||
|
||||
/*
|
||||
Close the current file in the zipfile, for file opened with
|
||||
@@ -330,14 +332,14 @@ extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
|
||||
uncompressed_size and crc32 are value for the uncompressed size
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipClose OF((zipFile file,
|
||||
const char* global_comment));
|
||||
extern int ZEXPORT zipClose(zipFile file,
|
||||
const char* global_comment);
|
||||
/*
|
||||
Close the zipfile
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
|
||||
extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
|
||||
/*
|
||||
zipRemoveExtraInfoBlock - Added by Mathias Svensson
|
||||
|
||||
|
@@ -451,10 +451,13 @@ int federatedx_io_mysql::actual_query(const char *buffer, size_t length)
|
||||
get_port(),
|
||||
get_socket(), 0))
|
||||
DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
|
||||
|
||||
if ((error= mysql_real_query(&mysql, STRING_WITH_LEN("set time_zone='+00:00'"))))
|
||||
DBUG_RETURN(error);
|
||||
|
||||
mysql.reconnect= 1;
|
||||
}
|
||||
|
||||
if (!(error= mysql_real_query(&mysql, STRING_WITH_LEN("set time_zone='+00:00'"))))
|
||||
error= mysql_real_query(&mysql, buffer, (ulong)length);
|
||||
|
||||
DBUG_RETURN(error);
|
||||
|
@@ -52,6 +52,7 @@ PageBulk::init()
|
||||
|
||||
if (m_page_no == FIL_NULL) {
|
||||
mtr_t alloc_mtr;
|
||||
dberr_t err= DB_SUCCESS;
|
||||
|
||||
/* We commit redo log for allocation by a separate mtr,
|
||||
because we don't guarantee pages are committed following
|
||||
@@ -60,27 +61,14 @@ PageBulk::init()
|
||||
alloc_mtr.start();
|
||||
m_index->set_modified(alloc_mtr);
|
||||
|
||||
uint32_t n_reserved;
|
||||
dberr_t err = fsp_reserve_free_extents(
|
||||
&n_reserved, m_index->table->space, 1, FSP_NORMAL,
|
||||
&alloc_mtr);
|
||||
if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
|
||||
oom:
|
||||
alloc_mtr.commit();
|
||||
m_mtr.commit();
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Allocate a new page. */
|
||||
new_block = btr_page_alloc(m_index, 0, FSP_UP, m_level,
|
||||
&alloc_mtr, &m_mtr, &err);
|
||||
if (!new_block) {
|
||||
goto oom;
|
||||
}
|
||||
|
||||
m_index->table->space->release_free_extents(n_reserved);
|
||||
|
||||
alloc_mtr.commit();
|
||||
if (!new_block) {
|
||||
m_mtr.commit();
|
||||
return err;
|
||||
}
|
||||
|
||||
new_page = buf_block_get_frame(new_block);
|
||||
m_page_no = new_block->page.id().page_no();
|
||||
|
@@ -3174,8 +3174,18 @@ fallback:
|
||||
return true;
|
||||
}
|
||||
current_size &= ~4095ULL;
|
||||
# ifdef __linux__
|
||||
if (!fallocate(file, 0, current_size,
|
||||
size - current_size)) {
|
||||
err = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
err = errno;
|
||||
# else
|
||||
err = posix_fallocate(file, current_size,
|
||||
size - current_size);
|
||||
# endif
|
||||
}
|
||||
} while (err == EINTR
|
||||
&& srv_shutdown_state <= SRV_SHUTDOWN_INITIATED);
|
||||
|
@@ -8066,7 +8066,7 @@ int ha_spider::ft_read_internal(
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
uint dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
uint dbton_id = share->sql_dbton_ids[roop_count];
|
||||
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
|
||||
SPIDER_CONN *conn = conns[roop_count];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
@@ -12965,7 +12965,7 @@ int ha_spider::drop_tmp_tables()
|
||||
) {
|
||||
if (spider_bit_is_set(result_list.tmp_table_created, roop_count))
|
||||
{
|
||||
uint dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
uint dbton_id = share->sql_dbton_ids[roop_count];
|
||||
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
|
||||
SPIDER_CONN *conn = conns[roop_count];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
|
@@ -1,2 +1,3 @@
|
||||
wait_timeout : MDEV-26045
|
||||
mdev_29904 : MDEV-31101
|
||||
mdev_27575 : MDEV-32997
|
||||
mdev_28739_simple : MDEV-33343
|
||||
|
@@ -2,18 +2,3 @@
|
||||
# MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds
|
||||
#
|
||||
INSTALL SONAME 'ha_spider.so';
|
||||
DROP FUNCTION spider_flush_table_mon_cache;
|
||||
DROP FUNCTION spider_copy_tables;
|
||||
DROP FUNCTION spider_ping_table;
|
||||
DROP FUNCTION spider_bg_direct_sql;
|
||||
DROP FUNCTION spider_direct_sql;
|
||||
UNINSTALL SONAME IF EXISTS 'ha_spider';
|
||||
DROP TABLE IF EXISTS mysql.spider_xa;
|
||||
DROP TABLE IF EXISTS mysql.spider_xa_member;
|
||||
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
|
||||
DROP TABLE IF EXISTS mysql.spider_tables;
|
||||
DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
|
||||
DROP TABLE IF EXISTS mysql.spider_link_failed_log;
|
||||
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
|
||||
DROP TABLE IF EXISTS mysql.spider_table_sts;
|
||||
DROP TABLE IF EXISTS mysql.spider_table_crd;
|
||||
|
@@ -4,8 +4,6 @@
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
call mtr.add_suppression("\\[ERROR\\] Table 'mysql.spider_table_sts' doesn't exist");
|
||||
call mtr.add_suppression("\\[ERROR\\] Server shutdown in progress");
|
||||
SET GLOBAL default_tmp_storage_engine=spider;
|
||||
# restart
|
||||
SET GLOBAL default_storage_engine=Spider;
|
||||
|
10
storage/spider/mysql-test/spider/bugfix/r/mdev_33191.result
Normal file
10
storage/spider/mysql-test/spider/bugfix/r/mdev_33191.result
Normal file
@@ -0,0 +1,10 @@
|
||||
INSTALL SONAME 'ha_spider';
|
||||
set spider_same_server_link=on;
|
||||
CREATE TABLE t2(c INT);
|
||||
CREATE TABLE t1(c INT) ENGINE=Spider COMMENT='socket "$SOCKET", user "root", table "t2 t3"';
|
||||
ALTER TABLE t1 ENGINE=Spider;
|
||||
TRUNCATE TABLE t1;
|
||||
ERROR 42S02: Table 'test.t3' doesn't exist
|
||||
drop table t1, t2;
|
||||
Warnings:
|
||||
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
@@ -2,10 +2,7 @@
|
||||
--echo # MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds
|
||||
--echo #
|
||||
|
||||
if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%UBSAN%"`)
|
||||
{
|
||||
--skip test needs to be run with UBSAN
|
||||
}
|
||||
# this test should be checked with ubsan
|
||||
|
||||
# init spider
|
||||
|
||||
@@ -20,4 +17,5 @@ while (!$PLUGIN_EXIST)
|
||||
`SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`;
|
||||
}
|
||||
|
||||
--disable_query_log
|
||||
--source ../../include/clean_up_spider.inc
|
||||
|
@@ -7,10 +7,6 @@
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
# These suppressions are a workaround and should not be needed once
|
||||
# MDEV-29870 is done.
|
||||
call mtr.add_suppression("\\[ERROR\\] Table 'mysql.spider_table_sts' doesn't exist");
|
||||
call mtr.add_suppression("\\[ERROR\\] Server shutdown in progress");
|
||||
SET GLOBAL default_tmp_storage_engine=spider;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
|
@@ -2,10 +2,7 @@
|
||||
--echo # MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
|
||||
--echo #
|
||||
|
||||
if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%ASAN%"`)
|
||||
{
|
||||
--skip test needs to be run with ASAN
|
||||
}
|
||||
# this test should be checked with ubsan
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
|
@@ -2,10 +2,7 @@
|
||||
--echo # MDEV-30981 Spider UBSAN: null pointer passed as argument 2, which is declared to never be null in spider_create_trx_alter_table on ALTER
|
||||
--echo #
|
||||
|
||||
if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%UBSAN%"`)
|
||||
{
|
||||
--skip test needs to be run with UBSAN
|
||||
}
|
||||
# this test should be checked with ubsan
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
|
11
storage/spider/mysql-test/spider/bugfix/t/mdev_33191.test
Normal file
11
storage/spider/mysql-test/spider/bugfix/t/mdev_33191.test
Normal file
@@ -0,0 +1,11 @@
|
||||
INSTALL SONAME 'ha_spider';
|
||||
set spider_same_server_link=on;
|
||||
CREATE TABLE t2(c INT);
|
||||
--let $SOCKET=`SELECT @@global.socket`
|
||||
evalp CREATE TABLE t1(c INT) ENGINE=Spider COMMENT='socket "$SOCKET", user "root", table "t2 t3"';
|
||||
ALTER TABLE t1 ENGINE=Spider;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
TRUNCATE TABLE t1;
|
||||
drop table t1, t2;
|
||||
--disable_query_log
|
||||
--source ../../include/clean_up_spider.inc
|
@@ -8739,7 +8739,7 @@ int spider_db_delete_all_rows(
|
||||
spider->conn_link_idx, roop_count, share->link_count,
|
||||
SPIDER_LINK_STATUS_RECOVERY)
|
||||
) {
|
||||
uint dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
uint dbton_id = share->sql_dbton_ids[roop_count];
|
||||
spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id];
|
||||
conn = spider->conns[roop_count];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
|
@@ -1895,6 +1895,12 @@ static const LEX_CSTRING maturity_name[] =
|
||||
{ STRING_WITH_LEN("Stable") }
|
||||
};
|
||||
|
||||
/*
|
||||
Type of singletons based on the type of the remote database.
|
||||
|
||||
All such singletons are stored in the array `spider_dbton', see
|
||||
`spider_db_init()'.
|
||||
*/
|
||||
typedef struct st_spider_dbton
|
||||
{
|
||||
uint dbton_id;
|
||||
|
@@ -1505,6 +1505,7 @@ typedef struct st_spider_share
|
||||
uint *hs_read_conn_keys_lengths;
|
||||
uint *hs_write_conn_keys_lengths;
|
||||
#endif
|
||||
/* The index in `spider_dbton' of each data node link. */
|
||||
uint *sql_dbton_ids;
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
uint *hs_dbton_ids;
|
||||
@@ -1601,14 +1602,23 @@ typedef struct st_spider_share
|
||||
uchar dbton_bitmap[spider_bitmap_size(SPIDER_DBTON_SIZE)];
|
||||
spider_db_share *dbton_share[SPIDER_DBTON_SIZE];
|
||||
uint use_dbton_count;
|
||||
/* Actual size is `use_dbton_count'. Values are the indices of item
|
||||
in `spider_dbton'. */
|
||||
uint use_dbton_ids[SPIDER_DBTON_SIZE];
|
||||
/* Inverse map of `use_dbton_ids'. */
|
||||
uint dbton_id_to_seq[SPIDER_DBTON_SIZE];
|
||||
uint use_sql_dbton_count;
|
||||
/* Actual size is `use_sql_dbton_count'. Values are the indices of
|
||||
item in `spider_dbton'. */
|
||||
uint use_sql_dbton_ids[SPIDER_DBTON_SIZE];
|
||||
/* Inverse map of `use_sql_dbton_ids'. */
|
||||
uint sql_dbton_id_to_seq[SPIDER_DBTON_SIZE];
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
uint use_hs_dbton_count;
|
||||
/* Actual size is `use_hs_dbton_count'. Values are the indices of
|
||||
item in `spider_dbton'. */
|
||||
uint use_hs_dbton_ids[SPIDER_DBTON_SIZE];
|
||||
/* Inverse map of `use_hs_dbton_ids'. */
|
||||
uint hs_dbton_id_to_seq[SPIDER_DBTON_SIZE];
|
||||
#endif
|
||||
|
||||
|
@@ -486,8 +486,8 @@ static int json_num_states[NS_NUM_STATES][N_NUM_CLASSES]=
|
||||
/*OK*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
|
||||
/*GO*/ { NS_GO1, JE_SYN, NS_Z, NS_INT, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
|
||||
/*GO1*/ { JE_SYN, JE_SYN, NS_Z1, NS_INT, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
|
||||
/*ZERO*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, NS_OK, JE_BAD_CHR },
|
||||
/*ZE1*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, JE_SYN, NS_OK, JE_BAD_CHR },
|
||||
/*ZERO*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, NS_EX, NS_OK, JE_BAD_CHR },
|
||||
/*ZE1*/ { JE_SYN, JE_SYN, JE_SYN, JE_SYN, NS_FRAC, NS_EX, NS_OK, JE_BAD_CHR },
|
||||
/*INT*/ { JE_SYN, JE_SYN, NS_INT, NS_INT, NS_FRAC, NS_EX, NS_OK, JE_BAD_CHR },
|
||||
/*FRAC*/ { JE_SYN, JE_SYN, NS_FRAC, NS_FRAC,JE_SYN, NS_EX, NS_OK, JE_BAD_CHR },
|
||||
/*EX*/ { NS_EX, NS_EX, NS_EX1, NS_EX1, JE_SYN, JE_SYN, JE_SYN, JE_BAD_CHR },
|
||||
|
Reference in New Issue
Block a user