summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@tramp.mysql.fi>2000-09-26 00:33:25 +0300
committerunknown <monty@tramp.mysql.fi>2000-09-26 00:33:25 +0300
commit7fe58c4f5bea627bb38bfbcb0cc5885e3f6129c6 (patch)
tree047c90e932cb7b90a58fe795b855351027725c29 /sql
parent5f12486229fb578f2e170238ab2cdd7c9bf42a82 (diff)
downloadmariadb-git-7fe58c4f5bea627bb38bfbcb0cc5885e3f6129c6.tar.gz
RIGHT JOIN, part of automatic repair of MyISAM tables, backup on repair,
reading from FIFO, fixes for FULLTEXT, @@IDENTITY Docs/manual.texi: Update of RIGHT JOIN client/mysql.cc: Faster HTML generation extra/perror.c: Added MyISAM error messages include/my_base.h: Update for automatic repair of MyISAM tables include/my_sys.h: Backup files and FIFO include/myisam.h: Automatic repair and backup files include/mysqld_error.h: New error message myisam/mi_check.c: Update for automatic repair of MyISAM tables myisam/mi_locking.c: Fixed comment myisam/mi_open.c: Update for automatic repair of MyISAM tables myisam/myisamchk.c: Update for automatic repair of MyISAM tables myisam/myisamdef.h: Update for automatic repair of MyISAM tables mysys/mf_getdate.c: Added new parameter option for backup files mysys/my_open.c: Added debug information mysys/my_redel.c: Backup file handling sql/ha_berkeley.cc: Updated interface sql/ha_berkeley.h: Updated interface sql/ha_heap.cc: Updated interface sql/ha_heap.h: Updated interface sql/ha_isam.cc: Updated interface sql/ha_isam.h: Updated interface sql/ha_isammrg.cc: Updated interface sql/ha_isammrg.h: Updated interface sql/ha_myisam.cc: Update for automatic repair of MyISAM tables sql/ha_myisam.h: Updated interface sql/ha_myisammrg.cc: Updated interface sql/ha_myisammrg.h: Updated interface sql/handler.h: Updated interface sql/item.h: Added @@identity sql/item_func.cc: Added @@identity sql/lex.h: Added RIGHT JOIN sql/mf_iocache.cc: Update for reading from FIFO sql/mysqld.cc: Update for automatic repair of MyISAM tables sql/share/czech/errmsg.sys: Added @@identity sql/share/czech/errmsg.txt: Added @@identity sql/share/danish/errmsg.sys: Added @@identity sql/share/danish/errmsg.txt: Added @@identity sql/share/dutch/errmsg.sys: Added @@identity sql/share/dutch/errmsg.txt: Added @@identity sql/share/english/errmsg.sys: Added @@identity sql/share/english/errmsg.txt: Added @@identity sql/share/estonian/errmsg.sys: Added @@identity sql/share/estonian/errmsg.txt: Added @@identity sql/share/french/errmsg.sys: Added @@identity sql/share/french/errmsg.txt: Added @@identity sql/share/german/errmsg.sys: Added @@identity sql/share/german/errmsg.txt: Added @@identity sql/share/greek/errmsg.sys: Added @@identity sql/share/greek/errmsg.txt: Added @@identity sql/share/hungarian/errmsg.sys: Added @@identity sql/share/hungarian/errmsg.txt: Added @@identity sql/share/italian/errmsg.sys: Added @@identity sql/share/italian/errmsg.txt: Added @@identity sql/share/japanese/errmsg.sys: Added @@identity sql/share/japanese/errmsg.txt: Added @@identity sql/share/korean/errmsg.sys: Added @@identity sql/share/korean/errmsg.txt: Added @@identity sql/share/norwegian-ny/errmsg.txt: Added @@identity sql/share/norwegian/errmsg.txt: Added @@identity sql/share/polish/errmsg.sys: Added @@identity sql/share/polish/errmsg.txt: Added @@identity sql/share/portuguese/errmsg.sys: Added @@identity sql/share/portuguese/errmsg.txt: Added @@identity sql/share/romanian/errmsg.txt: Added @@identity sql/share/russian/errmsg.sys: Added @@identity sql/share/russian/errmsg.txt: Added @@identity sql/share/slovak/errmsg.sys: Added @@identity sql/share/slovak/errmsg.txt: Added @@identity sql/share/spanish/errmsg.sys: Added @@identity sql/share/spanish/errmsg.txt: Added @@identity sql/share/swedish/errmsg.OLD: Added @@identity sql/share/swedish/errmsg.sys: Added @@identity sql/share/swedish/errmsg.txt: Added @@identity sql/sql_base.cc: Fix for RIGHT JOIN sql/sql_db.cc: Update for automatic repair of MyISAM tables sql/sql_load.cc: Added reading from FIFO sql/sql_parse.cc: Fix for RIGHT JOIN sql/sql_select.cc: Fix for RIGHT JOIN sql/sql_table.cc: cleanup sql/sql_yacc.yy: Added RIGHT JOIN sql/table.cc: Fix handling of FULLTEXT index sql/table.h: Added RIGHT JOIN BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_berkeley.cc2
-rw-r--r--sql/ha_berkeley.h2
-rw-r--r--sql/ha_heap.cc2
-rw-r--r--sql/ha_heap.h2
-rw-r--r--sql/ha_isam.cc2
-rw-r--r--sql/ha_isam.h2
-rw-r--r--sql/ha_isammrg.cc2
-rw-r--r--sql/ha_isammrg.h2
-rw-r--r--sql/ha_myisam.cc23
-rw-r--r--sql/ha_myisam.h7
-rw-r--r--sql/ha_myisammrg.cc2
-rw-r--r--sql/ha_myisammrg.h2
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item.h1
-rw-r--r--sql/item_func.cc13
-rw-r--r--sql/lex.h2
-rw-r--r--sql/mf_iocache.cc22
-rw-r--r--sql/mysqld.cc16
-rw-r--r--sql/share/czech/errmsg.sysbin10283 -> 10317 bytes
-rw-r--r--sql/share/czech/errmsg.txt1
-rw-r--r--sql/share/danish/errmsg.sysbin10232 -> 10266 bytes
-rw-r--r--sql/share/danish/errmsg.txt1
-rw-r--r--sql/share/dutch/errmsg.sysbin10448 -> 10482 bytes
-rw-r--r--sql/share/dutch/errmsg.txt1
-rw-r--r--sql/share/english/errmsg.sysbin9613 -> 9647 bytes
-rw-r--r--sql/share/english/errmsg.txt1
-rw-r--r--sql/share/estonian/errmsg.sysbin9589 -> 9623 bytes
-rw-r--r--sql/share/estonian/errmsg.txt1
-rw-r--r--sql/share/french/errmsg.sysbin10054 -> 10088 bytes
-rw-r--r--sql/share/french/errmsg.txt1
-rw-r--r--sql/share/german/errmsg.sysbin10833 -> 10867 bytes
-rw-r--r--sql/share/german/errmsg.txt1
-rw-r--r--sql/share/greek/errmsg.sysbin11660 -> 11694 bytes
-rw-r--r--sql/share/greek/errmsg.txt1
-rw-r--r--sql/share/hungarian/errmsg.sysbin10569 -> 10603 bytes
-rw-r--r--sql/share/hungarian/errmsg.txt1
-rw-r--r--sql/share/italian/errmsg.sysbin11178 -> 11212 bytes
-rw-r--r--sql/share/italian/errmsg.txt1
-rw-r--r--sql/share/japanese/errmsg.sysbin10360 -> 10394 bytes
-rw-r--r--sql/share/japanese/errmsg.txt1
-rw-r--r--sql/share/korean/errmsg.sysbin10490 -> 10524 bytes
-rw-r--r--sql/share/korean/errmsg.txt1
-rw-r--r--sql/share/norwegian-ny/errmsg.txt1
-rw-r--r--sql/share/norwegian/errmsg.txt1
-rw-r--r--sql/share/polish/errmsg.sysbin10248 -> 10282 bytes
-rw-r--r--sql/share/polish/errmsg.txt1
-rw-r--r--sql/share/portuguese/errmsg.sysbin10173 -> 10207 bytes
-rw-r--r--sql/share/portuguese/errmsg.txt1
-rw-r--r--sql/share/romanian/errmsg.txt1
-rw-r--r--sql/share/russian/errmsg.sysbin10067 -> 10101 bytes
-rw-r--r--sql/share/russian/errmsg.txt1
-rw-r--r--sql/share/slovak/errmsg.sysbin9833 -> 9867 bytes
-rw-r--r--sql/share/slovak/errmsg.txt1
-rw-r--r--sql/share/spanish/errmsg.sysbin10189 -> 10223 bytes
-rw-r--r--sql/share/spanish/errmsg.txt1
-rw-r--r--sql/share/swedish/errmsg.OLD6
-rw-r--r--sql/share/swedish/errmsg.sysbin9937 -> 9960 bytes
-rw-r--r--sql/share/swedish/errmsg.txt5
-rw-r--r--sql/sql_base.cc40
-rw-r--r--sql/sql_db.cc3
-rw-r--r--sql/sql_load.cc29
-rw-r--r--sql/sql_parse.cc8
-rw-r--r--sql/sql_select.cc5
-rw-r--r--sql/sql_table.cc23
-rw-r--r--sql/sql_yacc.yy18
-rw-r--r--sql/table.cc5
-rw-r--r--sql/table.h11
67 files changed, 185 insertions, 94 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index f52202a6d70..f9ee7595433 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -254,7 +254,7 @@ berkeley_cmp_fix_length_key(const DBT *new_key, const DBT *saved_key)
}
-int ha_berkeley::open(const char *name, int mode, int test_if_locked)
+int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
{
char name_buff[FN_REFLEN];
uint open_mode=(mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD;
diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h
index adea939bf61..519e4b62cf9 100644
--- a/sql/ha_berkeley.h
+++ b/sql/ha_berkeley.h
@@ -87,7 +87,7 @@ class ha_berkeley: public handler
bool fast_key_read() { return 1;}
bool has_transactions() { return 1;}
- int open(const char *name, int mode, int test_if_locked);
+ int open(const char *name, int mode, uint test_if_locked);
void initialize(void);
int close(void);
double scan_time();
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 5bdbf75749e..b4b0c4b677e 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -31,7 +31,7 @@ const char **ha_heap::bas_ext() const
{ static const char *ext[1]= { NullS }; return ext; }
-int ha_heap::open(const char *name, int mode, int test_if_locked)
+int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
uint key,part,parts;
HP_KEYDEF *keydef;
diff --git a/sql/ha_heap.h b/sql/ha_heap.h
index b3651a3957b..d88c28097af 100644
--- a/sql/ha_heap.h
+++ b/sql/ha_heap.h
@@ -44,7 +44,7 @@ class ha_heap: public handler
virtual double read_time(ha_rows rows) { return (double) rows / 20.0+1; }
virtual bool fast_key_read() { return 1;}
- int open(const char *name, int mode, int test_if_locked);
+ int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
diff --git a/sql/ha_isam.cc b/sql/ha_isam.cc
index fc836977f23..746fdd2f585 100644
--- a/sql/ha_isam.cc
+++ b/sql/ha_isam.cc
@@ -37,7 +37,7 @@ const char **ha_isam::bas_ext() const
{ static const char *ext[]= { ".ISD",".ISM", NullS }; return ext; }
-int ha_isam::open(const char *name, int mode, int test_if_locked)
+int ha_isam::open(const char *name, int mode, uint test_if_locked)
{
char name_buff[FN_REFLEN];
if (!(file=nisam_open(fn_format(name_buff,name,"","",2 | 4), mode,
diff --git a/sql/ha_isam.h b/sql/ha_isam.h
index 440f029451f..c8305c655ef 100644
--- a/sql/ha_isam.h
+++ b/sql/ha_isam.h
@@ -46,7 +46,7 @@ class ha_isam: public handler
uint min_record_length(uint options) const;
bool low_byte_first() const { return 0; }
- int open(const char *name, int mode, int test_if_locked);
+ int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
diff --git a/sql/ha_isammrg.cc b/sql/ha_isammrg.cc
index 66e310b5256..dd2e4e2f723 100644
--- a/sql/ha_isammrg.cc
+++ b/sql/ha_isammrg.cc
@@ -35,7 +35,7 @@
const char **ha_isammrg::bas_ext() const
{ static const char *ext[]= { ".MRG", NullS }; return ext; }
-int ha_isammrg::open(const char *name, int mode, int test_if_locked)
+int ha_isammrg::open(const char *name, int mode, uint test_if_locked)
{
char name_buff[FN_REFLEN];
if (!(file=mrg_open(fn_format(name_buff,name,"","",2 | 4), mode,
diff --git a/sql/ha_isammrg.h b/sql/ha_isammrg.h
index 9fe1984d76f..edced83d85d 100644
--- a/sql/ha_isammrg.h
+++ b/sql/ha_isammrg.h
@@ -40,7 +40,7 @@ class ha_isammrg: public handler
bool low_byte_first() const { return 0; }
uint min_record_length(uint options) const;
- int open(const char *name, int mode, int test_if_locked);
+ int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 77e9ac6b1dc..768e663bfa5 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -31,6 +31,13 @@
#endif
ulong myisam_sort_buffer_size;
+myisam_recover_types myisam_recover_type= HA_RECOVER_NONE;
+
+const char *myisam_recover_names[] =
+{ "NO","DEFAULT", "BACKUP"};
+TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names),"",
+ myisam_recover_names};
+
/*****************************************************************************
** MyISAM tables
@@ -76,6 +83,7 @@ extern "C" {
void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
{
param->error_printed|=1;
+ param->out_flag|= O_DATA_LOST;
va_list args;
va_start(args, fmt);
mi_check_print_msg(param, "error", fmt, args);
@@ -93,6 +101,7 @@ void mi_check_print_info(MI_CHECK *param, const char *fmt,...)
void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
{
param->warning_printed=1;
+ param->out_flag|= O_DATA_LOST;
va_list args;
va_start(args, fmt);
mi_check_print_msg(param, "warning", fmt, args);
@@ -187,15 +196,14 @@ err:
return error;
}
-int ha_myisam::open(const char *name, int mode, int test_if_locked)
+int ha_myisam::open(const char *name, int mode, uint test_if_locked)
{
char name_buff[FN_REFLEN];
if (!(file=mi_open(fn_format(name_buff,name,"","",2 | 4), mode,
test_if_locked)))
return (my_errno ? my_errno : -1);
- if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
- test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
+ if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
VOID(mi_extra(file,HA_EXTRA_NO_WAIT_LOCK));
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
@@ -447,7 +455,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
{
optimize_done=1;
- if (mi_test_if_sort_rep(file,file->state->records))
+ if (mi_test_if_sort_rep(file,file->state->records,0))
{
param.testflag|= T_STATISTICS; // We get this for free
thd->proc_info="Repairing by sorting";
@@ -506,7 +514,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
{
/*
We have to close all instances of this file to ensure that we can
- do the rename safely and that all threads are using the new version.
+ do the rename safely on all operating system and to ensure that
+ all threads are using the new version.
*/
thd->proc_info="renaming file";
VOID(pthread_mutex_lock(&LOCK_open));
@@ -515,11 +524,11 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
if (param.out_flag & O_NEW_DATA)
error|=change_to_newfile(fixed_name,MI_NAME_DEXT,
- DATA_TMP_EXT, 0);
+ DATA_TMP_EXT, 0, MYF(0));
if (param.out_flag & O_NEW_INDEX)
error|=change_to_newfile(fixed_name,MI_NAME_IEXT,
- INDEX_TMP_EXT,0);
+ INDEX_TMP_EXT, 0, MYF(0));
VOID(pthread_mutex_unlock(&LOCK_open));
}
}
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index 274b927a0c7..f1e5b217762 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -24,7 +24,12 @@
#include <myisam.h>
#include <ft_global.h>
+enum myisam_recover_types { HA_RECOVER_NONE, HA_RECOVER_DEFAULT,
+ HA_RECOVER_BACKUP};
+
extern ulong myisam_sort_buffer_size;
+extern TYPELIB myisam_recover_typelib;
+extern myisam_recover_types myisam_recover_type;
class ha_myisam: public handler
{
@@ -49,7 +54,7 @@ class ha_myisam: public handler
uint max_key_parts() const { return MAX_REF_PARTS; }
uint max_key_length() const { return MAX_KEY_LENGTH; }
- int open(const char *name, int mode, int test_if_locked);
+ int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index b0043f3f828..863054b4837 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -35,7 +35,7 @@
const char **ha_myisammrg::bas_ext() const
{ static const char *ext[]= { ".MRG", NullS }; return ext; }
-int ha_myisammrg::open(const char *name, int mode, int test_if_locked)
+int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
{
char name_buff[FN_REFLEN];
if (!(file=myrg_open(fn_format(name_buff,name,"","",2 | 4), mode,
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index 376c4edf18f..f8383ce7c10 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -46,7 +46,7 @@ class ha_myisammrg: public handler
virtual double scan_time()
{ return ulonglong2double(data_file_length) / IO_SIZE + file->tables; }
- int open(const char *name, int mode, int test_if_locked);
+ int open(const char *name, int mode, uint test_if_locked);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
diff --git a/sql/handler.h b/sql/handler.h
index 11ac9a7c767..7f39b78deee 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -205,7 +205,7 @@ public:
virtual int index_init(uint idx) { active_index=idx; return 0;}
virtual int index_end() {return 0; }
uint get_index(void) const { return active_index; }
- virtual int open(const char *name, int mode, int test_if_locked)=0;
+ virtual int open(const char *name, int mode, uint test_if_locked)=0;
virtual void initialize(void) {}
virtual int close(void)=0;
virtual int write_row(byte * buf)=0;
diff --git a/sql/item.h b/sql/item.h
index f7cc296a4b3..8b9a645d39b 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -430,3 +430,4 @@ extern Item_buff *new_Item_buff(Item *item);
extern Item_result item_cmp_type(Item_result a,Item_result b);
extern Item *resolve_const_item(Item *item,Item *cmp_item);
extern bool field_is_equal_to_item(Field *field,Item *item);
+Item *get_system_var(LEX_STRING name);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f80d084dc82..eada5d03079 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2018,3 +2018,16 @@ bool Item_func_match::eq(const Item *item) const
}
+/***************************************************************************
+ System variables
+ This has to be recoded after we get more than 3 system variables
+****************************************************************************/
+
+Item *get_system_var(LEX_STRING name)
+{
+ if (!strcmp(name.str,"IDENTITY"))
+ return new Item_int((char*) "@@IDENTITY",
+ current_thd->insert_id(),21);
+ my_error(ER_UNKNOWN_SYSTEM_VARIABLE,MYF(0),name);
+ return 0;
+}
diff --git a/sql/lex.h b/sql/lex.h
index 09f09319f88..820a5b9a601 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -252,6 +252,7 @@ static SYMBOL symbols[] = {
{ "RESTRICT", SYM(RESTRICT),0,0},
{ "RETURNS", SYM(UDF_RETURNS_SYM),0,0},
{ "REVOKE", SYM(REVOKE),0,0},
+ { "RIGHT", SYM(RIGHT),0,0},
{ "RLIKE", SYM(REGEXP),0,0}, /* Like in mSQL2 */
{ "ROLLBACK", SYM(ROLLBACK_SYM),0,0},
{ "ROW", SYM(ROW_SYM),0,0},
@@ -414,7 +415,6 @@ static SYMBOL sql_functions[] = {
{ "RELEASE_LOCK", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_release_lock)},
{ "REPEAT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_repeat)},
{ "REVERSE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_reverse)},
- { "RIGHT", SYM(RIGHT),0,0},
{ "ROUND", SYM(ROUND),0,0},
{ "RPAD", SYM(FUNC_ARG3),0,CREATE_FUNC(create_func_rpad)},
{ "RTRIM", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_rtrim)},
diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc
index e5ecc4bb428..49df40adaf6 100644
--- a/sql/mf_iocache.cc
+++ b/sql/mf_iocache.cc
@@ -94,13 +94,15 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
}
else
info->buffer=0;
+ DBUG_PRINT("info",("init_io_cache: cachesize = %u",cachesize));
info->pos_in_file= seek_offset;
info->read_length=info->buffer_length=cachesize;
- info->seek_not_done=test(file >= 0); /* Seek not done */
+ info->seek_not_done= test(file >= 0 && type != READ_FIFO &&
+ type != READ_NET);
info->myflags=cache_myflags & ~(MY_NABP | MY_FNABP);
info->rc_request_pos=info->rc_pos=info->buffer;
- if (type == READ_CACHE || type == READ_NET) /* the same logic */
+ if (type == READ_CACHE || type == READ_NET || type == READ_FIFO)
{
info->rc_end=info->buffer; /* Nothing in cache */
}
@@ -108,7 +110,9 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
{
info->rc_end=info->buffer+info->buffer_length- (seek_offset & (IO_SIZE-1));
}
- info->end_of_file=(type == READ_NET) ? 0 : MY_FILEPOS_ERROR; /* May be changed by user */
+ /* end_of_file may be changed by user later */
+ info->end_of_file= ((type == READ_NET || type == READ_FIFO ) ? 0
+ : MY_FILEPOS_ERROR);
info->type=type;
info->error=0;
info->read_function=(type == READ_NET) ? _my_b_net_read : _my_b_read; /* net | file */
@@ -187,7 +191,7 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
DBUG_RETURN(1);
info->pos_in_file=seek_offset;
info->rc_request_pos=info->rc_pos=info->buffer;
- if (type == READ_CACHE || type == READ_NET)
+ if (type == READ_CACHE || type == READ_NET || type == READ_FIFO)
{
info->rc_end=info->buffer; /* Nothing in cache */
}
@@ -195,7 +199,8 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type,
{
info->rc_end=info->buffer+info->buffer_length-
(seek_offset & (IO_SIZE-1));
- info->end_of_file=(type == READ_NET) ? 0 : MY_FILEPOS_ERROR;
+ info->end_of_file= ((type == READ_NET || type == READ_FIFO) ? 0 :
+ MY_FILEPOS_ERROR);
}
}
info->type=type;
@@ -259,9 +264,10 @@ int _my_b_read(register IO_CACHE *info, byte *Buffer, uint Count)
left_length+=length;
diff_length=0;
}
- max_length=info->end_of_file - pos_in_file;
- if (max_length > info->read_length-diff_length)
- max_length=info->read_length-diff_length;
+ max_length=info->read_length-diff_length;
+ if (info->type != READ_FIFO &&
+ (info->end_of_file - pos_in_file) < max_length)
+ max_length = info->end_of_file - pos_in_file;
if (!max_length)
{
if (Count)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 90b68f074e5..0b0c29efbd4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2200,7 +2200,7 @@ enum options {
OPT_REPLICATE_DO_DB, OPT_REPLICATE_IGNORE_DB,
OPT_LOG_SLAVE_UPDATES, OPT_BINLOG_DO_DB,
OPT_BINLOG_IGNORE_DB, OPT_WANT_CORE,
- OPT_SKIP_CONCURRENT_INSERT, OPT_MEMLOCK
+ OPT_SKIP_CONCURRENT_INSERT, OPT_MEMLOCK, OPT_MYISAM_RECOVER,
};
static struct option long_options[] = {
@@ -2254,6 +2254,7 @@ static struct option long_options[] = {
{"master-port", required_argument, 0, (int) OPT_MASTER_PORT},
{"master-connect-retry", required_argument, 0, (int) OPT_MASTER_CONNECT_RETRY},
{"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE},
+ {"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER},
{"memlock", no_argument, 0, (int) OPT_MEMLOCK},
{"new", no_argument, 0, 'n'},
{"old-protocol", no_argument, 0, 'o'},
@@ -2854,11 +2855,13 @@ static void get_options(int argc,char **argv)
default_table_type=DB_TYPE_ISAM;
myisam_delay_key_write=0;
myisam_concurrent_insert=0;
+ myisam_recover_type= HA_RECOVER_NONE;
break;
case (int) OPT_SAFE:
opt_specialflag|= SPECIAL_SAFE_MODE;
myisam_delay_key_write=0;
myisam_concurrent_insert=0;
+ myisam_recover_type= HA_RECOVER_NONE; // For now
break;
case (int) OPT_SKIP_CONCURRENT_INSERT:
myisam_concurrent_insert=0;
@@ -3020,6 +3023,17 @@ static void get_options(int argc,char **argv)
berkeley_skip=1;
break;
#endif
+ case OPT_MYISAM_RECOVER:
+ {
+ int type;
+ if ((type=find_type(optarg, &myisam_recover_typelib, 2)) <= 0)
+ {
+ fprintf(stderr,"Unknown option to myisam-recover: %s\n",optarg);
+ exit(1);
+ }
+ myisam_recover_type=(myisam_recover_types) (type-1);
+ break;
+ }
case OPT_MASTER_HOST:
master_host=optarg;
break;
diff --git a/sql/share/czech/errmsg.sys b/sql/share/czech/errmsg.sys
index 2c20765abd3..2d048a6f6ba 100644
--- a/sql/share/czech/errmsg.sys
+++ b/sql/share/czech/errmsg.sys
Binary files differ
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index a3ddfefcb71..5991b3f36d4 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -208,3 +208,4 @@
"S-Bí»ová chyba pøi zápisu na master",-A
"-B®ádný sloupec nemá vytvoøen fulltextový index",-A
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/danish/errmsg.sys b/sql/share/danish/errmsg.sys
index fa6e3ed8edc..af7d44e4c2d 100644
--- a/sql/share/danish/errmsg.sys
+++ b/sql/share/danish/errmsg.sys
Binary files differ
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index b711079a2ff..3881a0c525a 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -197,3 +197,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/dutch/errmsg.sys b/sql/share/dutch/errmsg.sys
index a48e905103d..068499d48fd 100644
--- a/sql/share/dutch/errmsg.sys
+++ b/sql/share/dutch/errmsg.sys
Binary files differ
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index c093c4b8ecc..dd97f0a4007 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -194,3 +194,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/english/errmsg.sys b/sql/share/english/errmsg.sys
index 167683fe913..620236eafa6 100644
--- a/sql/share/english/errmsg.sys
+++ b/sql/share/english/errmsg.sys
Binary files differ
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 5b70e96740f..e1bbf40d162 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -194,3 +194,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/estonian/errmsg.sys b/sql/share/estonian/errmsg.sys
index ee70248ab8f..44320e52609 100644
--- a/sql/share/estonian/errmsg.sys
+++ b/sql/share/estonian/errmsg.sys
Binary files differ
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 7bbae9adf86..71ea8bc5b8b 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -198,3 +198,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/french/errmsg.sys b/sql/share/french/errmsg.sys
index 477cef2f131..33eb8bef15a 100644
--- a/sql/share/french/errmsg.sys
+++ b/sql/share/french/errmsg.sys
Binary files differ
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index cf63dc0601d..66a717864fd 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -194,3 +194,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/german/errmsg.sys b/sql/share/german/errmsg.sys
index c80a962568c..055541ae3d9 100644
--- a/sql/share/german/errmsg.sys
+++ b/sql/share/german/errmsg.sys
Binary files differ
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 5c2c50c1540..bdb3ee40844 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -197,3 +197,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/greek/errmsg.sys b/sql/share/greek/errmsg.sys
index 743532a9c75..ee3ea496c11 100644
--- a/sql/share/greek/errmsg.sys
+++ b/sql/share/greek/errmsg.sys
Binary files differ
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index c1db8832650..f09cf02f6f8 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -194,3 +194,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/hungarian/errmsg.sys b/sql/share/hungarian/errmsg.sys
index 712262aa093..dbdd2e67324 100644
--- a/sql/share/hungarian/errmsg.sys
+++ b/sql/share/hungarian/errmsg.sys
Binary files differ
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index e48cab983cf..fd9bc62d093 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -196,3 +196,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/italian/errmsg.sys b/sql/share/italian/errmsg.sys
index dde6350ba4b..c19f29b2d59 100644
--- a/sql/share/italian/errmsg.sys
+++ b/sql/share/italian/errmsg.sys
Binary files differ
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index e09b947e06a..a84ea10af53 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -194,3 +194,4 @@
"Errore di rete inviando al master",
"Impossibile trovare un indice FULLTEXT che corrisponda all'elenco delle colonne",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/japanese/errmsg.sys b/sql/share/japanese/errmsg.sys
index ae5057dd7e0..f437801bf62 100644
--- a/sql/share/japanese/errmsg.sys
+++ b/sql/share/japanese/errmsg.sys
Binary files differ
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 5da104479aa..123c862144b 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -196,3 +196,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/korean/errmsg.sys b/sql/share/korean/errmsg.sys
index 1f2c93f8e42..c8d10748959 100644
--- a/sql/share/korean/errmsg.sys
+++ b/sql/share/korean/errmsg.sys
Binary files differ
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 3ac5a9bb2fa..d373294295f 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -194,3 +194,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 491f913cb47..5581c951ac3 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -196,3 +196,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 967de6da7fc..d41b71a0ac7 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -196,3 +196,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/polish/errmsg.sys b/sql/share/polish/errmsg.sys
index 0b21296d7ee..ab4ed6adbf9 100644
--- a/sql/share/polish/errmsg.sys
+++ b/sql/share/polish/errmsg.sys
Binary files differ
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index f7b492a32d9..6fbb550ebca 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -198,3 +198,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/portuguese/errmsg.sys b/sql/share/portuguese/errmsg.sys
index 12debe72eaf..040cdea0b47 100644
--- a/sql/share/portuguese/errmsg.sys
+++ b/sql/share/portuguese/errmsg.sys
Binary files differ
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index f9fbd57c647..62289c3f2b9 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -194,3 +194,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 5ef2e630e81..bd1d0618027 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -198,3 +198,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/russian/errmsg.sys b/sql/share/russian/errmsg.sys
index 439223e4248..7d57defb1b8 100644
--- a/sql/share/russian/errmsg.sys
+++ b/sql/share/russian/errmsg.sys
Binary files differ
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index 634c1f36249..e70d4e343cb 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -197,3 +197,4 @@
"Net error writing to master",
"FULLTEXT ÉÎÄÅËÓ, ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÉÊ ÚÁÄÁÎÎÏÍÕ ÓÐÉÓËÕ ÓÔÏÌÂÃÏ×, ÎÅ ÎÁÊÄÅÎ",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/slovak/errmsg.sys b/sql/share/slovak/errmsg.sys
index 9efe926ff15..cdcd6e8d39f 100644
--- a/sql/share/slovak/errmsg.sys
+++ b/sql/share/slovak/errmsg.sys
Binary files differ
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 485fff107ed..24176719e1f 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -202,3 +202,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/spanish/errmsg.sys b/sql/share/spanish/errmsg.sys
index e90aac38bc5..fd0aeb829b1 100644
--- a/sql/share/spanish/errmsg.sys
+++ b/sql/share/spanish/errmsg.sys
Binary files differ
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 6a26480f7d4..cdf40b428d9 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -195,3 +195,4 @@
"Net error writing to master",
"Can't find FULLTEXT index matching the column list",
"Can't execute the given command because you have active locked tables or an active transaction",
+"Unknown system variable '%-.64'",
diff --git a/sql/share/swedish/errmsg.OLD b/sql/share/swedish/errmsg.OLD
index 233a60a5221..7551e8e8831 100644
--- a/sql/share/swedish/errmsg.OLD
+++ b/sql/share/swedish/errmsg.OLD
@@ -192,5 +192,7 @@
"Fick en master: '%-.64s'",
"Fick nätverksfel vid läsning från master",
"Fick nätverksfel vid skrivning till master",
-"Hittar inte ett FULLTEXT index i kolumnlist",
-"Can't execute the given command because you have active locked tables or an active transaction",
+"Hittar inte ett FULLTEXT index i kolumnlistan",
+"Kan inte exekvera kommandot emedan du har en låst tabell eller an aktiv transaktion",
+#ER_UNKNOWN_SYSTEM_VARIABLE
+"Okänd system variabel '%-.64'",
diff --git a/sql/share/swedish/errmsg.sys b/sql/share/swedish/errmsg.sys
index ea9ae0f32fd..aa35854cdbd 100644
--- a/sql/share/swedish/errmsg.sys
+++ b/sql/share/swedish/errmsg.sys
Binary files differ
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index 233a60a5221..bf5c48af10d 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -192,5 +192,6 @@
"Fick en master: '%-.64s'",
"Fick nätverksfel vid läsning från master",
"Fick nätverksfel vid skrivning till master",
-"Hittar inte ett FULLTEXT index i kolumnlist",
-"Can't execute the given command because you have active locked tables or an active transaction",
+"Hittar inte ett FULLTEXT index i kolumnlistan",
+"Kan inte exekvera kommandot emedan du har en låst tabell eller an aktiv transaktion",
+"Okänd system variabel '%-.64'",
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c8b8589bc7a..711ea291e5d 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -66,8 +66,10 @@ static int send_file(THD *thd)
}
fn_format(fname, (char*)net->read_pos + 1, "", "", 4);
- if(!strcmp(fname,"/dev/null")) goto end; // this is needed to make replicate-ignore-db
- // work on the well-known system that does not have a /dev/null :-)
+ // this is needed to make replicate-ignore-db
+ if (!strcmp(fname,"/dev/null"))
+ goto end;
+ // TODO: work on the well-known system that does not have a /dev/null :-)
if ((fd = my_open(fname, O_RDONLY, MYF(MY_WME))) < 0)
{
@@ -1951,6 +1953,22 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
/* Check if we are using outer joins */
for (TABLE_LIST *table=tables ; table ; table=table->next)
{
+ if (table->on_expr)
+ {
+ /* Make a join an a expression */
+ thd->where="on clause";
+ if (table->on_expr->fix_fields(thd,tables))
+ DBUG_RETURN(1);
+ thd->cond_count++;
+
+ /* If it's a normal join, add the ON/USING expression to the WHERE */
+ if (!table->outer_join)
+ {
+ if (!(*conds=and_conds(*conds, table->on_expr)))
+ DBUG_RETURN(1);
+ table->on_expr=0;
+ }
+ }
if (table->natural_join)
{
/* Make a join of all fields with have the same name */
@@ -1990,23 +2008,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
DBUG_RETURN(1);
}
else
- table->on_expr=cond_and;
- }
- else if (table->on_expr)
- {
- /* Make a join an a expression */
- thd->where="on clause";
- if (table->on_expr->fix_fields(thd,tables))
- DBUG_RETURN(1);
- thd->cond_count++;
-
- /* If it's a normal join, add the ON/USING expression to the WHERE */
- if (!table->outer_join)
- {
- if (!(*conds=and_conds(*conds, table->on_expr)))
- DBUG_RETURN(1);
- table->on_expr=0;
- }
+ table->on_expr=and_conds(table->on_expr,cond_and);
}
}
DBUG_RETURN(test(thd->fatal_error));
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 5c816aa8dc5..85732863732 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -91,8 +91,7 @@ exit:
}
const char *del_exts[]=
-{".frm",".ISM",".ISD",".ISM",".HSH",".DAT",".MRG",".PSM",".MYI",".MYD", ".db",
- NullS};
+{".frm",".ISM",".ISD",".ISM",".HSH",".DAT",".MRG",".MYI",".MYD", ".db", ".BAK", NullS};
static TYPELIB deletable_extentions=
{array_elements(del_exts)-1,"del_exts", del_exts};
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index ef64b5e3bfa..633855a18fa 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -42,7 +42,7 @@ public:
READ_INFO(File file,uint tot_length,
String &field_term,String &line_start,String &line_term,
- String &enclosed,int escape,bool get_it_from_net);
+ String &enclosed,int escape,bool get_it_from_net, bool is_fifo);
~READ_INFO();
int read_field();
int read_fixed_length(void);
@@ -70,6 +70,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
uint save_skip_lines = ex->skip_lines;
String *field_term=ex->field_term,*escaped=ex->escaped,
*enclosed=ex->enclosed;
+ bool is_fifo=0;
DBUG_ENTER("mysql_load");
if (escaped->length() > 1 || enclosed->length() > 1)
@@ -161,22 +162,16 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN(-1);
// the file must be:
- if (!(
- (stat_info.st_mode & S_IROTH) == S_IROTH
- && // readable by others
- (stat_info.st_mode & S_IFLNK) != S_IFLNK
- && // and not a symlink
- ((stat_info.st_mode & S_IFREG) == S_IFREG
- ||
- (stat_info.st_mode & S_IFIFO) == S_IFIFO
- )
- // and either regular or a pipe
- )
- )
+ if (!((stat_info.st_mode & S_IROTH) == S_IROTH && // readable by others
+ (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
+ ((stat_info.st_mode & S_IFREG) == S_IFREG ||
+ (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
{
my_error(ER_TEXTFILE_NOT_READABLE,MYF(0),name);
DBUG_RETURN(-1);
}
+ if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
+ is_fifo = 1;
#endif
}
if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
@@ -190,7 +185,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
READ_INFO read_info(file,tot_length,*field_term,
*ex->line_start, *ex->line_term, *enclosed,
- info.escape_char,read_file_from_client);
+ info.escape_char, read_file_from_client, is_fifo);
if (read_info.error)
{
if (file >= 0)
@@ -423,7 +418,8 @@ READ_INFO::unescape(char chr)
READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
String &line_start, String &line_term,
- String &enclosed_par, int escape, bool get_it_from_net)
+ String &enclosed_par, int escape, bool get_it_from_net,
+ bool is_fifo)
:file(file_par),escape_char(escape)
{
field_term_ptr=(char*) field_term.ptr();
@@ -467,7 +463,8 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
{
end_of_buff=buffer+buff_length;
if (init_io_cache(&cache,(get_it_from_net) ? -1 : file, 0,
- (get_it_from_net) ? READ_NET : READ_CACHE,0L,1,
+ (get_it_from_net) ? READ_NET :
+ (is_fifo ? READ_FIFO : READ_CACHE),0L,1,
MYF(MY_WME)))
{
my_free((gptr) buffer,MYF(0)); /* purecov: inspected */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e3347aebd5d..d8504cf5fd6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2387,7 +2387,13 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
void add_join_on(TABLE_LIST *b,Item *expr)
{
- b->on_expr=expr;
+ if (!b->on_expr)
+ b->on_expr=expr;
+ else
+ {
+ // This only happens if you have both a right and left join
+ b->on_expr=new Item_cond_and(b->on_expr,expr);
+ }
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 54569e241e0..450efb84e5d 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -810,7 +810,10 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
}
s->key_dependent=s->dependent=
s->on_expr->used_tables() & ~(table->map);
- s->dependent|=stat_vector[i-1]->dependent | table_vector[i-1]->map;
+ if (table->outer_join & JOIN_TYPE_LEFT)
+ s->dependent|=stat_vector[i-1]->dependent | table_vector[i-1]->map;
+ if (tables->outer_join & JOIN_TYPE_RIGHT)
+ s->dependent|=tables->next->table->map;
outer_join|=table->map;
continue;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 093f305fded..3cb40d7d9ed 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -837,19 +837,18 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->table = open_ltable(thd, table, lock_type);
packet->length(0);
- if(operator_func == &handler::restore)
- {
- switch(prepare_for_restore(thd, table))
- {
- case 1: continue; // error, message written to net
- case -1: goto err; // error, message could be written to net
- default: ;// should be 0 otherwise
- }
-
- // now we should be able to open the partially restored table
- // to finish the restore in the handler later on
- table->table = reopen_name_locked_table(thd, table);
+ if (operator_func == &handler::restore)
+ {
+ switch (prepare_for_restore(thd, table)) {
+ case 1: continue; // error, message written to net
+ case -1: goto err; // error, message could be written to net
+ default: ;// should be 0 otherwise
}
+
+ // now we should be able to open the partially restored table
+ // to finish the restore in the handler later on
+ table->table = reopen_name_locked_table(thd, table);
+ }
if (!table->table)
{
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index ead4e38628d..1fde60accea 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1392,6 +1392,7 @@ simple_expr:
| literal
| '@' ident_or_text SET_VAR expr { $$= new Item_func_set_user_var($2,$4); }
| '@' ident_or_text { $$= new Item_func_get_user_var($2); }
+ | '@' '@' ident_or_text { if (!($$= get_system_var($3))) YYABORT; }
| sum_expr
| '-' expr %prec NEG { $$= new Item_func_neg($2); }
| '~' expr %prec NEG { $$= new Item_func_bit_neg($2); }
@@ -1700,14 +1701,23 @@ join_table_list:
USING '(' using_list ')'
{ add_join_on($4,$8); $$=$4; }
| join_table_list LEFT opt_outer JOIN_SYM join_table ON expr
- { add_join_on($5,$7); $5->outer_join=1; $$=$5; }
+ { add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
| join_table_list LEFT opt_outer JOIN_SYM join_table
{ Lex->db1=$1->db; Lex->table1=$1->name;
Lex->db2=$5->db; Lex->table2=$5->name; }
USING '(' using_list ')'
- { add_join_on($5,$9); $5->outer_join=1; $$=$5; }
+ { add_join_on($5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
| join_table_list NATURAL LEFT opt_outer JOIN_SYM join_table
- { add_join_natural($1,$6); $6->outer_join=1; $$=$6; }
+ { add_join_natural($1,$6); $6->outer_join|=JOIN_TYPE_LEFT; $$=$6; }
+ | join_table_list RIGHT opt_outer JOIN_SYM join_table ON expr
+ { add_join_on($1,$7); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; }
+ | join_table_list RIGHT opt_outer JOIN_SYM join_table
+ { Lex->db1=$1->db; Lex->table1=$1->name;
+ Lex->db2=$5->db; Lex->table2=$5->name; }
+ USING '(' using_list ')'
+ { add_join_on($1,$9); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; }
+ | join_table_list NATURAL RIGHT opt_outer JOIN_SYM join_table
+ { add_join_natural($6,$1); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; }
| join_table_list NATURAL JOIN_SYM join_table
{ add_join_natural($1,$4); $$=$4; }
@@ -1722,7 +1732,7 @@ join_table:
{ if (!($$=add_table_to_list($2,$3,TL_UNLOCK, Lex->use_index_ptr,
Lex->ignore_index_ptr))) YYABORT; }
| '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}'
- { add_join_on($7,$9); $7->outer_join=1; $$=$7; }
+ { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
opt_outer:
/* empty */ {}
diff --git a/sql/table.cc b/sql/table.cc
index 682cd880fe1..ac70387df5a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -451,8 +451,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (ha_option & HA_HAVE_KEY_READ_ONLY &&
field->key_length() == key_part->length)
{
- if (field->key_type() != HA_KEYTYPE_TEXT ||
- !(ha_option & HA_KEY_READ_WRONG_STR))
+ if (field->key_type() != HA_KEYTYPE_TEXT &&
+ !(ha_option & HA_KEY_READ_WRONG_STR) &&
+ !(keyinfo->flags & HA_FULLTEXT))
field->part_of_key|= ((key_map) 1 << key);
}
if (!(key_part->key_part_flag & HA_REVERSE_SORT) &&
diff --git a/sql/table.h b/sql/table.h
index 198e0d6e801..f7d81e690eb 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -123,15 +123,18 @@ struct st_table {
};
+#define JOIN_TYPE_LEFT 1
+#define JOIN_TYPE_RIGHT 2
+
typedef struct st_table_list {
struct st_table_list *next;
char *db,*name,*real_name;
- thr_lock_type lock_type;
- bool straight; /* optimize with prev table */
- bool outer_join;
- TABLE *table;
Item *on_expr; /* Used with outer join */
struct st_table_list *natural_join; /* natural join on this table*/
List<String> *use_index,*ignore_index;
+ TABLE *table;
GRANT_INFO grant;
+ thr_lock_type lock_type;
+ uint outer_join; /* Which join type */
+ bool straight; /* optimize with prev table */
} TABLE_LIST;