BitKeeper/etc/logging_ok:
  Auto merged
Docs/manual.texi:
  Merge
This commit is contained in:
unknown 2000-09-26 02:59:26 +03:00
commit f0c7c83841
84 changed files with 467 additions and 204 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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);

View file

@ -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,

View file

@ -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);

View file

@ -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,

View file

@ -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);

View file

@ -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));
}
}

View file

@ -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);

View file

@ -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,

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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;
}

View file

@ -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)},

View file

@ -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)

View file

@ -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;

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

View file

@ -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'",

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

View file

@ -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'",

Binary file not shown.

View file

@ -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'",

View file

@ -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));

View file

@ -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};

View file

@ -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 */

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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)
{

View file

@ -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 */ {}

View file

@ -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) &&

View file

@ -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;