summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc1
-rw-r--r--client/mysql_upgrade.c4
-rw-r--r--client/mysqladmin.cc19
-rw-r--r--client/mysqlbinlog.cc2
-rw-r--r--client/mysqldump.c5
-rw-r--r--client/mysqltest.cc5
-rw-r--r--config.h.cmake17
-rw-r--r--mysql-test/r/analyze_format_json.result32
-rw-r--r--mysql-test/r/derived_view.result21
-rw-r--r--mysql-test/r/subselect_sj.result54
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result54
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev-11092.result17
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev-11092.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev-11092.test53
-rw-r--r--mysql-test/t/derived_view.test20
-rw-r--r--mysql-test/t/subselect_sj.test40
-rw-r--r--mysys/lf_hash.c3
-rw-r--r--mysys/ma_dyncol.c1
-rw-r--r--mysys/waiting_threads.c2
-rw-r--r--plugin/auth_pam/auth_pam.c1
-rw-r--r--plugin/feedback/sender_thread.cc2
-rw-r--r--plugin/server_audit/server_audit.c5
-rw-r--r--sql-common/client_plugin.c11
-rw-r--r--sql/discover.cc3
-rw-r--r--sql/filesort.cc1
-rw-r--r--sql/log.cc7
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/opt_range.cc7
-rw-r--r--sql/opt_subselect.cc31
-rw-r--r--sql/records.cc2
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_repl.cc6
-rw-r--r--sql/sql_show.cc2
-rw-r--r--sql/sys_vars.cc3
-rw-r--r--storage/connect/array.cpp10
-rw-r--r--storage/connect/array.h4
-rw-r--r--storage/connect/blkfil.cpp8
-rw-r--r--storage/connect/blkfil.h8
-rw-r--r--storage/connect/block.h4
-rw-r--r--storage/connect/colblk.cpp4
-rw-r--r--storage/connect/colblk.h4
-rw-r--r--storage/connect/csort.h4
-rwxr-xr-xstorage/connect/filamvct.cpp1
-rw-r--r--storage/connect/filter.cpp10
-rw-r--r--storage/connect/filter.h4
-rw-r--r--storage/connect/plgdbutl.cpp2
-rw-r--r--storage/connect/tabcol.cpp8
-rw-r--r--storage/connect/tabcol.h8
-rw-r--r--storage/connect/tabdos.cpp4
-rw-r--r--storage/connect/tabdos.h4
-rw-r--r--storage/connect/tabjdbc.h2
-rw-r--r--storage/connect/table.cpp6
-rw-r--r--storage/connect/tabodbc.h2
-rw-r--r--storage/connect/tabsys.h4
-rw-r--r--storage/connect/tabxml.h2
-rw-r--r--storage/connect/value.cpp8
-rw-r--r--storage/connect/value.h6
-rwxr-xr-xstorage/connect/xindex.cpp4
-rw-r--r--storage/connect/xindex.h4
-rw-r--r--storage/connect/xobject.cpp8
-rw-r--r--storage/connect/xobject.h4
-rw-r--r--storage/connect/xtable.h4
-rw-r--r--storage/csv/ha_tina.cc15
-rw-r--r--storage/maria/ma_check.c1
-rw-r--r--storage/maria/ma_loghandler.c53
-rw-r--r--storage/maria/ma_packrec.c2
-rw-r--r--storage/maria/ma_recovery.c3
-rw-r--r--storage/myisam/ha_myisam.cc2
-rw-r--r--storage/myisam/mi_open.c2
-rw-r--r--storage/xtradb/buf/buf0dump.cc1
-rw-r--r--storage/xtradb/dict/dict0mem.cc4
-rw-r--r--storage/xtradb/handler/ha_innodb.cc2
-rw-r--r--storage/xtradb/log/log0online.cc1
-rw-r--r--storage/xtradb/srv/srv0srv.cc3
-rw-r--r--strings/ctype.c2
-rw-r--r--tests/mysql_client_test.c1
-rw-r--r--unittest/mysys/ma_dyncol-t.c3
77 files changed, 488 insertions, 184 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 4d7c0526dc8..744c3e55103 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3059,7 +3059,6 @@ static int com_server_help(String *buffer __attribute__((unused)),
{
unsigned int num_fields= mysql_num_fields(result);
my_ulonglong num_rows= mysql_num_rows(result);
- mysql_fetch_fields(result);
if (num_fields==3 && num_rows==1)
{
if (!(cur= mysql_fetch_row(result)))
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 9ac438ff6ea..4e4970bacab 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -1130,7 +1130,7 @@ static int check_version_match(void)
int main(int argc, char **argv)
{
- char self_name[FN_REFLEN];
+ char self_name[FN_REFLEN + 1];
MY_INIT(argv[0]);
@@ -1138,7 +1138,7 @@ int main(int argc, char **argv)
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
#endif
{
- strncpy(self_name, argv[0], FN_REFLEN);
+ strmake_buf(self_name, argv[0]);
}
if (init_dynamic_string(&ds_args, "", 512, 256) ||
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index aa6a188166d..e6b904eb26e 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -614,6 +614,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
+ int ret = 0;
const char *status;
/*
MySQL documentation relies on the fact that mysqladmin will
@@ -1104,7 +1105,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
if (strcmp(typed_password, verified) != 0)
{
my_printf_error(0,"Passwords don't match",MYF(ME_BELL));
- return -1;
+ ret = -1;
+ goto password_done;
}
}
else
@@ -1131,7 +1133,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
my_printf_error(0, "Could not determine old_passwords setting from server; error: '%s'",
error_flags, mysql_error(mysql));
- return -1;
+ ret = -1;
+ goto password_done;
}
else
{
@@ -1142,7 +1145,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
"Could not get old_passwords setting from "
"server; error: '%s'",
error_flags, mysql_error(mysql));
- return -1;
+ ret = -1;
+ goto password_done;
}
if (!mysql_num_rows(res))
old= 1;
@@ -1167,15 +1171,15 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
my_printf_error(0, "Can't turn off logging; error: '%s'",
error_flags, mysql_error(mysql));
- return -1;
+ ret = -1;
}
+ else
if (mysql_query(mysql,buff))
{
if (mysql_errno(mysql)!=1290)
{
my_printf_error(0,"unable to change password; error: '%s'",
error_flags, mysql_error(mysql));
- return -1;
}
else
{
@@ -1189,9 +1193,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
" --skip-grant-tables).\n"
"Use: \"mysqladmin flush-privileges password '*'\""
" instead", error_flags);
- return -1;
}
+ ret = -1;
}
+password_done:
/* free up memory from prompted password */
if (typed_password != argv[1])
{
@@ -1293,7 +1298,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return 1;
}
}
- return 0;
+ return ret;
}
/**
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index b109ec858b0..7a4b34c40c6 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -2252,7 +2252,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
size_t tlen = strlen(logname);
- if (tlen > UINT_MAX)
+ if (tlen > sizeof(buf) - 10)
{
error("Log name too long.");
DBUG_RETURN(ERROR_STOP);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 810f4fc7beb..ca47f89268e 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2845,6 +2845,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_free(scv_buff);
+ if (path)
+ my_fclose(sql_file, MYF(MY_WME));
DBUG_RETURN(0);
}
else
@@ -5927,8 +5929,7 @@ static my_bool get_view_structure(char *table, char* db)
dynstr_free(&ds_view);
}
- if (switch_character_set_results(mysql, default_charset))
- DBUG_RETURN(1);
+ switch_character_set_results(mysql, default_charset);
/* If a separate .sql file was opened, close it now */
if (sql_file != md_result_file)
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 7fbe6c3e09b..6ed45beec00 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1721,13 +1721,12 @@ void log_msg(const char *fmt, ...)
int cat_file(DYNAMIC_STRING* ds, const char* filename)
{
int fd;
- size_t len;
+ int len;
char buff[16384];
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
return 1;
- while((len= my_read(fd, (uchar*)&buff,
- sizeof(buff)-1, MYF(0))) > 0)
+ while((len= (int)my_read(fd, (uchar*)&buff, sizeof(buff)-1, MYF(0))) > 0)
{
char *p= buff, *start= buff,*end=buff+len;
while (p < end)
diff --git a/config.h.cmake b/config.h.cmake
index 5e48085a61a..8ef512c7071 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -673,21 +673,4 @@
#define __STDC_FORMAT_MACROS
#endif
-/*
- stat structure (from <sys/stat.h>) is conditionally defined
- to have different layout and size depending on the defined macros.
- The correct macro is defined in my_config.h, which means it MUST be
- included first (or at least before <features.h> - so, practically,
- before including any system headers).
-
- Check the include order by looking at __GLIBC__ (defined in <features.h>)
-
- But we cannot force all third-party clients/connectors to include
- my_config.h first. So, their crashes are their responsibility,
- we enable this check only for MariaDB sources (SAFE_MUTEX check).
-*/
-#if defined(__GLIBC__) && defined(SAFE_MUTEX)
-#error <my_config.h> MUST be included first!
-#endif
-
#endif
diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result
index 78892711dc4..ea9afd9215f 100644
--- a/mysql-test/r/analyze_format_json.result
+++ b/mysql-test/r/analyze_format_json.result
@@ -606,22 +606,23 @@ ANALYZE
},
"block-nl-join": {
"table": {
- "table_name": "<subquery2>",
+ "table_name": "t2",
"access_type": "ALL",
- "possible_keys": ["distinct_key"],
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
- "r_filtered": 100
+ "r_filtered": 0,
+ "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "r_filtered": 100,
- "materialized": {
- "unique": 1,
+ "r_filtered": null
+ },
+ "subqueries": [
+ {
"query_block": {
"select_id": 2,
"r_loops": 1,
@@ -638,24 +639,7 @@ ANALYZE
}
}
}
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_total_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "incremental",
- "buffer_size": "256Kb",
- "join_type": "BNL",
- "attached_condition": "(t2.b = `<subquery2>`.a)",
- "r_filtered": 0
- }
+ ]
}
}
drop table t1,t2;
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index d60ed34d927..416d4e3aeb9 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2628,5 +2628,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
drop view v1;
drop table t1,t2;
+#
+# Bug mdev-12812: mergeable derived / view with subqueries
+# NOT subject to semi-join optimizations
+#
+CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('foo');
+CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
+SELECT STRAIGHT_JOIN *
+FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
+c1
+foo
+foo
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN *
+FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t2`.`c2` from `test`.`t2` where (<cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`)))
+DROP TABLE t1, t2;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index cc0f3b27e38..643034f452d 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -3107,4 +3107,58 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
drop table t1,t2;
set optimizer_switch= @tmp_mdev12675;
+#
+# MDEV-12817: subquery NOT subject to semi-join optimizations
+# in ON expression of INNER JOIN
+#
+CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (7),(8);
+SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+c1
+1
+2
+EXPLAIN EXTENDED SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t3`.`c3` = `test`.`t1`.`c1`) and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where (1 = `test`.`t4`.`c4`)))))) where 1
+# mdev-12820
+SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+c1 c2 c4
+1 NULL NULL
+2 NULL NULL
+EXPLAIN EXTENDED SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
+DROP TABLE t1,t2,t3,t4;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index 44821d6d982..6d9dc37345a 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -3121,6 +3121,60 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
drop table t1,t2;
set optimizer_switch= @tmp_mdev12675;
+#
+# MDEV-12817: subquery NOT subject to semi-join optimizations
+# in ON expression of INNER JOIN
+#
+CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (7),(8);
+SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+c1
+1
+2
+EXPLAIN EXTENDED SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
+2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t3`.`c3` = `test`.`t1`.`c1`) and <cache>(<in_optimizer>(1,<exists>(select `test`.`t4`.`c4` from `test`.`t4` where (1 = `test`.`t4`.`c4`)))))) where 1
+# mdev-12820
+SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+c1 c2 c4
+1 NULL NULL
+2 NULL NULL
+EXPLAIN EXTENDED SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) and <in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t3`.`c3` from `test`.`t3` where (<cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))))) where 1
+DROP TABLE t1,t2,t3,t4;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
diff --git a/mysql-test/suite/rpl/r/rpl_mdev-11092.result b/mysql-test/suite/rpl/r/rpl_mdev-11092.result
new file mode 100644
index 00000000000..b2de9e5f573
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mdev-11092.result
@@ -0,0 +1,17 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
+SET GLOBAL max_binlog_cache_size = 4096;
+SET GLOBAL binlog_cache_size = 4096;
+SET GLOBAL max_binlog_stmt_cache_size = 4096;
+SET GLOBAL binlog_stmt_cache_size = 4096;
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
+ERROR HY000: Writing one row to the row-based binary log failed
+include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
+SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
+SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
+SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
+SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.opt b/mysql-test/suite/rpl/t/rpl_mdev-11092.opt
new file mode 100644
index 00000000000..7f1d270d29f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.opt
@@ -0,0 +1 @@
+--binlog_checksum=1 --binlog-annotate-row-events=1
diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.test b/mysql-test/suite/rpl/t/rpl_mdev-11092.test
new file mode 100644
index 00000000000..c8b2b7f2ad1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.test
@@ -0,0 +1,53 @@
+--source include/have_innodb.inc
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+--source include/have_binlog_format_row.inc
+
+########################################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
+
+let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
+let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
+let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1);
+let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1);
+
+SET GLOBAL max_binlog_cache_size = 4096;
+SET GLOBAL binlog_cache_size = 4096;
+SET GLOBAL max_binlog_stmt_cache_size = 4096;
+SET GLOBAL binlog_stmt_cache_size = 4096;
+disconnect master;
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
+
+let $data = `select concat('"', repeat('a',2000), '"')`;
+
+connection master;
+
+--disable_query_log
+--error ER_BINLOG_ROW_LOGGING_FAILED
+eval INSERT INTO t1 (a, data) VALUES (2,
+ CONCAT($data, $data, $data, $data, $data, $data));
+--enable_query_log
+
+# Incident event
+# 1590=ER_SLAVE_INCIDENT
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+connection master;
+
+--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
+--replace_result $old_binlog_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
+--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size
+--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
+
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 503d00b94c3..1c0749346ca 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1911,6 +1911,26 @@ explain select * from v1;
drop view v1;
drop table t1,t2;
+--echo #
+--echo # Bug mdev-12812: mergeable derived / view with subqueries
+--echo # NOT subject to semi-join optimizations
+--echo #
+
+CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('foo');
+
+CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
+
+let $q=
+SELECT STRAIGHT_JOIN *
+ FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+DROP TABLE t1, t2;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 071b135f740..f90f1e2e927 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2805,5 +2805,45 @@ select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
drop table t1,t2;
set optimizer_switch= @tmp_mdev12675;
+--echo #
+--echo # MDEV-12817: subquery NOT subject to semi-join optimizations
+--echo # in ON expression of INNER JOIN
+--echo #
+
+CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+
+CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (7),(8);
+
+let $q1=
+SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+
+eval $q1;
+eval EXPLAIN EXTENDED $q1;
+
+let $q2=
+SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+
+--echo # mdev-12820
+eval $q2;
+eval EXPLAIN EXTENDED $q2;
+
+DROP TABLE t1,t2,t3,t4;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index dfddc1ce442..7354b1699b1 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -550,7 +550,10 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node,
return -1;
if (*el == NULL && bucket &&
unlikely(initialize_bucket(hash, el, parent, pins)))
+ {
+ my_free(dummy);
return -1;
+ }
dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */
dummy->key= dummy_key;
dummy->keylen= 0;
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c
index be40052b561..e3357e389c2 100644
--- a/mysys/ma_dyncol.c
+++ b/mysys/ma_dyncol.c
@@ -4038,6 +4038,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val)
*dbl= strtod(str, &end);
if (*end != '\0')
rc= ER_DYNCOL_TRUNCATED;
+ free(str);
break;
}
case DYN_COL_DECIMAL:
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c
index 7d8aae032ea..2549bd8a587 100644
--- a/mysys/waiting_threads.c
+++ b/mysys/waiting_threads.c
@@ -556,7 +556,7 @@ my_bool wt_resource_id_memcmp(const void *a, const void *b)
{
/* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */
compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong));
- return memcmp(a, b, sizeof_WT_RESOURCE_ID);
+ return MY_TEST(memcmp(a, b, sizeof_WT_RESOURCE_ID));
}
/**
diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c
index 1f25163b371..95d95b9719c 100644
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@ -162,6 +162,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
if (new_username && strcmp(new_username, info->user_name))
strncpy(info->authenticated_as, new_username,
sizeof(info->authenticated_as));
+ info->authenticated_as[sizeof(info->authenticated_as)-1]= 0;
end:
pam_end(pamh, status);
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 91ac92e3d39..d61e303e8b3 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -205,7 +205,7 @@ static void send_report(const char *when)
/*
otherwise, prepare the THD and TABLE_LIST,
create and fill the temporary table with data just like
- SELECT * FROM IFROEMATION_SCHEMA.feedback is doing,
+ SELECT * FROM INFORMATION_SCHEMA.FEEDBACK is doing,
read and concatenate table data into a String.
*/
if (!(thd= new THD()))
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 2574961f188..e9827b90402 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1041,6 +1041,7 @@ static int start_logging()
error_header();
fprintf(stderr, "logging started to the file %s.\n", alt_fname);
strncpy(current_log_buf, alt_fname, sizeof(current_log_buf));
+ current_log_buf[sizeof(current_log_buf)-1]= 0;
}
else if (output_type == OUTPUT_SYSLOG)
{
@@ -2570,6 +2571,7 @@ static void update_file_path(MYSQL_THD thd,
}
strncpy(path_buffer, new_name, sizeof(path_buffer));
+ path_buffer[sizeof(path_buffer)-1]= 0;
file_path= path_buffer;
exit_func:
internal_stop_logging= 0;
@@ -2622,6 +2624,7 @@ static void update_incl_users(MYSQL_THD thd,
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
+ incl_user_buffer[sizeof(incl_user_buffer)-1]= 0;
incl_users= incl_user_buffer;
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
error_header();
@@ -2640,6 +2643,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
+ excl_user_buffer[sizeof(excl_user_buffer)-1]= 0;
excl_users= excl_user_buffer;
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
error_header();
@@ -2771,6 +2775,7 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)),
{
char *new_ident= (*(char **) save) ? *(char **) save : empty_str;
strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer));
+ syslog_ident_buffer[sizeof(syslog_ident_buffer)-1]= 0;
syslog_ident= syslog_ident_buffer;
error_header();
fprintf(stderr, "SYSYLOG ident was changed to '%s'\n", syslog_ident);
diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c
index dd87b01d932..f93e50125c5 100644
--- a/sql-common/client_plugin.c
+++ b/sql-common/client_plugin.c
@@ -375,8 +375,7 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
if (!(sym= dlsym(dlhandle, plugin_declarations_sym)))
{
errmsg= "not a plugin";
- (void)dlclose(dlhandle);
- goto err;
+ goto errc;
}
plugin= (struct st_mysql_client_plugin*)sym;
@@ -384,19 +383,19 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
if (type >=0 && type != plugin->type)
{
errmsg= "type mismatch";
- goto err;
+ goto errc;
}
if (strcmp(name, plugin->name))
{
errmsg= "name mismatch";
- goto err;
+ goto errc;
}
if (type < 0 && find_plugin(name, plugin->type))
{
errmsg= "it is already loaded";
- goto err;
+ goto errc;
}
plugin= add_plugin(mysql, plugin, dlhandle, argc, args);
@@ -406,6 +405,8 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
DBUG_PRINT ("leave", ("plugin loaded ok"));
DBUG_RETURN (plugin);
+errc:
+ dlclose(dlhandle);
err:
mysql_mutex_unlock(&LOCK_load_client_plugin);
DBUG_PRINT ("leave", ("plugin load error : %s", errmsg));
diff --git a/sql/discover.cc b/sql/discover.cc
index d8ed718fc58..d8bf6ca79c5 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -89,8 +89,7 @@ int readfrm(const char *name, const uchar **frmdata, size_t *len)
error= 0;
err:
- if (file > 0)
- (void) mysql_file_close(file, MYF(MY_WME));
+ (void) mysql_file_close(file, MYF(MY_WME));
err_end: /* Here when no file */
DBUG_RETURN (error);
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 23674b937fc..3f174029d48 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -925,6 +925,7 @@ write_keys(Sort_param *param, Filesort_info *fs_info, uint count,
/* check we won't have more buffpeks than we can possibly keep in memory */
if (my_b_tell(buffpek_pointers) + sizeof(BUFFPEK) > (ulonglong)UINT_MAX)
goto err;
+ bzero(&buffpek, sizeof(buffpek));
buffpek.file_pos= my_b_tell(tempfile);
if ((ha_rows) count > param->max_rows)
count=(uint) param->max_rows; /* purecov: inspected */
diff --git a/sql/log.cc b/sql/log.cc
index 54d40896305..665157a06c5 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -5640,13 +5640,20 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
IO_CACHE *file=
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
Log_event_writer writer(file);
+ binlog_cache_data *cache_data=
+ cache_mngr->get_binlog_cache_data(use_trans_cache(this, is_transactional));
+
if (with_annotate && *with_annotate)
{
Annotate_rows_log_event anno(table->in_use, is_transactional, false);
/* Annotate event should be written not more than once */
*with_annotate= 0;
if ((error= writer.write(&anno)))
+ {
+ if (my_errno == EFBIG)
+ cache_data->set_incident();
DBUG_RETURN(error);
+ }
}
if ((error= writer.write(&the_event)))
DBUG_RETURN(error);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index abb9706c59b..1e6ee4decbe 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8174,7 +8174,7 @@ static int show_default_keycache(THD *thd, SHOW_VAR *var, char *buff,
{
struct st_data {
KEY_CACHE_STATISTICS stats;
- SHOW_VAR var[8];
+ SHOW_VAR var[9];
} *data;
SHOW_VAR *v;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index bb4f7370ac9..e4e29378c25 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -6967,7 +6967,10 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
{
if (!(quick= (*scan)->make_quick(param, FALSE, &quick_roru->alloc)) ||
quick_roru->push_quick_back(quick))
+ {
+ delete quick_roru;
DBUG_RETURN(NULL);
+ }
}
quick_roru->records= records;
quick_roru->read_time= read_cost;
@@ -10567,9 +10570,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
*/
thd->mem_root= old_root;
- if (!quick || create_err)
- return 0; /* no ranges found */
- if (quick->init())
+ if (!quick || create_err || quick->init())
goto err;
quick->records= records;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 0335a663ec3..dd6c2c50b32 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1105,7 +1105,26 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
do
{
embedded= embedding;
- if (MY_TEST(embedded->outer_join))
+ bool block_conversion_to_sj= false;
+ if (embedded->on_expr)
+ {
+ /*
+ Conversion of an IN subquery predicate into semi-join
+ is blocked now if the predicate occurs:
+ - in the ON expression of an outer join
+ - in the ON expression of an inner join embedded directly
+ or indirectly in the inner nest of an outer join
+ */
+ for (TABLE_LIST *tl= embedded; tl; tl= tl->embedding)
+ {
+ if (tl->outer_join)
+ {
+ block_conversion_to_sj= true;
+ break;
+ }
+ }
+ }
+ if (block_conversion_to_sj)
{
Item *cond= embedded->on_expr;
if (!cond)
@@ -1144,6 +1163,16 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
in_subq->block_conversion_to_sj();
}
}
+
+ if (join->select_options & SELECT_STRAIGHT_JOIN)
+ {
+ /* Block conversion to semijoins for all candidates */
+ li.rewind();
+ while ((in_subq= li++))
+ {
+ in_subq->block_conversion_to_sj();
+ }
+ }
li.rewind();
/* First, convert child join's subqueries. We proceed bottom-up here */
diff --git a/sql/records.cc b/sql/records.cc
index ebda0ed35b0..3901161a2cb 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -69,7 +69,7 @@ static int rr_index_desc(READ_RECORD *info);
bool init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
bool print_error, uint idx, bool reverse)
{
- int error;
+ int error= 0;
DBUG_ENTER("init_read_record_idx");
empty_record(table);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 97513e9e6b8..e0dd04b08f6 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3306,7 +3306,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
{
stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= thd->get_stmt_da()->sql_errno();
- strncpy(stmt->last_error, thd->get_stmt_da()->message(), MYSQL_ERRMSG_SIZE);
+ strmake_buf(stmt->last_error, thd->get_stmt_da()->message());
}
thd->set_stmt_da(save_stmt_da);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 6fedda95959..09248486bec 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3918,9 +3918,6 @@ bool mysql_show_binlog_events(THD* thd)
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
- Format_description_log_event *description_event= new
- Format_description_log_event(3); /* MySQL 4.0 by default */
-
DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ||
thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS);
@@ -3941,6 +3938,9 @@ bool mysql_show_binlog_events(THD* thd)
binary_log= &(mi->rli.relay_log);
}
+ Format_description_log_event *description_event= new
+ Format_description_log_event(3); /* MySQL 4.0 by default */
+
if (binary_log->is_open())
{
SELECT_LEX_UNIT *unit= &thd->lex->unit;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index c44a281af9d..fadaa58ceed 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3222,7 +3222,7 @@ static bool show_status_array(THD *thd, const char *wild,
for (; variables->name; variables++)
{
- bool wild_checked;
+ bool wild_checked= 0;
strnmov(prefix_end, variables->name, len);
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 1a6bb9a4e54..39945209c82 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1719,7 +1719,10 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var)
return true;
}
if (res->length() == 0)
+ {
list= NULL;
+ list_len= 0;
+ }
else if (!(list= gtid_parse_string_to_list(res->ptr(), res->length(),
&list_len)))
{
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp
index 5cf15c5ac18..6e0da312ca3 100644
--- a/storage/connect/array.cpp
+++ b/storage/connect/array.cpp
@@ -986,7 +986,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
for (i = 0; i < Nval; i++) {
Value->SetValue_pvblk(Vblp, i);
- Value->Print(g, tp, z);
+ Value->Prints(g, tp, z);
len += strlen(tp);
} // enfor i
@@ -998,7 +998,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
for (i = 0; i < Nval;) {
Value->SetValue_pvblk(Vblp, i);
- Value->Print(g, tp, z);
+ Value->Prints(g, tp, z);
strcat(p, tp);
strcat(p, (++i == Nval) ? ")" : ",");
} // enfor i
@@ -1012,7 +1012,7 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g)
/***********************************************************************/
/* Make file output of ARRAY contents. */
/***********************************************************************/
-void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
+void ARRAY::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64];
int lim = MY_MIN(Nval,10);
@@ -1029,7 +1029,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
if (Vblp)
for (int i = 0; i < lim; i++) {
Value->SetValue_pvblk(Vblp, i);
- Value->Print(g, f, n+4);
+ Value->Printf(g, f, n+4);
} // endfor i
} else
@@ -1040,7 +1040,7 @@ void ARRAY::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of ARRAY contents. */
/***********************************************************************/
-void ARRAY::Print(PGLOBAL, char *ps, uint z)
+void ARRAY::Prints(PGLOBAL, char *ps, uint z)
{
if (z < 16)
return;
diff --git a/storage/connect/array.h b/storage/connect/array.h
index dfc3638de8a..bd38344de06 100644
--- a/storage/connect/array.h
+++ b/storage/connect/array.h
@@ -56,8 +56,8 @@ class DllExport ARRAY : public XOBJECT, public CSORT { // Array descblock
virtual bool Compare(PXOB) {assert(false); return false;}
virtual bool SetFormat(PGLOBAL, FORMAT&) {assert(false); return false;}
//virtual int CheckSpcCol(PTDB, int) {return 0;}
- virtual void Print(PGLOBAL g, FILE *f, uint n);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *f, uint n);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
// void Empty(void);
void SetPrecision(PGLOBAL g, int p);
bool AddValue(PGLOBAL g, PSZ sp);
diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp
index e438e185e5d..77a46260934 100644
--- a/storage/connect/blkfil.cpp
+++ b/storage/connect/blkfil.cpp
@@ -56,7 +56,7 @@ BLOCKFILTER::BLOCKFILTER(PTDBDOS tdbp, int op)
/***********************************************************************/
/* Make file output of BLOCKFILTER contents. */
/***********************************************************************/
-void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)
+void BLOCKFILTER::Printf(PGLOBAL, FILE *f, uint n)
{
char m[64];
@@ -70,7 +70,7 @@ void BLOCKFILTER::Print(PGLOBAL, FILE *f, uint n)
/***********************************************************************/
/* Make string output of BLOCKFILTER contents. */
/***********************************************************************/
-void BLOCKFILTER::Print(PGLOBAL, char *ps, uint z)
+void BLOCKFILTER::Prints(PGLOBAL, char *ps, uint z)
{
strncat(ps, "BlockFilter(s)", z);
} // end of Print
@@ -995,7 +995,7 @@ int BLOCKINDEX::BlockEval(PGLOBAL g)
/***********************************************************************/
/* Make file output of BLOCKINDEX contents. */
/***********************************************************************/
-void BLOCKINDEX::Print(PGLOBAL g, FILE *f, UINT n)
+void BLOCKINDEX::Printf(PGLOBAL g, FILE *f, UINT n)
{
char m[64];
@@ -1013,7 +1013,7 @@ void BLOCKINDEX::Print(PGLOBAL g, FILE *f, UINT n)
/***********************************************************************/
/* Make string output of BLOCKINDEX contents. */
/***********************************************************************/
-void BLOCKINDEX::Print(PGLOBAL g, char *ps, UINT z)
+void BLOCKINDEX::Prints(PGLOBAL g, char *ps, UINT z)
{
strncat(ps, "BlockIndex(es)", z);
} // end of Print
diff --git a/storage/connect/blkfil.h b/storage/connect/blkfil.h
index 00b00139042..61b02c53c14 100644
--- a/storage/connect/blkfil.h
+++ b/storage/connect/blkfil.h
@@ -27,8 +27,8 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */
// Methods
virtual void Reset(PGLOBAL) = 0;
virtual int BlockEval(PGLOBAL) = 0;
- virtual void Print(PGLOBAL g, FILE *f, uint n);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *f, uint n);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
protected:
BLOCKFILTER(void) {} // Standard constructor not to be used
@@ -234,8 +234,8 @@ class DllExport BLOCKINDEX : public BLOCK { /* Indexing Test Block */
// Methods
void Reset(void);
virtual int BlockEval(PGLOBAL);
- virtual void Print(PGLOBAL g, FILE *f, UINT n);
- virtual void Print(PGLOBAL g, char *ps, UINT z);
+ virtual void Printf(PGLOBAL g, FILE *f, UINT n);
+ virtual void Prints(PGLOBAL g, char *ps, UINT z);
protected:
BLOCKINDEX(void) {} // Standard constructor not to be used
diff --git a/storage/connect/block.h b/storage/connect/block.h
index aa4edde5ec9..8ac7be80988 100644
--- a/storage/connect/block.h
+++ b/storage/connect/block.h
@@ -44,8 +44,8 @@ class DllExport BLOCK {
return (PlugSubAlloc(g, p, size));
} // end of new
- virtual void Print(PGLOBAL, FILE *, uint) {} // Produce file desc
- virtual void Print(PGLOBAL, char *, uint) {} // Produce string desc
+ virtual void Printf(PGLOBAL, FILE *, uint) {} // Produce file desc
+ virtual void Prints(PGLOBAL, char *, uint) {} // Produce string desc
#if !defined(__BORLANDC__)
// Avoid warning C4291 by defining a matching dummy delete operator
diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp
index fa205b493a2..324d59ab40e 100644
--- a/storage/connect/colblk.cpp
+++ b/storage/connect/colblk.cpp
@@ -214,7 +214,7 @@ void COLBLK::WriteColumn(PGLOBAL g)
/***********************************************************************/
/* Make file output of a column descriptor block. */
/***********************************************************************/
-void COLBLK::Print(PGLOBAL, FILE *f, uint n)
+void COLBLK::Printf(PGLOBAL, FILE *f, uint n)
{
char m[64];
int i;
@@ -237,7 +237,7 @@ void COLBLK::Print(PGLOBAL, FILE *f, uint n)
/***********************************************************************/
/* Make string output of a column descriptor block. */
/***********************************************************************/
-void COLBLK::Print(PGLOBAL, char *ps, uint)
+void COLBLK::Prints(PGLOBAL, char *ps, uint)
{
sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
} // end of Print
diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h
index 02c4f2361b7..608aa040787 100644
--- a/storage/connect/colblk.h
+++ b/storage/connect/colblk.h
@@ -72,8 +72,8 @@ class DllExport COLBLK : public XOBJECT {
virtual void SetTo_Val(PVAL) {}
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
- virtual void Print(PGLOBAL g, FILE *, uint);
- virtual void Print(PGLOBAL g, char *, uint);
+ virtual void Printf(PGLOBAL g, FILE *, uint);
+ virtual void Prints(PGLOBAL g, char *, uint);
virtual bool VarSize(void) {return false;}
bool InitValue(PGLOBAL g);
diff --git a/storage/connect/csort.h b/storage/connect/csort.h
index 55ff6268a4b..6e700059881 100644
--- a/storage/connect/csort.h
+++ b/storage/connect/csort.h
@@ -49,8 +49,8 @@ class DllExport CSORT {
public:
// Methods
int Qsort(PGLOBAL g, int n); /* Sort calling routine */
-//virtual void Print(PGLOBAL g, FILE *f, uint n);
-//virtual void Print(PGLOBAL g, char *ps, uint z);
+//virtual void Printf(PGLOBAL g, FILE *f, uint n);
+//virtual void Prints(PGLOBAL g, char *ps, uint z);
#ifdef DEBTRACE
int GetNcmp(void) {return num_comp;}
#endif
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index f8a7f2600f3..537f77d01ac 100755
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -569,7 +569,6 @@ bool VCTFAM::InitInsert(PGLOBAL g)
CurNum = 0;
AddBlock = !MaxBlk;
} else {
- int rc;
PVCTCOL cp = (PVCTCOL)Tdbp->GetColumns();
// The starting point must be at the end of file as for append.
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index 863c9ca6571..da44b129ccb 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -1409,7 +1409,7 @@ PFIL FILTER::Copy(PTABS t)
/*********************************************************************/
/* Make file output of FILTER contents. */
/*********************************************************************/
-void FILTER::Print(PGLOBAL g, FILE *f, uint n)
+void FILTER::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64];
@@ -1431,7 +1431,7 @@ void FILTER::Print(PGLOBAL g, FILE *f, uint n)
if (lin && fp->GetArgType(i) == TYPE_FILTER)
fprintf(f, "%s Filter at %p\n", m, fp->Arg(i));
else
- fp->Arg(i)->Print(g, f, n + 2);
+ fp->Arg(i)->Printf(g, f, n + 2);
} // endfor i
@@ -1442,7 +1442,7 @@ void FILTER::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of TABLE contents (z should be checked). */
/***********************************************************************/
-void FILTER::Print(PGLOBAL g, char *ps, uint z)
+void FILTER::Prints(PGLOBAL g, char *ps, uint z)
{
#define FLEN 100
@@ -1470,7 +1470,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)
bcp = bxp;
p = bcp->Cold;
n = FLEN;
- fp->Arg(0)->Print(g, p, n);
+ fp->Arg(0)->Prints(g, p, n);
n = FLEN - strlen(p);
switch (fp->Opc) {
@@ -1516,7 +1516,7 @@ void FILTER::Print(PGLOBAL g, char *ps, uint z)
n = FLEN - strlen(p);
p += strlen(p);
- fp->Arg(1)->Print(g, p, n);
+ fp->Arg(1)->Prints(g, p, n);
} else
if (!bcp) {
strncat(ps, "???", z);
diff --git a/storage/connect/filter.h b/storage/connect/filter.h
index f4835d23a7c..22d1e4ed4be 100644
--- a/storage/connect/filter.h
+++ b/storage/connect/filter.h
@@ -61,8 +61,8 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */
//virtual PXOB CheckSubQuery(PGLOBAL, PSQL);
//virtual bool CheckLocal(PTDB);
//virtual int CheckSpcCol(PTDB tdbp, int n);
- virtual void Print(PGLOBAL g, FILE *f, uint n);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *f, uint n);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
// PFIL Linearize(bool nosep);
// PFIL Link(PGLOBAL g, PFIL fil2);
// PFIL RemoveLastSep(void);
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index d990f082e5b..b6f59bac8cf 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -1492,7 +1492,7 @@ void PlugPutOut(PGLOBAL g, FILE *f, short t, void *v, uint n)
case TYPE_TABLE:
case TYPE_TDB:
case TYPE_XOBJECT:
- ((PBLOCK)v)->Print(g, f, n-2);
+ ((PBLOCK)v)->Printf(g, f, n-2);
break;
default:
diff --git a/storage/connect/tabcol.cpp b/storage/connect/tabcol.cpp
index fde1baa6317..2740864a69b 100644
--- a/storage/connect/tabcol.cpp
+++ b/storage/connect/tabcol.cpp
@@ -73,7 +73,7 @@ PTABLE XTAB::Link(PTABLE tab2)
/***********************************************************************/
/* Make file output of XTAB contents. */
/***********************************************************************/
-void XTAB::Print(PGLOBAL g, FILE *f, uint n)
+void XTAB::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64];
@@ -91,7 +91,7 @@ void XTAB::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of XTAB contents. */
/***********************************************************************/
-void XTAB::Print(PGLOBAL, char *ps, uint z)
+void XTAB::Prints(PGLOBAL, char *ps, uint z)
{
char buf[128];
int i, n = (int)z - 1;
@@ -134,7 +134,7 @@ bool COLUMN::SetFormat(PGLOBAL g, FORMAT&)
/***********************************************************************/
/* Make file output of COLUMN contents. */
/***********************************************************************/
-void COLUMN::Print(PGLOBAL g, FILE *f, uint n)
+void COLUMN::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64];
@@ -154,7 +154,7 @@ void COLUMN::Print(PGLOBAL g, FILE *f, uint n)
/***********************************************************************/
/* Make string output of COLUMN contents. */
/***********************************************************************/
-void COLUMN::Print(PGLOBAL, char *ps, uint z)
+void COLUMN::Prints(PGLOBAL, char *ps, uint z)
{
char buf[80];
diff --git a/storage/connect/tabcol.h b/storage/connect/tabcol.h
index 3bfc37e69c1..e4657e2f261 100644
--- a/storage/connect/tabcol.h
+++ b/storage/connect/tabcol.h
@@ -38,8 +38,8 @@ class DllExport XTAB: public BLOCK { // Table Name-Schema-Srcdef block.
// Methods
PTABLE Link(PTABLE);
- void Print(PGLOBAL g, FILE *f, uint n);
- void Print(PGLOBAL g, char *ps, uint z);
+ void Printf(PGLOBAL g, FILE *f, uint n);
+ void Prints(PGLOBAL g, char *ps, uint z);
protected:
// Members
@@ -78,8 +78,8 @@ class DllExport COLUMN: public XOBJECT { // Column Name/Qualifier block.
void SetTo_Col(PCOL colp) {To_Col = colp;}
// Methods
- virtual void Print(PGLOBAL g, FILE *f, uint n);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *f, uint n);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
// All methods below should never be used for COLUMN's
virtual void Reset(void) {assert(false);}
virtual bool Compare(PXOB) {assert(false); return false;}
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 21b64a41684..468966e79d9 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -2871,9 +2871,9 @@ bool DOSCOL::AddDistinctValue(PGLOBAL g)
/***********************************************************************/
/* Make file output of a Dos column descriptor block. */
/***********************************************************************/
-void DOSCOL::Print(PGLOBAL g, FILE *f, uint n)
+void DOSCOL::Printf(PGLOBAL g, FILE *f, uint n)
{
- COLBLK::Print(g, f, n);
+ COLBLK::Printf(g, f, n);
} // end of Print
/* ------------------------------------------------------------------- */
diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h
index d175cc2da4d..9722cd3777d 100644
--- a/storage/connect/tabdos.h
+++ b/storage/connect/tabdos.h
@@ -232,12 +232,12 @@ class DllExport DOSCOL : public COLBLK {
virtual PVBLK GetDval(void) {return Dval;}
// Methods
- using COLBLK::Print;
+ //using COLBLK::Print;
virtual bool VarSize(void);
virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check);
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
- virtual void Print(PGLOBAL g, FILE *, uint);
+ virtual void Printf(PGLOBAL g, FILE *, uint);
protected:
virtual bool SetMinMax(PGLOBAL g);
diff --git a/storage/connect/tabjdbc.h b/storage/connect/tabjdbc.h
index 7c14783285f..d8ec65d02d8 100644
--- a/storage/connect/tabjdbc.h
+++ b/storage/connect/tabjdbc.h
@@ -173,7 +173,7 @@ public:
// Methods
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
- // void Print(PGLOBAL g, FILE *, uint);
+ // void Printf(PGLOBAL g, FILE *, uint);
protected:
// Members
diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp
index 22fb09dbb86..d39837a7b5a 100644
--- a/storage/connect/table.cpp
+++ b/storage/connect/table.cpp
@@ -299,7 +299,7 @@ bool TDB::SetRecpos(PGLOBAL g, int)
return true;
} // end of SetRecpos
-void TDB::Print(PGLOBAL g, FILE *f, uint n)
+void TDB::Printf(PGLOBAL g, FILE *f, uint n)
{
PCOL cp;
char m[64];
@@ -315,13 +315,13 @@ void TDB::Print(PGLOBAL g, FILE *f, uint n)
fprintf(f, "%s Columns (deg=%d):\n", m, tp->Degree);
for (cp = tp->Columns; cp; cp = cp->GetNext())
- cp->Print(g, f, n);
+ cp->Printf(g, f, n);
} /* endfor tp */
} // end of Print
-void TDB::Print(PGLOBAL, char *ps, uint)
+void TDB::Prints(PGLOBAL, char *ps, uint)
{
sprintf(ps, "R%d.%s", Tdb_No, Name);
} // end of Print
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h
index 487a5073559..0ca88b60858 100644
--- a/storage/connect/tabodbc.h
+++ b/storage/connect/tabodbc.h
@@ -187,7 +187,7 @@ class XSRCCOL : public ODBCCOL {
// Methods
virtual void ReadColumn(PGLOBAL g);
virtual void WriteColumn(PGLOBAL g);
-// void Print(PGLOBAL g, FILE *, uint);
+// void Printf(PGLOBAL g, FILE *, uint);
protected:
// Members
diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h
index 44b5a137a70..0c6017af177 100644
--- a/storage/connect/tabsys.h
+++ b/storage/connect/tabsys.h
@@ -62,7 +62,7 @@ class TDBINI : public TDBASE {
virtual int GetProgCur(void) {return N;}
//virtual int GetAffectedRows(void) {return 0;}
virtual PCSZ GetFile(PGLOBAL g) {return Ifile;}
- virtual void SetFile(PGLOBAL g, PSZ fn) {Ifile = fn;}
+ virtual void SetFile(PGLOBAL g, PCSZ fn) {Ifile = fn;}
virtual void ResetDB(void) {Seclist = Section = NULL; N = 0;}
virtual void ResetSize(void) {MaxSize = -1; Seclist = NULL;}
virtual int RowNumber(PGLOBAL g, bool b = false) {return N;}
@@ -80,7 +80,7 @@ class TDBINI : public TDBASE {
protected:
// Members
- char *Ifile; // The INI file
+ PCSZ Ifile; // The INI file
char *Seclist; // The section list
char *Section; // The current section
int Seclen; // Length of seclist buffer
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index 6b18eb645f0..813f62dde52 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -75,7 +75,7 @@ class DllExport TDBXML : public TDBASE {
virtual int GetRecpos(void);
virtual int GetProgCur(void) {return N;}
virtual PCSZ GetFile(PGLOBAL g) {return Xfile;}
- virtual void SetFile(PGLOBAL g, PSZ fn) {Xfile = fn;}
+ virtual void SetFile(PGLOBAL g, PCSZ fn) {Xfile = fn;}
virtual void ResetDB(void) {N = 0;}
virtual void ResetSize(void) {MaxSize = -1;}
virtual int RowNumber(PGLOBAL g, bool b = false);
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 429593f07d9..b6c63bdadd3 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -561,7 +561,7 @@ bool VALUE::Compute(PGLOBAL g, PVAL *, int, OPVAL)
/***********************************************************************/
/* Make file output of an object value. */
/***********************************************************************/
-void VALUE::Print(PGLOBAL g, FILE *f, uint n)
+void VALUE::Printf(PGLOBAL g, FILE *f, uint n)
{
char m[64], buf[64];
@@ -571,14 +571,14 @@ void VALUE::Print(PGLOBAL g, FILE *f, uint n)
if (Null)
fprintf(f, "%s<null>\n", m);
else
- fprintf(f, strcat(strcat(GetCharString(buf), "\n"), m));
+ fprintf(f, "%s%s%s", GetCharString(buf), "\n", m);
} /* end of Print */
/***********************************************************************/
/* Make string output of an object value. */
/***********************************************************************/
-void VALUE::Print(PGLOBAL g, char *ps, uint z)
+void VALUE::Prints(PGLOBAL g, char *ps, uint z)
{
char *p, buf[64];
@@ -1712,7 +1712,7 @@ bool TYPVAL<PSZ>::SetConstFormat(PGLOBAL, FORMAT& fmt)
/***********************************************************************/
/* Make string output of an object value. */
/***********************************************************************/
-void TYPVAL<PSZ>::Print(PGLOBAL g, char *ps, uint z)
+void TYPVAL<PSZ>::Prints(PGLOBAL g, char *ps, uint z)
{
if (Null)
strncpy(ps, "null", z);
diff --git a/storage/connect/value.h b/storage/connect/value.h
index cf6682f56f2..2754c761815 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -122,8 +122,8 @@ class DllExport VALUE : public BLOCK {
virtual bool IsEqual(PVAL vp, bool chktype) = 0;
virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
virtual bool FormatValue(PVAL vp, PCSZ fmt) = 0;
- virtual void Print(PGLOBAL g, FILE *, uint);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *, uint);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
/**
Set value from a non-aligned in-memory value in the machine byte order.
@@ -308,7 +308,7 @@ class DllExport TYPVAL<PSZ>: public VALUE {
virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op);
virtual bool FormatValue(PVAL vp, PCSZ fmt);
virtual bool SetConstFormat(PGLOBAL, FORMAT&);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
protected:
// Members
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index a34d2e1c847..3e4db8080ae 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -181,7 +181,7 @@ XXBASE::XXBASE(PTDBDOS tbxp, bool b) : CSORT(b),
/***********************************************************************/
/* Make file output of XINDEX contents. */
/***********************************************************************/
-void XXBASE::Print(PGLOBAL, FILE *f, uint n)
+void XXBASE::Printf(PGLOBAL, FILE *f, uint n)
{
char m[64];
@@ -193,7 +193,7 @@ void XXBASE::Print(PGLOBAL, FILE *f, uint n)
/***********************************************************************/
/* Make string output of XINDEX contents. */
/***********************************************************************/
-void XXBASE::Print(PGLOBAL, char *ps, uint z)
+void XXBASE::Prints(PGLOBAL, char *ps, uint z)
{
*ps = '\0';
strncat(ps, "Xindex", z);
diff --git a/storage/connect/xindex.h b/storage/connect/xindex.h
index 2d10d72722e..339d7e68b75 100644
--- a/storage/connect/xindex.h
+++ b/storage/connect/xindex.h
@@ -200,8 +200,8 @@ class DllExport XXBASE : public CSORT, public BLOCK {
void FreeIndex(void) {PlgDBfree(Index);}
// Methods
- virtual void Print(PGLOBAL g, FILE *f, uint n);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *f, uint n);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
virtual bool Init(PGLOBAL g) = 0;
virtual bool Make(PGLOBAL g, PIXDEF sxp) = 0;
#if defined(XMAP)
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index 8f0b76d2ddc..205edc12d0c 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -173,17 +173,17 @@ bool CONSTANT::Rephrase(PGLOBAL g, PSZ work)
/***********************************************************************/
/* Make file output of a constant object. */
/***********************************************************************/
-void CONSTANT::Print(PGLOBAL g, FILE *f, uint n)
+void CONSTANT::Printf(PGLOBAL g, FILE *f, uint n)
{
- Value->Print(g, f, n);
+ Value->Printf(g, f, n);
} /* end of Print */
/***********************************************************************/
/* Make string output of a constant object. */
/***********************************************************************/
-void CONSTANT::Print(PGLOBAL g, char *ps, uint z)
+void CONSTANT::Prints(PGLOBAL g, char *ps, uint z)
{
- Value->Print(g, ps, z);
+ Value->Prints(g, ps, z);
} /* end of Print */
/* -------------------------- Class STRING --------------------------- */
diff --git a/storage/connect/xobject.h b/storage/connect/xobject.h
index 204144182c8..bc5912d3054 100644
--- a/storage/connect/xobject.h
+++ b/storage/connect/xobject.h
@@ -112,8 +112,8 @@ class DllExport CONSTANT : public XOBJECT {
{return Value->SetConstFormat(g, fmt);}
void Convert(PGLOBAL g, int newtype);
void SetValue(PVAL vp) {Value = vp;}
- virtual void Print(PGLOBAL g, FILE *, uint);
- virtual void Print(PGLOBAL g, char *, uint);
+ virtual void Printf(PGLOBAL g, FILE *, uint);
+ virtual void Prints(PGLOBAL g, char *, uint);
}; // end of class CONSTANT
/***********************************************************************/
diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h
index 3da0c17bdfe..ebef7a2549a 100644
--- a/storage/connect/xtable.h
+++ b/storage/connect/xtable.h
@@ -109,8 +109,8 @@ class DllExport TDB: public BLOCK { // Table Descriptor Block.
virtual PTDB Copy(PTABS t);
virtual void PrintAM(FILE *f, char *m)
{fprintf(f, "%s AM(%d)\n", m, GetAmType());}
- virtual void Print(PGLOBAL g, FILE *f, uint n);
- virtual void Print(PGLOBAL g, char *ps, uint z);
+ virtual void Printf(PGLOBAL g, FILE *f, uint n);
+ virtual void Prints(PGLOBAL g, char *ps, uint z);
virtual PCSZ GetServer(void) = 0;
virtual int GetBadLines(void) {return 0;}
virtual CHARSET_INFO *data_charset(void);
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 16706ad73c0..7e0c61ff634 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1508,13 +1508,13 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
/* Don't assert in field::val() functions */
table->use_all_columns();
- if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
if (init_data_file())
DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR);
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/*
Local_saved_data_file_length is initialized during the lock phase.
Sometimes this is not getting executed before ::repair (e.g. for
@@ -1598,9 +1598,9 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_RETURN(my_errno ? my_errno : -1);
share->tina_write_opened= FALSE;
}
- if (mysql_file_close(data_file, MYF(0)) ||
- mysql_file_close(repair_file, MYF(0)) ||
- mysql_file_rename(csv_key_file_data,
+ mysql_file_close(data_file, MYF(0));
+ mysql_file_close(repair_file, MYF(0));
+ if (mysql_file_rename(csv_key_file_data,
repaired_fname, share->data_file_name, MYF(0)))
DBUG_RETURN(-1);
@@ -1722,13 +1722,14 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
DBUG_ENTER("ha_tina::check");
old_proc_info= thd_proc_info(thd, "Checking table");
- if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
- DBUG_RETURN(HA_ERR_OUT_OF_MEM);
/* position buffer to the start of the file */
if (init_data_file())
DBUG_RETURN(HA_ERR_CRASHED);
+ if (!(buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+
/*
Local_saved_data_file_length is initialized during the lock phase.
Check does not use store_lock in certain cases. So, we set it
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index bbb23c1db91..08a501a744c 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -4220,6 +4220,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
printf("Data records: %s\n", llstr(start_records, llbuff));
}
+ bzero(&new_data_cache, sizeof(new_data_cache));
if (initialize_variables_for_repair(param, &sort_info, &tmp_sort_param, info,
rep_quick, &backup_share))
goto err;
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 86e51cc3526..e143ed793e4 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -946,6 +946,7 @@ static File create_logfile_by_number_no_cache(uint32 file_no)
{
DBUG_PRINT("error", ("Error %d during syncing directory '%s'",
errno, log_descriptor.directory));
+ mysql_file_close(file, MYF(0));
translog_stop_writing();
DBUG_RETURN(-1);
}
@@ -1447,17 +1448,16 @@ LSN translog_get_file_max_lsn_stored(uint32 file)
if (translog_read_file_header(&info, fd))
{
DBUG_PRINT("error", ("Can't read file header"));
- DBUG_RETURN(LSN_ERROR);
+ info.max_lsn= LSN_ERROR;
}
if (mysql_file_close(fd, MYF(MY_WME)))
{
DBUG_PRINT("error", ("Can't close file"));
- DBUG_RETURN(LSN_ERROR);
+ info.max_lsn= LSN_ERROR;
}
- DBUG_PRINT("info", ("Max lsn: (%lu,0x%lx)",
- LSN_IN_PARTS(info.max_lsn)));
+ DBUG_PRINT("info", ("Max lsn: (%lu,0x%lx)", LSN_IN_PARTS(info.max_lsn)));
DBUG_RETURN(info.max_lsn);
}
}
@@ -1621,13 +1621,15 @@ static my_bool translog_create_new_file()
if (allocate_dynamic(&log_descriptor.open_files,
log_descriptor.max_file - log_descriptor.min_file + 2))
goto error_lock;
- if ((file->handler.file=
- create_logfile_by_number_no_cache(file_no)) == -1)
+
+ /* this call just expand the array */
+ if (insert_dynamic(&log_descriptor.open_files, (uchar*)&file))
+ goto error_lock;
+
+ if ((file->handler.file= create_logfile_by_number_no_cache(file_no)) == -1)
goto error_lock;
translog_file_init(file, file_no, 0);
- /* this call just expand the array */
- insert_dynamic(&log_descriptor.open_files, (uchar*)&file);
log_descriptor.max_file++;
{
char *start= (char*) dynamic_element(&log_descriptor.open_files, 0,
@@ -1661,6 +1663,7 @@ error_lock:
mysql_rwlock_unlock(&log_descriptor.open_files_lock);
error:
translog_stop_writing();
+ my_free(file);
DBUG_RETURN(1);
}
@@ -3962,11 +3965,14 @@ my_bool translog_init_with_table(const char *directory,
/* Start new log system from scratch */
log_descriptor.horizon= MAKE_LSN(start_file_num,
TRANSLOG_PAGE_SIZE); /* header page */
- if ((file->handler.file=
- create_logfile_by_number_no_cache(start_file_num)) == -1)
- goto err;
translog_file_init(file, start_file_num, 0);
if (insert_dynamic(&log_descriptor.open_files, (uchar*)&file))
+ {
+ my_free(file);
+ goto err;
+ }
+ if ((file->handler.file=
+ create_logfile_by_number_no_cache(start_file_num)) == -1)
goto err;
log_descriptor.min_file= log_descriptor.max_file= start_file_num;
if (translog_write_file_header())
@@ -7789,8 +7795,24 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
translog_force_current_buffer_to_finish();
translog_buffer_unlock(buffer);
}
- else if (log_descriptor.bc.buffer->prev_last_lsn != LSN_IMPOSSIBLE)
+ else
{
+ if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE)
+ {
+ /*
+ In this case both last_lsn & prev_last_lsn are LSN_IMPOSSIBLE
+ otherwise it will go in the first IF because LSN_IMPOSSIBLE less
+ then any real LSN and cmp_translog_addr(*lsn,
+ log_descriptor.bc.buffer->prev_last_lsn) will be TRUE
+ */
+ DBUG_ASSERT(log_descriptor.bc.buffer->prev_last_lsn ==
+ LSN_IMPOSSIBLE);
+ DBUG_PRINT("info", ("There is no LSNs yet generated => do nothing"));
+ translog_unlock();
+ DBUG_VOID_RETURN;
+ }
+
+ DBUG_ASSERT(log_descriptor.bc.buffer->prev_last_lsn != LSN_IMPOSSIBLE);
/* fix lsn if it was horizon */
*lsn= log_descriptor.bc.buffer->prev_last_lsn;
DBUG_PRINT("info", ("LSN to flush fixed to prev last lsn: (%lu,0x%lx)",
@@ -7799,13 +7821,6 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
TRANSLOG_BUFFERS_NO);
translog_unlock();
}
- else if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE)
- {
- DBUG_PRINT("info", ("There is no LSNs yet generated => do nothing"));
- translog_unlock();
- DBUG_VOID_RETURN;
- }
-
/* flush buffers */
*sent_to_disk= translog_get_sent_to_disk();
if (cmp_translog_addr(*lsn, *sent_to_disk) > 0)
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index 5243d55428c..861023a0064 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -1445,7 +1445,7 @@ uint _ma_pack_get_block_info(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
maria->blob_length=info->blob_len;
}
info->filepos=filepos+head_length;
- if (file > 0)
+ if (file >= 0)
{
info->offset=MY_MIN(info->rec_len, ref_length - head_length);
memcpy(*rec_buff_p, header + head_length, info->offset);
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 9f142cb61c9..d0e0210db64 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -1988,7 +1988,7 @@ prototype_redo_exec_hook(UNDO_KEY_INSERT)
const HA_KEYSEG *keyseg= info->s->keyinfo[keynr].seg;
ulonglong value;
char llbuf[22];
- uchar *to;
+ uchar reversed[MARIA_MAX_KEY_BUFF], *to;
tprint(tracef, " state older than record\n");
/* we read the record to find the auto_increment value */
enlarge_buffer(rec);
@@ -2005,7 +2005,6 @@ prototype_redo_exec_hook(UNDO_KEY_INSERT)
if (keyseg->flag & HA_SWAP_KEY)
{
/* We put key from log record to "data record" packing format... */
- uchar reversed[MARIA_MAX_KEY_BUFF];
uchar *key_ptr= to;
uchar *key_end= key_ptr + keyseg->length;
to= reversed + keyseg->length;
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index e363fb1da2b..4427db79da1 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1248,6 +1248,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
{
KEY_CACHE *new_key_cache= check_opt->key_cache;
const char *errmsg= 0;
+ char buf[STRING_BUFFER_USUAL_SIZE];
int error= HA_ADMIN_OK;
ulonglong map;
TABLE_LIST *table_list= table->pos_in_table_list;
@@ -1264,7 +1265,6 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
if ((error= mi_assign_to_key_cache(file, map, new_key_cache)))
{
- char buf[STRING_BUFFER_USUAL_SIZE];
my_snprintf(buf, sizeof(buf),
"Failed to flush to index file (errno: %d)", error);
errmsg= buf;
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 354fb0a8e04..a82f2b9e8c1 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -151,7 +151,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
share->mode=open_mode;
errpos=1;
- if (mysql_file_read(kfile, share->state.header.file_version, head_length,
+ if (mysql_file_read(kfile, (uchar*)&share->state.header, head_length,
MYF(MY_NABP)))
{
my_errno= HA_ERR_NOT_A_TABLE;
diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc
index c66dcc3824a..71b97b770e1 100644
--- a/storage/xtradb/buf/buf0dump.cc
+++ b/storage/xtradb/buf/buf0dump.cc
@@ -612,6 +612,7 @@ buf_load()
if (dump_n == 0) {
ut_free(dump);
+ ut_free(dump_tmp);
ut_sprintf_timestamp(now);
buf_load_status(STATUS_NOTICE,
"Buffer pool(s) load completed at %s "
diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc
index fa7177c5137..125d7d78a1f 100644
--- a/storage/xtradb/dict/dict0mem.cc
+++ b/storage/xtradb/dict/dict0mem.cc
@@ -320,8 +320,8 @@ dict_mem_table_col_rename_low(
ut_ad(from_len <= NAME_LEN);
ut_ad(to_len <= NAME_LEN);
- char from[NAME_LEN];
- strncpy(from, s, NAME_LEN);
+ char from[NAME_LEN + 1];
+ strncpy(from, s, NAME_LEN + 1);
if (from_len == to_len) {
/* The easy case: simply replace the column name in
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index cdd3497b895..f4576dac03a 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -3487,13 +3487,13 @@ innobase_convert_identifier(
ibool file_id)/*!< in: TRUE=id is a table or database name;
FALSE=id is an UTF-8 string */
{
+ char nz2[MAX_TABLE_NAME_LEN + 1];
const char* s = id;
int q;
if (file_id) {
char nz[MAX_TABLE_NAME_LEN + 1];
- char nz2[MAX_TABLE_NAME_LEN + 1];
/* Decode the table name. The MySQL function expects
a NUL-terminated string. The input and output strings
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index b00003147dd..27382977e5c 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -1444,6 +1444,7 @@ log_online_setup_bitmap_file_range(
if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
log_online_diagnose_inconsistent_dir(bitmap_files);
+ os_file_closedir(bitmap_dir);
return FALSE;
}
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index d04149dd243..5d483e1d374 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -2590,7 +2590,8 @@ purge_archived_logs(
if (dirnamelen + strlen(fileinfo.name) + 2 > OS_FILE_MAX_PATH)
continue;
- snprintf(archived_log_filename + dirnamelen, OS_FILE_MAX_PATH,
+ snprintf(archived_log_filename + dirnamelen,
+ OS_FILE_MAX_PATH - dirnamelen - 1,
"%s", fileinfo.name);
if (before_no) {
diff --git a/strings/ctype.c b/strings/ctype.c
index 620c7e13503..4af60d16d29 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -750,7 +750,7 @@ static int cs_value(MY_XML_PARSER *st,const char *attr, size_t len)
/* Rules: Context */
case _CS_CONTEXT:
- if (len < sizeof(i->context) + 1)
+ if (len < sizeof(i->context))
{
memcpy(i->context, attr, len);
i->context[len]= '\0';
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 0eb8aef95c4..c367e7ca35d 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1082,6 +1082,7 @@ static void test_wl4435_2()
\
rs_metadata= mysql_stmt_result_metadata(ps); \
fields= mysql_fetch_fields(rs_metadata); \
+ mysql_free_result(rs_metadata); \
\
rc= mysql_stmt_bind_result(ps, &psp); \
check_execute(ps, rc); \
diff --git a/unittest/mysys/ma_dyncol-t.c b/unittest/mysys/ma_dyncol-t.c
index b3fff638b65..3b43c10a6a8 100644
--- a/unittest/mysys/ma_dyncol-t.c
+++ b/unittest/mysys/ma_dyncol-t.c
@@ -687,6 +687,9 @@ void test_update_many(uint *column_numbers, uint *column_values,
err:
ok(rc, "%s", "update_many");
/* cleanup */
+ free(val);
+ free(upd);
+ free(res);
mariadb_dyncol_free(&str1);
mariadb_dyncol_free(&str2);
}