summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--Makefile.am4
-rw-r--r--client/sql_string.cc2
-rw-r--r--client/sql_string.h2
-rw-r--r--include/my_global.h5
-rw-r--r--include/my_sys.h1
-rw-r--r--innobase/row/row0mysql.c5
-rw-r--r--mysql-test/mysql-test-run.sh4
-rw-r--r--mysql-test/r/federated.result95
-rw-r--r--mysql-test/r/rpl_log.result4
-rw-r--r--mysql-test/r/rpl_rotate_logs.result10
-rw-r--r--mysql-test/r/skip_grants.result (renamed from mysql-test/r/view_skip_grants.result)4
-rw-r--r--mysql-test/r/union.result14
-rw-r--r--mysql-test/t/federated.test65
-rw-r--r--mysql-test/t/skip_grants-master.opt (renamed from mysql-test/t/view_skip_grants-master.opt)0
-rw-r--r--mysql-test/t/skip_grants.test (renamed from mysql-test/t/view_skip_grants.test)10
-rw-r--r--mysql-test/t/union.test10
-rw-r--r--mysys/my_access.c120
-rw-r--r--mysys/my_fopen.c11
-rw-r--r--mysys/my_open.c13
-rw-r--r--mysys/raid.cc2
-rw-r--r--ndb/src/kernel/blocks/dbtux/Dbtux.hpp1
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_berkeley.cc2
-rw-r--r--sql/ha_blackhole.cc2
-rw-r--r--sql/ha_federated.cc6
-rw-r--r--sql/ha_heap.cc2
-rw-r--r--sql/ha_innodb.cc18
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/ha_myisammrg.cc2
-rw-r--r--sql/ha_ndbcluster.cc2
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/hash_filo.cc2
-rw-r--r--sql/hash_filo.h2
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_geofunc.cc2
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_subselect.cc2
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/item_uniq.cc2
-rw-r--r--sql/item_uniq.h2
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/log_event.h2
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/opt_range.cc2
-rw-r--r--sql/procedure.cc2
-rw-r--r--sql/protocol.cc2
-rw-r--r--sql/protocol_cursor.cc2
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sp_cache.cc2
-rw-r--r--sql/sp_cache.h2
-rw-r--r--sql/sp_head.cc8
-rw-r--r--sql/sp_head.h9
-rw-r--r--sql/sp_pcontext.cc2
-rw-r--r--sql/sp_pcontext.h2
-rw-r--r--sql/sp_rcontext.cc2
-rw-r--r--sql/sp_rcontext.h2
-rw-r--r--sql/sql_analyse.cc2
-rw-r--r--sql/sql_analyse.h2
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_crypt.cc2
-rw-r--r--sql/sql_crypt.h2
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_list.cc2
-rw-r--r--sql/sql_map.cc2
-rw-r--r--sql/sql_map.h2
-rw-r--r--sql/sql_olap.cc2
-rw-r--r--sql/sql_parse.cc13
-rw-r--r--sql/sql_repl.cc33
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_udf.cc2
-rw-r--r--sql/sql_yacc.yy13
-rw-r--r--sql/tztime.cc2
-rw-r--r--tests/mysql_client_test.c26
79 files changed, 450 insertions, 158 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index d8d16aaa1d8..3230f3c119f 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -205,6 +205,7 @@ patg@krsna.
patg@krsna.patg.net
patg@patrick-galbraiths-computer.local
patg@pc248.lfp.kcls.org
+patg@radha.local
paul@central.snake.net
paul@frost.snake.net
paul@ice.local
diff --git a/Makefile.am b/Makefile.am
index eec27484710..b5ebe8eb8ae 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -104,8 +104,8 @@ test:
test-force:
cd mysql-test; \
- mysql-test-run --force ;\
- mysql-test-run --ps-protocol --force
+ ./mysql-test-run --force ;\
+ ./mysql-test-run --ps-protocol --force
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/client/sql_string.cc b/client/sql_string.cc
index 0424723d97f..51f802e7465 100644
--- a/client/sql_string.cc
+++ b/client/sql_string.cc
@@ -16,7 +16,7 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/client/sql_string.h b/client/sql_string.h
index 2debeb61787..242b31e7ed6 100644
--- a/client/sql_string.h
+++ b/client/sql_string.h
@@ -16,7 +16,7 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/include/my_global.h b/include/my_global.h
index 98a47a621ca..b4dfb5b7f7d 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -48,6 +48,11 @@
#define USE_PRAGMA_INTERFACE
#endif
+/* Determine when to use "#pragma implementation" */
+#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
+#define USE_PRAGMA_IMPLEMENTATION
+#endif
+
#if defined(i386) && !defined(__i386__)
#define __i386__
#endif
diff --git a/include/my_sys.h b/include/my_sys.h
index 10358470c77..62affb31740 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -605,6 +605,7 @@ extern int my_access(const char *path, int amode);
#else
#define my_access access
#endif
+extern int check_if_legal_filename(const char *path);
#ifndef TERMINATE
extern void TERMINATE(FILE *file);
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index fd720046e31..fafbef4c999 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -3151,6 +3151,7 @@ row_drop_table_for_mysql(
foreign = UT_LIST_GET_FIRST(table->referenced_list);
while (foreign && foreign->foreign_table == table) {
+ check_next_foreign:
foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
}
@@ -3179,6 +3180,10 @@ row_drop_table_for_mysql(
goto funct_exit;
}
+ if (foreign && trx->check_foreigns) {
+ goto check_next_foreign;
+ }
+
if (table->n_mysql_handles_opened > 0) {
ibool added;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index cd1e634a831..45b1e948ac2 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -1212,8 +1212,8 @@ start_master()
$NOT_FIRST_MASTER_EXTRA_OPTS"
fi
- CUR_MYERR=$MASTER_MYERR
- CUR_MYSOCK=$MASTER_MYSOCK
+ CUR_MYERR=$MASTER_MYERR$1
+ CUR_MYSOCK=$MASTER_MYSOCK$1
# For embedded server we collect the server flags and return
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result
index 6c815e94b7c..d9c86a89c75 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/r/federated.result
@@ -906,9 +906,100 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1, federated.countries WHERE
+federated.t1.country_id = federated.countries.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
+SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1, federated.countries WHERE
+federated.t1.country_id = federated.countries.id;
+name country_id other country
+Kumar 1 11111 India
+Lenz 2 22222 Germany
+Marizio 3 33333 Italy
+Monty 4 33333 Finland
+Sanja 5 33333 Ukraine
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
+SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id;
+name country_id other country
+Kumar 1 11111 India
+Lenz 2 22222 Germany
+Marizio 3 33333 Italy
+Monty 4 33333 Finland
+Sanja 5 33333 Ukraine
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id
+WHERE federated.t1.name = 'Monty';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL PRIMARY NULL NULL NULL 5
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120 Using where
+SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id
+WHERE federated.t1.name = 'Monty';
+name country_id other country
+Monty 4 33333 Finland
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort
+1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1
+SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.id;
+id country_id name other country
+1 1 Kumar 11111 India
+2 2 Lenz 22222 Germany
+3 3 Marizio 33333 Italy
+4 4 Monty 33333 Finland
+5 5 Sanja 33333 Ukraine
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.country;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 Using temporary; Using filesort
+1 SIMPLE countries eq_ref PRIMARY PRIMARY 4 federated.t1.country_id 1
+SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.country;
+id country_id name other country
+4 4 Monty 33333 Finland
+2 2 Lenz 22222 Germany
+1 1 Kumar 11111 India
+3 3 Marizio 33333 Italy
+5 5 Sanja 33333 Ukraine
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 RIGHT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.t1.country_id;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE countries ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
+1 SIMPLE t1 ref country_id country_id 4 federated.countries.id 120
SELECT federated.t1.*, federated.countries.country
-FROM federated.t1 left join federated.countries
-ON federated.t1.country_id = federated.countries.id;
+FROM federated.t1 RIGHT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.t1.country_id;
id country_id name other country
1 1 Kumar 11111 India
2 2 Lenz 22222 Germany
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index e150cf53585..5e0eec6305d 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -71,15 +71,11 @@ show binary logs;
Log_name File_size
master-bin.000001 0
master-bin.000002 510
-Warnings:
-Error 29 File 'master-bin.000001' not found (Errcode: 2)
start slave;
show binary logs;
Log_name File_size
slave-bin.000001 0
slave-bin.000002 348
-Warnings:
-Error 29 File 'slave-bin.000001' not found (Errcode: 2)
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 4 Format_desc 2 98 Server ver: VERSION, Binlog ver: 4
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index b9724386909..a6d3697987a 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -30,9 +30,6 @@ Log_name File_size
master-bin.000001 0
master-bin.000002 0
master-bin.000003 98
-Warnings:
-Error 29 File 'master-bin.000001' not found (Errcode: 2)
-Error 29 File 'master-bin.000002' not found (Errcode: 2)
create table t3 select * from temp_table;
select * from t3;
a
@@ -48,15 +45,11 @@ show master logs;
Log_name File_size
master-bin.000002 0
master-bin.000003 407
-Warnings:
-Error 29 File 'master-bin.000002' not found (Errcode: 2)
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name File_size
master-bin.000002 0
master-bin.000003 407
-Warnings:
-Error 29 File 'master-bin.000002' not found (Errcode: 2)
purge master logs before now();
show binary logs;
Log_name File_size
@@ -84,9 +77,6 @@ Log_name File_size
master-bin.000003 0
master-bin.000004 0
master-bin.000005 2032
-Warnings:
-Error 29 File 'master-bin.000003' not found (Errcode: 2)
-Error 29 File 'master-bin.000004' not found (Errcode: 2)
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000005 2032
diff --git a/mysql-test/r/view_skip_grants.result b/mysql-test/r/skip_grants.result
index 48cb9f2aa25..c0c20eb25be 100644
--- a/mysql-test/r/view_skip_grants.result
+++ b/mysql-test/r/skip_grants.result
@@ -1,6 +1,10 @@
drop table if exists t1,v1;
drop view if exists t1,v1;
+drop procedure if exists f1;
use test;
create table t1 (field1 INT);
CREATE VIEW v1 AS SELECT field1 FROM t1;
drop view v1;
+drop table t1;
+create procedure f1() select 1;
+drop procedure f1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index daa0a428577..1f45d238ea5 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1252,6 +1252,20 @@ t2 CREATE TABLE `t2` (
`a` varchar(12) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
drop table t1,t2;
+CREATE TABLE t1 (a mediumtext);
+CREATE TABLE t2 (b varchar(20));
+INSERT INTO t1 VALUES ('a'),('b');
+SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+left(a,100000000)
+a
+b
+create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `left(a,100000000)` longtext
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t1,t2,t3;
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
insert into t1 (col1) values (2),(3),(4),(5),(6);
select 99 union all select id from t1 order by 1;
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index 6a0e0bdac79..1e33efe1c0e 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -861,9 +861,70 @@ INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
+#inner join
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1, federated.countries WHERE
+federated.t1.country_id = federated.countries.id;
+
+SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1, federated.countries WHERE
+federated.t1.country_id = federated.countries.id;
+
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id;
+
+SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id;
+
+EXPLAIN SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id
+WHERE federated.t1.name = 'Monty';
+
+SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
+federated.t1.other AS other, federated.countries.country AS country
+FROM federated.t1 INNER JOIN federated.countries ON
+federated.t1.country_id = federated.countries.id
+WHERE federated.t1.name = 'Monty';
+
+#left join
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.id;
+
+SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.id;
+
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.country;
+
+SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 LEFT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.countries.country;
+
+#right join
+EXPLAIN SELECT federated.t1.*, federated.countries.country
+FROM federated.t1 RIGHT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.t1.country_id;
+
SELECT federated.t1.*, federated.countries.country
-FROM federated.t1 left join federated.countries
-ON federated.t1.country_id = federated.countries.id;
+FROM federated.t1 RIGHT JOIN federated.countries
+ON federated.t1.country_id = federated.countries.id
+ORDER BY federated.t1.country_id;
DROP TABLE federated.countries;
diff --git a/mysql-test/t/view_skip_grants-master.opt b/mysql-test/t/skip_grants-master.opt
index 5699a3387b8..5699a3387b8 100644
--- a/mysql-test/t/view_skip_grants-master.opt
+++ b/mysql-test/t/skip_grants-master.opt
diff --git a/mysql-test/t/view_skip_grants.test b/mysql-test/t/skip_grants.test
index bfbaec44eb1..99223fa4756 100644
--- a/mysql-test/t/view_skip_grants.test
+++ b/mysql-test/t/skip_grants.test
@@ -1,6 +1,7 @@
--disable_warnings
drop table if exists t1,v1;
drop view if exists t1,v1;
+drop procedure if exists f1;
--enable_warnings
use test;
@@ -11,4 +12,11 @@ create table t1 (field1 INT);
CREATE VIEW v1 AS SELECT field1 FROM t1;
drop view v1;
-drop table t1
+drop table t1;
+
+#
+# Test that we can create and drop procedure without warnings
+# see bug#9993
+#
+create procedure f1() select 1;
+drop procedure f1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index af548074aa9..4da19622dcb 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -773,6 +773,16 @@ alter table t2 ROW_FORMAT=fixed;
show create table t2;
drop table t1,t2;
+#
+# correct conversion long string to TEXT (BUG#10025)
+#
+CREATE TABLE t1 (a mediumtext);
+CREATE TABLE t2 (b varchar(20));
+INSERT INTO t1 VALUES ('a'),('b');
+SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
+show create table t3;
+drop tables t1,t2,t3;
#
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
diff --git a/mysys/my_access.c b/mysys/my_access.c
index 6a8887e42a6..28210bdfc7d 100644
--- a/mysys/my_access.c
+++ b/mysys/my_access.c
@@ -15,39 +15,107 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysys_priv.h"
+#include <m_string.h>
#ifdef __WIN__
/*
- * Check a file or path for accessability.
- *
- * SYNOPSIS
- * file_access()
- * pathpath to check
- * amodemode to check
- *
- * DESCRIPTION
- * This function wraps the normal access method because the access
- * available in MSVCRT> +reports that filenames such as LPT1 and
- * COM1 are valid (they are but should not be so for us).
- *
- * RETURN VALUES
- * 0 ok
- * -1 error
- */
+ Check a file or path for accessability.
+
+ SYNOPSIS
+ file_access()
+ path Path to file
+ amode Access method
+
+ DESCRIPTION
+ This function wraps the normal access method because the access
+ available in MSVCRT> +reports that filenames such as LPT1 and
+ COM1 are valid (they are but should not be so for us).
+
+ RETURN VALUES
+ 0 ok
+ -1 error (We use -1 as my_access is mapped to access on other platforms)
+*/
+
int my_access(const char *path, int amode)
{
- WIN32_FILE_ATTRIBUTE_DATA fileinfo;
- BOOL result;
+ WIN32_FILE_ATTRIBUTE_DATA fileinfo;
+ BOOL result;
- result = GetFileAttributesEx(path, GetFileExInfoStandard,
- &fileinfo);
- if (! result)
- return -1;
- if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) &&
- (amode & 2))
- return -1;
- return 0;
+ result= GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo);
+ if (! result ||
+ (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && (amode & W_OK))
+ {
+ my_errno= errno= EACCES;
+ return -1;
+ }
+ return 0;
}
+#endif /* __WIN__ */
+
+#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
+
+/*
+ List of file names that causes problem on windows
+
+ NOTE that one can also not have file names of type CON.TXT
+*/
+
+static const char *reserved_names[]=
+{
+ "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6",
+ "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6",
+ "LPT7", "LPT8", "LPT9", "CLOCK$",
+ NullS
+};
+
+#define MAX_RESERVED_NAME_LENGTH 6
+
+/*
+ Check if a path will access a reserverd file name that may cause problems
+
+ SYNOPSIS
+ check_if_legal_filename
+ path Path to file
+
+ RETURN
+ 0 ok
+ 1 reserved file name
+*/
+
+int check_if_legal_filename(const char *path)
+{
+ const char *end;
+ const char **reserved_name;
+ DBUG_ENTER("check_if_legal_filename");
+
+ path+= dirname_length(path); /* To start of filename */
+ if (!(end= strchr(path, FN_EXTCHAR)))
+ end= strend(path);
+ if (path == end || (uint) (path - end) > MAX_RESERVED_NAME_LENGTH)
+ DBUG_RETURN(0); /* Simplify inner loop */
+
+ for (reserved_name= reserved_names; *reserved_name; reserved_name++)
+ {
+ const char *name= path;
+ while (name != end)
+ {
+ if (my_toupper(&my_charset_latin1, *path) !=
+ my_toupper(&my_charset_latin1, *name))
+ break;
+ if (name++ == end)
+ DBUG_RETURN(1); /* Found wrong path */
+ }
+ }
+ DBUG_RETURN(0);
+}
#endif
+
+
+#ifdef OS2
+int check_if_legal_filename(const char *path)
+{
+ return 0;
+}
+#endif /* OS2 */
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 4310250bd0d..3c6f1b15384 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -39,13 +39,16 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
very well
*/
#ifdef __WIN__
- if (! (Flags & O_CREAT) && my_access(FileName, F_OK))
- fd=0;
+ if (check_if_legal_filename(FileName))
+ {
+ errno= EACCES;
+ fd= 0;
+ }
else
#endif
{
- make_ftype(type,Flags);
- fd = fopen(FileName, type);
+ make_ftype(type,Flags);
+ fd = fopen(FileName, type);
}
if (fd != 0)
diff --git a/mysys/my_open.c b/mysys/my_open.c
index 7fc5282838f..69d63c49554 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -47,12 +47,15 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
FileName, Flags, MyFlags));
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
/*
- if we are not creating, then we need to use my_access to make
- sure the file exists since Windows doesn't handle files like
- "com1.sym" very well
+ Check that we don't try to open or create a file name that may
+ cause problems for us in the future (like PRN)
*/
- if (! (Flags & O_CREAT) && my_access(FileName, F_OK))
- return -1;
+ if (check_if_legal_filename(FileName))
+ {
+ errno= EACCES;
+ DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN,
+ EE_FILENOTFOUND, MyFlags));
+ }
if (Flags & O_SHARE)
fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
MY_S_IREAD | MY_S_IWRITE);
diff --git a/mysys/raid.cc b/mysys/raid.cc
index 1d2e0cb01f0..29819a878c4 100644
--- a/mysys/raid.cc
+++ b/mysys/raid.cc
@@ -70,7 +70,7 @@
tonu@mysql.com & monty@mysql.com
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
index 5c12472a0f7..d4a44b9e641 100644
--- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
+++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp
@@ -342,7 +342,6 @@ private:
* Complete metadata for one index. The array of attributes has
* variable size.
*/
- struct DescEnt;
friend struct DescEnt;
struct DescEnt {
DescHead m_descHead;
diff --git a/sql/field.cc b/sql/field.cc
index 54ed4044de5..0c7fed99493 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -19,7 +19,7 @@
** This file implements classes defined in field.h
*****************************************************************************/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 725674946ee..5942973c732 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -47,7 +47,7 @@
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc
index dcc542a7247..6a841801487 100644
--- a/sql/ha_blackhole.cc
+++ b/sql/ha_blackhole.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 8cb6dcb7285..c76034c7986 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -1526,6 +1526,12 @@ int ha_federated::index_read_idx(byte *buf, uint index, const byte *key,
table->status= STATUS_NOT_FOUND;
DBUG_RETURN(mysql_errno(mysql));
}
+ /*
+ This basically says that the record in table->record[0] is legal, and that it is
+ ok to use this record, for whatever reason, such as with a join (without it, joins
+ will not work)
+ */
+ table->status=0;
DBUG_RETURN(rnd_next(buf));
}
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index e3212b095cf..cd655eeb0a9 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 381c9c28a79..7f454f43ae5 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -27,7 +27,7 @@ have disables the InnoDB inlining in this file. */
in Windows?
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
@@ -5764,7 +5764,12 @@ MySQL calls this function at the start of each SQL statement inside LOCK
TABLES. Inside LOCK TABLES the ::external_lock method does not work to
mark SQL statement borders. Note also a special case: if a temporary table
is created inside LOCK TABLES, MySQL has not called external_lock() at all
-on that table. */
+on that table.
+MySQL-5.0 also calls this before each statement in an execution of a stored
+procedure. To make the execution more deterministic for binlogging, MySQL-5.0
+locks all tables involved in a stored procedure with full explicit table
+locks (thd->in_lock_tables is true in ::store_lock()) before executing the
+procedure. */
int
ha_innobase::start_stmt(
@@ -6443,10 +6448,8 @@ ha_innobase::store_lock(
if (srv_locks_unsafe_for_binlog &&
prebuilt->trx->isolation_level != TRX_ISO_SERIALIZABLE &&
(lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) &&
- thd->lex->sql_command != SQLCOM_SELECT &&
- thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
- thd->lex->sql_command != SQLCOM_DELETE_MULTI &&
- thd->lex->sql_command != SQLCOM_LOCK_TABLES) {
+ (thd->lex->sql_command == SQLCOM_INSERT_SELECT ||
+ thd->lex->sql_command == SQLCOM_UPDATE)) {
/* In case we have innobase_locks_unsafe_for_binlog
option set and isolation level of the transaction
@@ -6479,7 +6482,8 @@ ha_innobase::store_lock(
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT &&
lock_type <= TL_WRITE) && !thd->in_lock_tables
&& !thd->tablespace_op
- && thd->lex->sql_command != SQLCOM_TRUNCATE) {
+ && thd->lex->sql_command != SQLCOM_TRUNCATE
+ && thd->lex->sql_command != SQLCOM_CREATE_TABLE) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 2049efb73db..1352fd84d9d 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index f7c0abf9810..0796ded3ac0 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 6ccaa668df9..208c97ccd7f 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -20,7 +20,7 @@
NDB Cluster
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/handler.cc b/sql/handler.cc
index b2ab2003165..965c3d26f49 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -17,7 +17,7 @@
/* Handler-calling-functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/hash_filo.cc b/sql/hash_filo.cc
index b85f8054f10..ec200768222 100644
--- a/sql/hash_filo.cc
+++ b/sql/hash_filo.cc
@@ -20,7 +20,7 @@
** to usage.
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/hash_filo.h b/sql/hash_filo.h
index d1672e1a60c..fc48c3b1540 100644
--- a/sql/hash_filo.h
+++ b/sql/hash_filo.h
@@ -23,7 +23,7 @@
#ifndef HASH_FILO_H
#define HASH_FILO_H
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class interface */
#endif
diff --git a/sql/item.cc b/sql/item.cc
index 77ea7b85ab0..bf62aa1ddad 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 89897a9d74f..8761f8076ca 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -17,7 +17,7 @@
/* This file defines all compare functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_func.cc b/sql/item_func.cc
index db2aa735b0e..72a4dff74e5 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -17,7 +17,7 @@
/* This file defines all numerical functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index b9f2ec8a6ca..e2b0eb5ce07 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -17,7 +17,7 @@
/* This file defines all spatial functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 857140dba8f..e870fe5aa43 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -20,7 +20,7 @@
** (This shouldn't be needed)
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 0fbcf32a83c..29c52e73159 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -22,7 +22,7 @@ SUBSELECT TODO:
(sql_select.h/sql_select.cc)
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 85abb09531b..b9f3cc49d64 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -17,7 +17,7 @@
/* Sum functions (COUNT, MIN...) */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 7a9c7898856..3b6ca48fadd 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -17,7 +17,7 @@
/* This file defines all time functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/item_uniq.cc b/sql/item_uniq.cc
index c1a19d71d04..8734e671817 100644
--- a/sql/item_uniq.cc
+++ b/sql/item_uniq.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Compability file */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
diff --git a/sql/item_uniq.h b/sql/item_uniq.h
index 602474f7581..14b2e8d53bb 100644
--- a/sql/item_uniq.h
+++ b/sql/item_uniq.h
@@ -16,7 +16,7 @@
/* Compability file ; This file only contains dummy functions */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface
#endif
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 42134d2b990..e9897607800 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -16,7 +16,7 @@
#ifndef MYSQL_CLIENT
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
diff --git a/sql/log_event.h b/sql/log_event.h
index f8989c4994a..b163a37e7cc 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -22,7 +22,7 @@
#undef write // remove pthread.h macro definition, conflict with write() class member
#endif
-#if defined(__GNUC__) && !defined(MYSQL_CLIENT)
+#if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT)
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index b333660059e..0675bce636d 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1102,7 +1102,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
-extern my_bool sp_automatic_privileges;
+extern my_bool sp_automatic_privileges, opt_noacl;
extern my_bool opt_old_style_user_limits, trust_routine_creators;
extern uint opt_crash_binlog_innodb;
extern char *shared_memory_base_name, *mysqld_unix_port;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5254214c992..3843ad04a02 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -336,6 +336,7 @@ my_bool opt_old_style_user_limits= 0, trust_routine_creators= 0;
changed). False otherwise.
*/
volatile bool mqh_used = 0;
+my_bool opt_noacl;
my_bool sp_automatic_privileges= 1;
#ifdef HAVE_INITGROUPS
@@ -459,7 +460,7 @@ char *master_ssl_ca, *master_ssl_capath, *master_ssl_cipher;
/* Static variables */
static bool kill_in_progress, segfaulted;
-static my_bool opt_do_pstack, opt_noacl, opt_bootstrap, opt_myisam_log;
+static my_bool opt_do_pstack, opt_bootstrap, opt_myisam_log;
static int cleanup_done;
static ulong opt_specialflag, opt_myisam_block_size;
static char *opt_logname, *opt_update_logname, *opt_binlog_index_name;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0aa0468fc36..5718ab5e010 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -36,7 +36,7 @@
QUICK_RANGEs are also created in this step.
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/procedure.cc b/sql/procedure.cc
index a31b93da358..554e2cd0565 100644
--- a/sql/procedure.cc
+++ b/sql/procedure.cc
@@ -17,7 +17,7 @@
/* Procedures (functions with changes output of select) */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 9a96da004c5..57922cdc677 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -19,7 +19,7 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc
index 5ac03c4d427..ed2d0b583d0 100644
--- a/sql/protocol_cursor.cc
+++ b/sql/protocol_cursor.cc
@@ -19,7 +19,7 @@
The actual communction is handled by the net_xxx functions in net_serv.cc
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/set_var.cc b/sql/set_var.cc
index b8059779a2a..106fced8e88 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -48,7 +48,7 @@
new attribute.
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index 056ac6d7e96..83811e76f9b 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
diff --git a/sql/sp_cache.h b/sql/sp_cache.h
index 754a987090e..e9efe5b2a8c 100644
--- a/sql/sp_cache.h
+++ b/sql/sp_cache.h
@@ -18,7 +18,7 @@
#ifndef _SP_CACHE_H_
#define _SP_CACHE_H_
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 988345694b2..217bcc0b728 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
@@ -1499,8 +1499,8 @@ sp_instr_set_trigger_field::execute(THD *thd, uint *nextp)
DBUG_ENTER("sp_instr_set_trigger_field::execute");
/* QQ: Still unsure what should we return in case of error 1 or -1 ? */
if (!value->fixed && value->fix_fields(thd, 0, &value) ||
- trigger_field.fix_fields(thd, 0, 0) ||
- (value->save_in_field(trigger_field.field, 0) < 0))
+ trigger_field->fix_fields(thd, 0, 0) ||
+ (value->save_in_field(trigger_field->field, 0) < 0))
res= -1;
*nextp= m_ip + 1;
DBUG_RETURN(res);
@@ -1510,7 +1510,7 @@ void
sp_instr_set_trigger_field::print(String *str)
{
str->append("set ", 4);
- trigger_field.print(str);
+ trigger_field->print(str);
str->append(":=", 2);
value->print(str);
}
diff --git a/sql/sp_head.h b/sql/sp_head.h
index ee41b1efc83..49eabce246b 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -18,7 +18,7 @@
#ifndef _SP_HEAD_H_
#define _SP_HEAD_H_
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
@@ -467,9 +467,9 @@ class sp_instr_set_trigger_field : public sp_instr
public:
sp_instr_set_trigger_field(uint ip, sp_pcontext *ctx,
- LEX_STRING field_name, Item *val)
+ Item_trigger_field *trg_fld, Item *val)
: sp_instr(ip, ctx),
- trigger_field(Item_trigger_field::NEW_ROW, field_name.str),
+ trigger_field(trg_fld),
value(val)
{}
@@ -480,9 +480,8 @@ public:
virtual void print(String *str);
- Item_trigger_field trigger_field;
-
private:
+ Item_trigger_field *trigger_field;
Item *value;
}; // class sp_instr_trigger_field : public sp_instr
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index 26f576233f3..f95a43eb903 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index 749b99dcf14..0d218bc0538 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -18,7 +18,7 @@
#ifndef _SP_PCONTEXT_H_
#define _SP_PCONTEXT_H_
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 49ead5d1585..2e79a1e2533 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -14,7 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index 417c50d0f0f..ba5fa950dc3 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -18,7 +18,7 @@
#ifndef _SP_RCONTEXT_H_
#define _SP_RCONTEXT_H_
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 1056bff4315..6706cee8e9d 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -23,7 +23,7 @@
** - type set is out of optimization yet
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h
index a0f0df9b43b..9e5926fd9b1 100644
--- a/sql/sql_analyse.h
+++ b/sql/sql_analyse.h
@@ -17,7 +17,7 @@
/* Analyse database */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 48cdb47a7ff..438bfdbcb73 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -22,7 +22,7 @@
**
*****************************************************************************/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc
index b0b8050e311..f21a109e95d 100644
--- a/sql/sql_crypt.cc
+++ b/sql/sql_crypt.cc
@@ -23,7 +23,7 @@
needs something like 'ssh'.
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h
index 1b27f0a4d27..25bc2d29e1d 100644
--- a/sql/sql_crypt.h
+++ b/sql/sql_crypt.h
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 7c7939eaf60..fb23ded414e 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -423,7 +423,7 @@ static const uint signed_longlong_len=19;
static const char *unsigned_longlong_str="18446744073709551615";
static const uint unsigned_longlong_len=20;
-inline static uint int_token(const char *str,uint length)
+static inline uint int_token(const char *str,uint length)
{
if (length < long_len) // quick normal case
return NUM;
diff --git a/sql/sql_list.cc b/sql/sql_list.cc
index c99cfb8c918..d57a7dfe4e3 100644
--- a/sql/sql_list.cc
+++ b/sql/sql_list.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
index 4bb3482c7e6..9346f3df305 100644
--- a/sql/sql_map.cc
+++ b/sql/sql_map.cc
@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_map.h b/sql/sql_map.h
index 632eb6e4f64..bfa6011ac54 100644
--- a/sql/sql_map.h
+++ b/sql/sql_map.h
@@ -17,7 +17,7 @@
/* interface for memory mapped files */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index 07271d40492..8ac0a36b03f 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -28,7 +28,7 @@
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7078c8e7181..aaec001f47b 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1655,6 +1655,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
while (!thd->killed && thd->lex->found_semicolon && !thd->net.report_error)
{
char *packet= thd->lex->found_semicolon;
+ net->no_send_error= 0;
/*
Multiple queries exits, execute them individually
in embedded server - just store them to be executed later
@@ -3180,7 +3181,7 @@ unsent_create_error:
if (!(res= open_and_lock_tables(thd, all_tables)))
{
/* Skip first table, which is the table we are inserting in */
- lex->select_lex.table_list.first= (byte*)first_table->next_local;
+ select_lex->table_list.first= (byte*)first_table->next_local;
res= mysql_insert_select_prepare(thd);
if (!res && (result= new select_insert(first_table, first_table->table,
@@ -3192,13 +3193,13 @@ unsent_create_error:
insert/replace from SELECT give its SELECT_LEX for SELECT,
and item_list belong to SELECT
*/
- lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
+ select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE);
- lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
+ select_lex->resolve_mode= SELECT_LEX::INSERT_MODE;
delete result;
}
/* revert changes for SP */
- lex->select_lex.table_list.first= (byte*) first_table;
+ select_lex->table_list.first= (byte*) first_table;
}
if (first_table->view && !first_table->contain_auto_increment)
@@ -3991,7 +3992,7 @@ unsent_create_error:
lex->sphead= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* only add privileges if really neccessary */
- if (sp_automatic_privileges &&
+ if (sp_automatic_privileges && !opt_noacl &&
check_routine_access(thd, DEFAULT_CREATE_PROC_ACLS,
db, name,
lex->sql_command == SQLCOM_CREATE_PROCEDURE, 1))
@@ -4260,7 +4261,7 @@ unsent_create_error:
lex->sql_command == SQLCOM_DROP_PROCEDURE, 0))
goto error;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (sp_automatic_privileges &&
+ if (sp_automatic_privileges && !opt_noacl &&
sp_revoke_privileges(thd, db, name,
lex->sql_command == SQLCOM_DROP_PROCEDURE))
{
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index ca67b09fdc8..71cebb61ae6 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1479,13 +1479,11 @@ bool show_binlogs(THD* thd)
{
IO_CACHE *index_file;
LOG_INFO cur;
- IO_CACHE log;
File file;
- const char *errmsg= 0;
- MY_STAT stat_area;
char fname[FN_REFLEN];
List<Item> field_list;
uint length;
+ int cur_dir_len;
Protocol *protocol= thd->protocol;
DBUG_ENTER("show_binlogs");
@@ -1505,34 +1503,35 @@ bool show_binlogs(THD* thd)
index_file=mysql_bin_log.get_index_file();
mysql_bin_log.get_current_log(&cur);
- int cur_dir_len = dirname_length(cur.log_file_name);
+ cur_dir_len= dirname_length(cur.log_file_name);
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);
/* The file ends with EOF or empty line */
while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1)
{
- fname[--length] = '\0'; /* remove the newline */
+ int dir_len;
+ ulonglong file_length= 0; // Length if open fails
+ fname[--length] = '\0'; // remove the newline
protocol->prepare_for_resend();
- int dir_len = dirname_length(fname);
- protocol->store(fname + dir_len, length-dir_len, &my_charset_bin);
- if(!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length-dir_len)))
+ dir_len= dirname_length(fname);
+ length-= dir_len;
+ protocol->store(fname + dir_len, length, &my_charset_bin);
+
+ if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length)))
+ file_length= cur.pos; /* The active log, use the active position */
+ else
{
- /* this is the active log, use the active position */
- protocol->store((ulonglong) cur.pos);
- } else {
/* this is an old log, open it and find the size */
- if ((file=open_binlog(&log, fname+dir_len, &errmsg)) >= 0)
+ if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY,
+ MYF(0))) >= 0)
{
- protocol->store((ulonglong) my_b_filelength(&log));
- end_io_cache(&log);
+ file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0));
my_close(file, MYF(0));
- } else {
- /* the file wasn't openable, but 0 is an invalid value anyway */
- protocol->store((ulonglong) 0);
}
}
+ protocol->store(file_length);
if (protocol->write())
goto err;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ffad69654ea..9f518232214 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -17,7 +17,7 @@
/* mysql_select and join optimization */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 0424723d97f..51f802e7465 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -16,7 +16,7 @@
/* This file is originally from the mysql distribution. Coded by monty */
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 1e1a5683d09..03d54b60318 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -28,7 +28,7 @@
dynamic functions, so this shouldn't be a real problem.
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: implement sql_udf.h
#endif
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 6b9676c8124..8181521969a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7569,6 +7569,7 @@ sys_option_value:
{
/* We are in trigger and assigning value to field of new row */
Item *it;
+ Item_trigger_field *trg_fld;
sp_instr_set_trigger_field *i;
if ($1)
{
@@ -7589,17 +7590,19 @@ sys_option_value:
it= new Item_null();
}
- if (!(i= new sp_instr_set_trigger_field(
- lex->sphead->instructions(), lex->spcont,
- $2.base_name, it)))
+ if (!(trg_fld= new Item_trigger_field(Item_trigger_field::NEW_ROW,
+ $2.base_name.str)) ||
+ !(i= new sp_instr_set_trigger_field(
+ lex->sphead->instructions(), lex->spcont,
+ trg_fld, it)))
YYABORT;
/*
Let us add this item to list of all Item_trigger_field
objects in trigger.
*/
- lex->trg_table_fields.link_in_list((byte *)&i->trigger_field,
- (byte **)&i->trigger_field.next_trg_field);
+ lex->trg_table_fields.link_in_list((byte *)trg_fld,
+ (byte **)&trg_fld->next_trg_field);
lex->sphead->add_instr(i);
}
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 983c630071e..11cdf64de29 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -20,7 +20,7 @@
(We will refer to this code as to elsie-code further.)
*/
-#ifdef __GNUC__
+#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 95db383bbb6..9a8ee44c54c 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -233,7 +233,7 @@ mysql_simple_prepare(MYSQL *mysql, const char *query)
/* Connect to the server */
-static void client_connect()
+static void client_connect(ulong flag)
{
int rc;
myheader_r("client_connect");
@@ -251,7 +251,7 @@ static void client_connect()
if (!(mysql_real_connect(mysql, opt_host, opt_user,
opt_password, opt_db ? opt_db:"test", opt_port,
- opt_unix_socket, 0)))
+ opt_unix_socket, flag)))
{
opt_silent= 0;
myerror("connection failed");
@@ -13478,6 +13478,22 @@ static void print_test_output()
}
+static void check_mupltiquery_bug9992()
+{
+
+ MYSQL_RES* res ;
+ mysql_query(mysql,"SHOW TABLES;SHOW DATABASE;SELECT 1;");
+
+ fprintf(stdout, "\n\n!!! check_mupltiquery_bug9992 !!!\n");
+ do
+ {
+ if (!(res= mysql_store_result(mysql)))
+ return;
+ mysql_free_result(res);
+ } while (!mysql_next_result(mysql));
+ fprintf(stdout, "\n\n!!! SUCCESS !!!\n");
+ return;
+}
/***************************************************************************
main routine
***************************************************************************/
@@ -13499,7 +13515,7 @@ int main(int argc, char **argv)
(char**) embedded_server_groups))
DIE("Can't initialize MySQL server");
- client_connect(); /* connect to server */
+ client_connect(0); /* connect to server */
total_time= 0;
for (iter_count= 1; iter_count <= opt_count; iter_count++)
@@ -13543,6 +13559,10 @@ int main(int argc, char **argv)
}
client_disconnect(); /* disconnect from server */
+
+ client_connect(CLIENT_MULTI_STATEMENTS);
+ check_mupltiquery_bug9992();
+ client_disconnect();
free_defaults(defaults_argv);
print_test_output();