From 1211b9a513df1b17198235375770a0ddf585a789 Mon Sep 17 00:00:00 2001
From: "guilhem@mysql.com" <>
Date: Tue, 1 Apr 2003 18:19:15 +0200
Subject: [PATCH] Small-and-safe fix for bug #218: "LOAD DATA INFILE IGNORE is
 well logged, but read as LOAD DATA INFILE REPLACE" This was just bad &&
 instead of &, but nasty consequences. This should be merged to 4.0 BUT it
 will not be automatic (some code has moved from log_event.h to log_event.cc,
 and log_event.cc has changed); please Merging Man, do 'bk grep REPLACE_FLAG'
 in 4.0/sql to find all the new places.

---
 sql/log_event.cc | 6 +++---
 sql/slave.cc     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sql/log_event.cc b/sql/log_event.cc
index c30d03adaf..7c4c893a82 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -671,9 +671,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
 
   fprintf(file, "LOAD DATA INFILE '%s' ", fname);
 
-  if(sql_ex.opt_flags && REPLACE_FLAG )
+  if(sql_ex.opt_flags & REPLACE_FLAG )
     fprintf(file," REPLACE ");
-  else if(sql_ex.opt_flags && IGNORE_FLAG )
+  else if(sql_ex.opt_flags & IGNORE_FLAG )
     fprintf(file," IGNORE ");
   
   fprintf(file, "INTO TABLE %s ", table_name);
@@ -685,7 +685,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
 
   if(!(sql_ex.empty_flags & ENCLOSED_EMPTY))
   {
-    if(sql_ex.opt_flags && OPT_ENCLOSED_FLAG )
+    if(sql_ex.opt_flags & OPT_ENCLOSED_FLAG )
       fprintf(file," OPTIONALLY ");
     fprintf(file, " ENCLOSED BY ");
     pretty_print_char(file, sql_ex.enclosed);
diff --git a/sql/slave.cc b/sql/slave.cc
index 358a908e0c..ac65bd2bdc 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1100,9 +1100,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
 	else
 	{
 	  enum enum_duplicates handle_dup = DUP_IGNORE;
-	  if(lev->sql_ex.opt_flags && REPLACE_FLAG)
+	  if(lev->sql_ex.opt_flags & REPLACE_FLAG)
 	    handle_dup = DUP_REPLACE;
-	  sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags &&
+	  sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags &
 			  DUMPFILE_FLAG );
 	  String field_term(&lev->sql_ex.field_term, 1),
 	    enclosed(&lev->sql_ex.enclosed, 1),
-- 
2.30.9