summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-02-16 10:15:52 +0200
committerunknown <monty@mysql.com>2004-02-16 10:15:52 +0200
commitd00fbce3083f11d071300447e11dab124debb2b7 (patch)
treef9bef14abcf4ef1e6145cb3c16e63c9a56e221e9
parenta07e48eca04b1564da9868f229ba5d958994db69 (diff)
parent40ad9154930ca5d42649b776f84989cc372b060c (diff)
downloadmariadb-git-d00fbce3083f11d071300447e11dab124debb2b7.tar.gz
Merge with 4.0 to get fix for mysqlbinlog
mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/select_found.result: Auto merged mysql-test/t/select_found.test: Auto merged sql/log_event.h: Auto merged sql/opt_range.cc: Auto merged sql/sql_load.cc: Auto merged support-files/mysql.spec.sh: Auto merged client/mysqlbinlog.cc: Merge with 4.0 configure.in: Merge with 4.0 mysql-test/r/range.result: Use local file mysql-test/t/range.test: Use local file sql/share/english/errmsg.txt: Use local file
-rw-r--r--client/mysqlbinlog.cc31
-rw-r--r--configure.in5
-rw-r--r--mysql-test/r/mysqlbinlog.result22
-rw-r--r--mysql-test/r/select_found.result18
-rw-r--r--mysql-test/t/select_found.test28
-rw-r--r--sql/log_event.cc18
-rw-r--r--sql/log_event.h6
-rw-r--r--sql/opt_range.cc1
-rw-r--r--sql/sql_load.cc2
-rw-r--r--support-files/mysql.spec.sh14
10 files changed, 110 insertions, 35 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 27ad91c8e8a..82a57961c11 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -102,17 +102,18 @@ class Load_log_processor
}
public:
- Load_log_processor()
- {
- init_dynamic_array(&file_names,sizeof(Create_file_log_event*),
- 100,100 CALLER_INFO);
- }
-
+ Load_log_processor() {}
~Load_log_processor()
- {
- destroy();
- delete_dynamic(&file_names);
- }
+ {
+ destroy();
+ delete_dynamic(&file_names);
+ }
+
+ int init()
+ {
+ return init_dynamic_array(&file_names,sizeof(Create_file_log_event*),
+ 100,100 CALLER_INFO);
+ }
void init_by_dir_name(const char *dir)
{
@@ -345,7 +346,7 @@ int process_event(ulonglong *rec_count, char *last_db, Log_event *ev,
filename and use LOCAL), prepared in the 'case EXEC_LOAD_EVENT'
below.
*/
- ce->print(result_file, short_form, last_db, true);
+ ce->print(result_file, short_form, last_db, TRUE);
if (!old_format)
{
if (load_processor.process(ce))
@@ -371,7 +372,7 @@ int process_event(ulonglong *rec_count, char *last_db, Log_event *ev,
*/
if (ce)
{
- ce->print(result_file, short_form, last_db,true);
+ ce->print(result_file, short_form, last_db, TRUE);
my_free((char*)ce->fname,MYF(MY_WME));
delete ce;
}
@@ -459,6 +460,10 @@ void sql_print_error(const char *format,...)
static void cleanup()
{
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
+ my_free((char*) database, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((char*) host, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((char*) user, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((char*) dirname_for_local_load, MYF(MY_ALLOW_ZERO_PTR));
}
static void die(const char* fmt, ...)
@@ -885,6 +890,8 @@ int main(int argc, char** argv)
dirname_for_local_load= my_tmpdir(&tmpdir);
}
+ if (load_processor.init())
+ exit(1);
if (dirname_for_local_load)
load_processor.init_by_dir_name(dirname_for_local_load);
else
diff --git a/configure.in b/configure.in
index babdf4f0b4d..cc49bb5d0b9 100644
--- a/configure.in
+++ b/configure.in
@@ -192,6 +192,11 @@ AC_PROG_RANLIB
#AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
+# Ensure that we have --preserve-dup-deps defines, otherwise we get link
+# problems of 'mysql' with CXX=g++
+LIBTOOL="$LIBTOOL --preserve-dup-deps"
+AC_SUBST(LIBTOOL)dnl
+
#AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC
# AC_PROG_INSTALL
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 578e1dcaec8..f70eaeae214 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -24,11 +24,11 @@ insert into t1 values ("abirvalg");
SET INSERT_ID=1;
SET TIMESTAMP=1000000000;
insert into t2 values ();
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-1-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-1-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
--- Broken LOAD DATA --
use test;
@@ -54,12 +54,12 @@ insert into t1 values ("abirvalg");
SET INSERT_ID=1;
SET TIMESTAMP=1000000000;
insert into t2 values ();
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-1-1' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-1' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-1' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-1' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-1' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-6-1' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-1-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
+LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-6-1' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
SET TIMESTAMP=1000000000;
insert into t1 values ("Alas");
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index e302a0cefeb..23a39a242a1 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -208,3 +208,21 @@ select FOUND_ROWS();
FOUND_ROWS()
0
drop table t1;
+CREATE TABLE t1 ( a int not null, b int not null, KEY ab(a,b) );
+INSERT INTO t1 VALUES ( 47, 1 );
+INSERT INTO t1 VALUES ( 70, 1 );
+SELECT * FROM t1
+WHERE
+(
+( b =1 AND a BETWEEN 14 AND 21 ) OR
+( b =2 AND a BETWEEN 16 AND 18 ) OR
+( b =3 AND a BETWEEN 15 AND 19 )
+);
+a b
+DROP TABLE t1;
+CREATE TABLE t1 ( a integer, u varchar(15), r integer, key uao_idx( r, a, u));
+DELETE FROM t1
+WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
+OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
+OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
+drop table t1;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index 3cf736cafb0..e63e894c1cf 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -109,3 +109,31 @@ select FOUND_ROWS();
select SQL_CALC_FOUND_ROWS * from t1 where id > 6 limit 0, 1;
select FOUND_ROWS();
drop table t1;
+
+#
+# Other bugs with range optimization
+#
+
+# bug #2448
+
+CREATE TABLE t1 ( a int not null, b int not null, KEY ab(a,b) );
+INSERT INTO t1 VALUES ( 47, 1 );
+INSERT INTO t1 VALUES ( 70, 1 );
+SELECT * FROM t1
+WHERE
+(
+ ( b =1 AND a BETWEEN 14 AND 21 ) OR
+ ( b =2 AND a BETWEEN 16 AND 18 ) OR
+ ( b =3 AND a BETWEEN 15 AND 19 )
+);
+DROP TABLE t1;
+
+# bug #2698
+
+CREATE TABLE t1 ( a integer, u varchar(15), r integer, key uao_idx( r, a, u));
+DELETE FROM t1
+WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
+ OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
+ OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
+drop table t1;
+
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f64f740da30..a128b5809b2 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1218,7 +1218,7 @@ void Load_log_event::pack_info(Protocol *protocol)
18 + fname_len + 2 + // "LOAD DATA INFILE 'file''"
7 + // LOCAL
9 + // " REPLACE or IGNORE "
- 11 + table_name_len + // "INTO TABLE table"
+ 13 + table_name_len*2 + // "INTO TABLE `table`"
21 + sql_ex.field_term_len*4 + 2 + // " FIELDS TERMINATED BY 'str'"
23 + sql_ex.enclosed_len*4 + 2 + // " OPTIONALLY ENCLOSED BY 'str'"
12 + sql_ex.escaped_len*4 + 2 + // " ESCAPED BY 'str'"
@@ -1249,12 +1249,12 @@ void Load_log_event::pack_info(Protocol *protocol)
else if (sql_ex.opt_flags & IGNORE_FLAG)
pos= strmov(pos, " IGNORE ");
- pos= strmov(pos ,"INTO TABLE ");
+ pos= strmov(pos ,"INTO TABLE `");
memcpy(pos, table_name, table_name_len);
pos+= table_name_len;
/* We have to create all optinal fields as the default is not empty */
- pos= strmov(pos, " FIELDS TERMINATED BY ");
+ pos= strmov(pos, "` FIELDS TERMINATED BY ");
pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG)
pos= strmov(pos, " OPTIONALLY ");
@@ -1545,7 +1545,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db,
else if (sql_ex.opt_flags & IGNORE_FLAG)
fprintf(file," IGNORE ");
- fprintf(file, "INTO TABLE %s ", table_name);
+ fprintf(file, "INTO TABLE `%s`", table_name);
fprintf(file, " FIELDS TERMINATED BY ");
pretty_print_str(file, sql_ex.field_term, sql_ex.field_term_len);
@@ -2570,7 +2570,7 @@ Create_file_log_event(THD* thd_arg, sql_exchange* ex,
char* block_arg, uint block_len_arg, bool using_trans)
:Load_log_event(thd_arg,ex,db_arg,table_name_arg,fields_arg,handle_dup,
using_trans),
- fake_base(0),block(block_arg),block_len(block_len_arg),
+ fake_base(0), block(block_arg), event_buf(0), block_len(block_len_arg),
file_id(thd_arg->file_id = mysql_bin_log.next_file_id())
{
DBUG_ENTER("Create_file_log_event");
@@ -2634,8 +2634,14 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len,
int block_offset;
DBUG_ENTER("Create_file_log_event");
- if (copy_log_event(buf,len,old_format))
+ /*
+ We must make copy of 'buf' as this event may have to live over a
+ rotate log entry when used in mysqlbinlog
+ */
+ if (!(event_buf= my_memdup(buf, len, MYF(MY_WME))) ||
+ (copy_log_event(event_buf, len, old_format)))
DBUG_VOID_RETURN;
+
if (!old_format)
{
file_id = uint4korr(buf + LOG_EVENT_HEADER_LEN +
diff --git a/sql/log_event.h b/sql/log_event.h
index 1a5f0543766..28d1f44df92 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -885,6 +885,7 @@ protected:
bool fake_base;
public:
char* block;
+ const char *event_buf;
uint block_len;
uint file_id;
bool inited_from_old;
@@ -906,7 +907,10 @@ public:
#endif
Create_file_log_event(const char* buf, int event_len, bool old_format);
- ~Create_file_log_event() {}
+ ~Create_file_log_event()
+ {
+ my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR));
+ }
Log_event_type get_type_code()
{
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 1dbe883aef4..6f97a5afe94 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -496,6 +496,7 @@ SEL_ARG *SEL_ARG::clone(SEL_ARG *new_parent,SEL_ARG **next_arg)
return 0; // OOM
}
increment_use_count(1);
+ tmp->color= color;
return tmp;
}
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 45b76e44f28..f910e947720 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -94,7 +94,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
#endif
char *db = table_list->db; // This is never null
/* If no current database, use database where table is located */
- char *tdb= thd->db ? thd->db : db;
+ char *tdb= thd->db ? thd->db : db; // Result is never null
bool transactional_table, log_delayed;
ulong skip_lines= ex->skip_lines;
DBUG_ENTER("mysql_load");
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index ee5bc77c636..fe5dae3dbf6 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -16,7 +16,7 @@ Summary(pt_BR): MySQL: Um servidor SQL rápido e confiável.
Group(pt_BR): Aplicações/Banco_de_Dados
Version: @MYSQL_NO_DASH_VERSION@
Release: %{release}
-Copyright: GPL
+License: GPL
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz
URL: http://www.mysql.com/
Packager: Lenz Grimmer <build@mysql.com>
@@ -259,10 +259,11 @@ export PATH
# Build the 4.0 Max binary (includes BDB and UDFs and therefore
# cannot be linked statically against the patched glibc)
-# If we want to compile with RAID using gcc 3, we need to use
-# gcc instead of g++ to avoid linking problems (RAID code is written in C++)
-test -z $CXX && test -z $CC && if gcc -v 2>&1 | grep 'gcc version 3' > /dev/null 2>&1
+# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and
+# including exceptions into the code
+if [ -z "$CXX" -a -z "$CC" ]
then
+ export CC="gcc"
export CXX="gcc"
fi
@@ -576,6 +577,11 @@ fi
# The spec file changelog only includes changes made to the spec file
# itself
%changelog
+* Thu Feb 12 2004 Lenz Grimmer <lenz@mysql.com>
+
+- when using gcc, _always_ use CXX=gcc
+- replaced Copyright with License field (Copyright is obsolete)
+
* Tue Feb 03 2004 Lenz Grimmer <lenz@mysql.com>
- added myisam_ftdump to the Server package