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 466 additions and 203 deletions

View file

@ -581,7 +581,7 @@ Speed of queries that access or update data
* Estimating performance:: Estimating query performance
* SELECT speed:: Speed of @code{SELECT} queries
* Where optimizations:: How MySQL optimizes @code{WHERE} clauses
* LEFT JOIN optimization:: How MySQL optimizes @code{LEFT JOIN}
* LEFT JOIN optimization:: How MySQL optimizes @code{LEFT JOIN} and @code{RIGHT JOIN}
* LIMIT optimization:: How MySQL optimizes @code{LIMIT}
* Insert speed:: Speed of @code{INSERT} queries
* Update speed:: Speed of @code{UPDATE} queries
@ -9056,7 +9056,7 @@ almost always sorted. In 3.23, you must use @code{GROUP BY} or
@code{SUM()} now returns @code{NULL}, instead of 0, if there is no matching
rows. This is according to ANSI SQL.
@item
New restricted words: @code{CASE, THEN, WHEN, ELSE and END}
New restricted words: @code{CASE, THEN, WHEN, ELSE, END and RIGHT}
@item An @code{AND} or @code{OR} with @code{NULL} values will now return
@code{NULL} instead of 0. This mostly affects queries that uses @code{NOT}
on an @code{AND/OR} expression as @code{NOT NULL} = @code{NULL}.
@ -16511,10 +16511,22 @@ DROP DATABASE [IF EXISTS] db_name
@code{DROP DATABASE} drops all tables in the database and deletes the
database. @strong{Be VERY careful with this command!}
@code{DROP DATABASE} returns the number of files that were removed from the
database directory. Normally, this is three times the number of tables,
because each table corresponds to a @file{.MYD} file, a @file{.MYI} file and a
@file{.frm} file.
@code{DROP DATABASE} returns the number of files that were removed from
the database directory. Normally, this is three times the number of
tables, because normally each table corresponds to a @file{.MYD} file, a
@file{.MYI} file and a @file{.frm} file.
The @code{DROP DATABASE} command removes from the given database
directory all files with the following extensions:
@multitable @columnfractions .25 .25 .25 .25
@item .BAK @tab .DAT @tab .HSH @tab .ISD
@item .ISM @tab .ISM @tab .MRG @tab .MYD
@item .MYI @tab .db @tab .frm
@end multitable
All sub directories that consists of 2 digits (@code{RAID} directories)
are also removed.
In @strong{MySQL} 3.22 or later, you can use the keywords @code{IF EXISTS} to
prevent an error from occurring if the database doesn't exist.
@ -17719,6 +17731,10 @@ store a blob in a file.
@findex LEFT OUTER JOIN
@findex NATURAL LEFT JOIN
@findex NATURAL LEFT OUTER JOIN
@findex RIGHT JOIN
@findex RIGHT OUTER JOIN
@findex NATURAL RIGHT JOIN
@findex NATURAL RIGHT OUTER JOIN
@findex STRAIGHT_JOIN
@node JOIN, INSERT, SELECT, Reference
@section @code{JOIN} syntax
@ -17735,6 +17751,9 @@ table_reference LEFT [OUTER] JOIN table_reference join_condition
table_reference LEFT [OUTER] JOIN table_reference
table_reference NATURAL [LEFT [OUTER]] JOIN table_reference
@{ oj table_reference LEFT OUTER JOIN table_reference ON conditional_expr @}
table_reference RIGHT [OUTER] JOIN table_reference join_condition
table_reference RIGHT [OUTER] JOIN table_reference
table_reference NATURAL [RIGHT [OUTER]] JOIN table_reference
@end example
Where @code{table_reference} is defined as
@ -17791,7 +17810,7 @@ mysql> select table1.* from table1
This example finds all rows in @code{table1} with an @code{id} value that is
not present in @code{table2} (i.e., all rows in @code{table1} with no
corresponding row in @code{table2}). This assumes that @code{table2.id} is
declared @code{NOT NULL}, of course.
declared @code{NOT NULL}, of course. @xref{LEFT JOIN optimization}.
@item
The @code{USING} @code{(column_list)} clause names a list of columns that must
@ -17814,6 +17833,11 @@ semantically equivalent to a @code{INNER JOIN} or a @code{LEFT JOIN}
with a @code{USING} clause that names all columns that exist in both
tables.
@item
@code{RIGHT JOIN} works analogously as @code{LEFT JOIN}. To keep code
portable across databases, it's recommended to use @code{LEFT JOIN}
instead of @code{RIGHT JOIN}.
@item
@code{STRAIGHT_JOIN} is identical to @code{JOIN}, except that the left table
is always read before the right table. This can be used for those (few)
@ -18158,9 +18182,11 @@ files directly, because the contents of the file must travel from the client
host to the server host. On the other hand, you do not need the
@strong{file} privilege to load local files.
Note that you can't read from a FIFO with @code{LOAD DATA INFILE}; If
you need to read from a FIFO (for example the output from gunzip), use
@code{LOAD DATA LOCAL INFILE} instead.
@c old version
If you are using @strong{MySQL} before 3.23.24 you can't read from a
FIFO with @code{LOAD DATA INFILE}; If you need to read from a FIFO (for
example the output from gunzip), use @code{LOAD DATA LOCAL INFILE}
instead.
@cindex @code{mysqlimport}
You can also load data files by using the @code{mysqlimport} utility; it
@ -18574,7 +18600,7 @@ well. If you get warnings and want to know exactly why you got them, one way
to do this is to use @code{SELECT ... INTO OUTFILE} into another file and
compare this to your original input file.
If you need @code{LOAD DATA INFILE} to read from a pipe, you can use the
If you need @code{LOAD DATA} to read from a pipe, you can use the
following trick:
@example
@ -18584,6 +18610,9 @@ cat < /dev/tcp/10.1.1.12/4711 > /nt/mysql/db/x/x
mysql -e "LOAD DATA INFILE 'x' INTO TABLE x" x
@end example
If you are using and older @strong{MySQL} version than 3.23.25
you can only do the above with @code{LOAD DATA LOCAL INFILE}.
For more information about the efficiency of @code{INSERT} versus
@code{LOAD DATA INFILE} and speeding up @code{LOAD DATA INFILE},
@xref{Insert speed}.
@ -25578,7 +25607,7 @@ mysql> SELECT ... FROM tbl_name ORDER BY key_part1 DESC,key_part2 DESC,...
@end example
@node LEFT JOIN optimization, LIMIT optimization, Where optimizations, Query Speed
@subsection How MySQL optimizes @code{LEFT JOIN}
@subsection How MySQL optimizes @code{LEFT JOIN} and @code{RIGHT JOIN}
@code{A LEFT JOIN B} is in @strong{MySQL} implemented as follows:
@ -25610,9 +25639,12 @@ table and you have the following test: @code{column_name IS NULL} in the
matches the @code{LEFT JOIN} condition.
@end itemize
The table read order forced by @code{LEFT JOIN} and @code{STRAIGHT JOIN} will help
the join optimizer (which calculates in which order tables should be joined) to do
its work much more quickly as there are fewer table permutations to check.
@code{RIGHT JOIN} is implemented analogously as @code{LEFT JOIN}.
The table read order forced by @code{LEFT JOIN} and @code{STRAIGHT JOIN}
will help the join optimizer (which calculates in which order tables
should be joined) to do its work much more quickly as there are fewer
table permutations to check.
Note that the above means that if you do a query of type:
@ -25620,8 +25652,8 @@ Note that the above means that if you do a query of type:
SELECT * FROM a,b LEFT JOIN c ON (c.key=a.key) LEFT JOIN d (d.key=a.key) WHERE b.key=d.key
@end example
Then @strong{MySQL} will do a full scan on @code{b} as the @code{LEFT JOIN} will
force it to be read before @code{d}.
Then @strong{MySQL} will do a full scan on @code{b} as the @code{LEFT
JOIN} will force it to be read before @code{d}.
The fix in this case is to change the query to:
@ -30088,11 +30120,17 @@ clients connected to the @code{mysqld} server.
If you need more connections than the default (100), then you should restart
@code{mysqld} with a bigger value for the @code{max_connections} variable.
Note that @code{mysqld} actually allows (@code{max_connections}+1) clients to connect.
The last connection is reserved for a user with the @strong{process} privilege.
By not giving this privilege to normal users (they shouldn't need this), an
administrator with this privilege can login and use @code{SHOW PROCESSLIST}
to find out what could be wrong. @xref{SHOW}.
Note that @code{mysqld} actually allows (@code{max_connections}+1)
clients to connect. The last connection is reserved for a user with the
@strong{process} privilege. By not giving this privilege to normal
users (they shouldn't need this), an administrator with this privilege
can login and use @code{SHOW PROCESSLIST} to find out what could be
wrong. @xref{SHOW}.
The maximum number of connects @strong{MySQL} is depending on how good
the thread library is on a given platform. Linux or Solaris should be
able to support 500-1000 simultaneous connections, depending on how much
RAM you have and what your clients are doing.
@node Out of memory, Packet too large, Too many connections, Common errors
@subsection @code{Out of memory} error
@ -30527,6 +30565,10 @@ shell> export UMASK_DIR
shell> /path/to/safe_mysqld &
@end example
In @strong{MySQL} 3.23.25 and above, @strong{MySQL} assumes that the
value for @code{UMASK} and @code{UMASK_DIR} is in octal if it starts
with a zero.
@xref{Environment variables}.
@node Not enough file handles, Using DATE, File permissions , Problems
@ -36754,6 +36796,20 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.25
@itemize @bullet
@item
Fixed that databasename works as second argument to @code{mysqlhotcopy}.
@item
@code{UMASK} and @code{UMASK_DIR} can now be specified in octal.
@item
Added @code{RIGHT JOIN}. This makes @code{RIGHT} a reserved word.
@item
Added @code{@@@@IDENTITY} as a synonym for @code{LAST_INSERT_ID()}.
(for Visual Basic)
@item
Fixed bug in myisamchk and @code{REPAIR} when using @code{FULLTEXT} index.
@item
@code{LOAD DATA INFILE} now works for FIFO's.
(Patch by Toni L. Harbaugh-Blackford).
@item
@code{FLUSH LOGS} broke replication if one had @code{log-bin} with
a log with explicit extension
@item
@ -41551,6 +41607,10 @@ If @code{mysqld} hangs you can try to use some system tools like
@code{strace} or @code{/usr/proc/bin/pstack} to examine where
@code{mysqld} has hung.
@example
strace /tmp/log libexec/mysqld
@end example
If @code{mysqld} starts to eat up CPU or memory or if it ``hangs'', you
can use @code{mysqladmin processlist status} to find out if someone is
executing a query that takes a long time. It may be a good idea to

View file

@ -1409,19 +1409,20 @@ print_table_data_html(MYSQL_RES *result)
MYSQL_FIELD *field;
mysql_field_seek(result,0);
printf("<TABLE BORDER=1>\n");
printf("<TR>\n");
fputs("<TABLE BORDER=1><TR>",stdout);
if (!skip_column_names)
{
while((field = mysql_fetch_field(result)))
{
printf("<TH>%s</TH>",field->name ? (field->name[0] ? field->name:" &nbsp; "):"NULL");
printf("<TH>%s</TH>", (field->name ? (field->name[0] ? field->name :
" &nbsp; ") :
"NULL"));
}
puts("\n</TR>");
puts("</TR>");
}
while ((cur = mysql_fetch_row(result)))
{
puts("<TR>");
fputs("<TR>",stdout);
for (uint i=0; i < mysql_num_fields(result); i++)
{
ulong *lengths=mysql_fetch_lengths(result);
@ -1429,7 +1430,7 @@ print_table_data_html(MYSQL_RES *result)
safe_put_field(cur[i],lengths[i]);
fputs("</TD>",stdout);
}
puts("\n</TR>");
puts("</TR>");
}
puts("</TABLE>");
}

View file

@ -17,7 +17,7 @@
/* Return error-text for system error messages and nisam messages */
#define PERROR_VERSION "2.3"
#define PERROR_VERSION "2.4"
#include <global.h>
#include <my_sys.h>
@ -64,6 +64,7 @@ static HA_ERRORS ha_errlist[]=
{ 141,"Duplicate unique on write or update"},
{ 142,"Unknown character set used"},
{ 143,"Conflicting table definition between MERGE and mapped table"},
{ 144,"Table is crashed and last repair failed"},
{ 0,NullS },
};

View file

@ -43,8 +43,9 @@
#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */
#define HA_OPEN_WAIT_IF_LOCKED 1
#define HA_OPEN_IGNORE_IF_LOCKED 2
#define HA_OPEN_TMP_TABLE 4
#define HA_OPEN_DELAY_KEY_WRITE 8
#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */
#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
#define HA_OPEN_ABORT_IF_CRASHED 16
/* The following is parameter to ha_rkey() how to use key */
@ -163,7 +164,7 @@ enum ha_base_keytype {
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
/* Bits in flag to ni_create() */
/* Bits in flag to create() */
#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */
#define HA_PACK_RECORD 2 /* Request packed record format */
@ -203,6 +204,7 @@ enum ha_base_keytype {
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
#define HA_ERR_WRONG_TABLE_DEF 143
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
/* Other constants */

View file

@ -62,6 +62,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
#define MY_COPYTIME 64 /* my_redel() copys time */
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
#define MY_REDEL_MAKE_BACKUP 256
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
@ -219,7 +220,7 @@ typedef struct st_typelib { /* Different types saved here */
const char **type_names;
} TYPELIB;
enum cache_type {READ_CACHE,WRITE_CACHE,READ_NET,WRITE_NET};
enum cache_type {READ_CACHE,WRITE_CACHE,READ_FIFO,READ_NET,WRITE_NET};
enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED,
FLUSH_FORCE_WRITE};

View file

@ -273,9 +273,11 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def);
#define T_CREATE_MISSING_KEYS T_TRUST_HEADER*2
#define T_SAFE_REPAIR T_CREATE_MISSING_KEYS*2
#define T_AUTO_REPAIR T_SAFE_REPAIR*2
#define T_BACKUP_DATA T_AUTO_REPAIR*2
#define O_NEW_INDEX 1 /* Bits set in out_flag */
#define O_NEW_DATA 2
#define O_DATA_LOST 4
/* these struct is used by my_check to tell it what to do */
@ -359,7 +361,8 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name);
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
const char * name, int rep_quick);
int change_to_newfile(const char * filename, const char * old_ext,
const char * new_ext, uint raid_chunks);
const char * new_ext, uint raid_chunks,
myf myflags);
int lock_file(MI_CHECK *param, File file, my_off_t start, int lock_type,
const char *filetype, const char *filename);
void lock_memory(MI_CHECK *param);
@ -378,7 +381,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
int test_if_almost_full(MI_INFO *info);
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows);
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, my_bool force);
#ifdef __cplusplus
}

View file

@ -193,4 +193,5 @@
#define ER_MASTER_NET_WRITE 1190
#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
#define ER_ERROR_MESSAGES 193
#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
#define ER_ERROR_MESSAGES 194

View file

@ -1246,7 +1246,6 @@ err:
MYF(MY_WME)));
}
mi_mark_crashed_on_repair(info);
info->update|= HA_STATE_CHANGED;
}
if (sort_info->record)
my_free(sort_info->record,MYF(0));
@ -1544,7 +1543,8 @@ err:
int change_to_newfile(const char * filename, const char * old_ext,
const char * new_ext,
uint raid_chunks __attribute__((unused)))
uint raid_chunks __attribute__((unused)),
myf MyFlags)
{
char old_filename[FN_REFLEN],new_filename[FN_REFLEN];
#ifdef USE_RAID
@ -1552,11 +1552,11 @@ int change_to_newfile(const char * filename, const char * old_ext,
return my_raid_redel(fn_format(old_filename,filename,"",old_ext,2+4),
fn_format(new_filename,filename,"",new_ext,2+4),
raid_chunks,
MYF(MY_WME+MY_LINK_WARNING));
MYF(MY_WME | MY_LINK_WARNING | MyFlags));
#endif
return my_redel(fn_format(old_filename,filename,"",old_ext,2+4),
fn_format(new_filename,filename,"",new_ext,2+4),
MYF(MY_WME+MY_LINK_WARNING));
MYF(MY_WME | MY_LINK_WARNING | MyFlags));
} /* change_to_newfile */
@ -1901,9 +1901,10 @@ err:
VOID(my_close(new_file,MYF(0)));
VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
MYF(MY_WME)));
if (info->dfile == new_file)
info->dfile=0;
}
mi_mark_crashed_on_repair(info);
info->update|= HA_STATE_CHANGED;
}
else if (key_map == share->state.key_map)
share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS;
@ -1986,7 +1987,11 @@ static int sort_get_next_record(SORT_INFO *sort_info)
{
if (my_b_read(&param->read_cache,sort_info->record,
share->base.pack_reclength))
{
if (param->read_cache.error)
param->out_flag |= O_DATA_LOST;
DBUG_RETURN(-1);
}
sort_info->start_recpos=sort_info->pos;
if (!sort_info->fix_datafile)
sort_info->filepos=sort_info->pos;
@ -2179,14 +2184,14 @@ static int sort_get_next_record(SORT_INFO *sort_info)
param->read_cache.end_of_file)
{
mi_check_print_info(param,"Found block that points outside data file at %s",
llstr(sort_info->start_recpos,llbuff));
llstr(sort_info->start_recpos,llbuff));
goto try_next;
}
if (_mi_read_cache(&param->read_cache,to,block_info.filepos,
block_info.data_len, test(found_record == 1)))
{
mi_check_print_info(param,"Read error for block at: %s (error: %d); Skipped",
llstr(block_info.filepos,llbuff),my_errno);
llstr(block_info.filepos,llbuff),my_errno);
goto try_next;
}
left_length-=block_info.data_len;
@ -2195,13 +2200,14 @@ static int sort_get_next_record(SORT_INFO *sort_info)
if (pos == HA_OFFSET_ERROR && left_length)
{
mi_check_print_info(param,"Wrong block with wrong total length starting at %s",
llstr(sort_info->start_recpos,llbuff));
llstr(sort_info->start_recpos,llbuff));
goto try_next;
}
if (pos + MI_BLOCK_INFO_HEADER_LENGTH > param->read_cache.end_of_file)
{
mi_check_print_info(param,"Found link that points at %s (outside data file) at %s",
llstr(pos,llbuff2), llstr(sort_info->start_recpos,llbuff));
llstr(pos,llbuff2),
llstr(sort_info->start_recpos,llbuff));
goto try_next;
}
} while (left_length);
@ -2218,7 +2224,7 @@ static int sort_get_next_record(SORT_INFO *sort_info)
if (_mi_rec_check(info, sort_info->record))
{
mi_check_print_info(param,"Found wrong packed record at %s",
llstr(sort_info->start_recpos,llbuff));
llstr(sort_info->start_recpos,llbuff));
goto try_next;
}
}
@ -2251,7 +2257,8 @@ static int sort_get_next_record(SORT_INFO *sort_info)
{
if (! searching)
mi_check_print_info(param,"Found block with wrong recordlength: %d at %s\n",
block_info.rec_len, llstr(sort_info->pos,llbuff));
block_info.rec_len,
llstr(sort_info->pos,llbuff));
continue;
}
if (_mi_read_cache(&param->read_cache,(byte*) info->rec_buff,
@ -2259,14 +2266,15 @@ static int sort_get_next_record(SORT_INFO *sort_info)
{
if (! searching)
mi_check_print_info(param,"Couldn't read hole record from %s",
llstr(sort_info->pos,llbuff));
llstr(sort_info->pos,llbuff));
continue;
}
if (_mi_pack_rec_unpack(info,sort_info->record,info->rec_buff,
block_info.rec_len))
{
if (! searching)
mi_check_print_info(param,"Found wrong record at %s", llstr(sort_info->pos,llbuff));
mi_check_print_info(param,"Found wrong record at %s",
llstr(sort_info->pos,llbuff));
continue;
}
if (!sort_info->fix_datafile)
@ -3011,9 +3019,13 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
}
/* Return TRUE if we can use repair by sorting */
/*
Return TRUE if we can use repair by sorting
One can set the force argument to force to use sorting
even if the temporary file would be quite big!
*/
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows)
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows, my_bool force)
{
MYISAM_SHARE *share=info->s;
uint i;

View file

@ -392,7 +392,7 @@ int _mi_test_if_changed(register MI_INFO *info)
} /* _mi_test_if_changed */
/* Put a mark in the .ISM file that someone is updating the table */
/* Put a mark in the .MYI file that someone is updating the table */
int _mi_mark_file_changed(MI_INFO *info)
{

View file

@ -57,16 +57,14 @@ static MI_INFO *test_if_reopen(char *filename)
/******************************************************************************
open a isam database.
if handle_locking is 0 then exit with error if database is locked
if handle_locking is 1 then wait if database is locked
if handle_locking is 2 then continue, but count-vars in st_i_info
may be wrong. count-vars are automaticly fixed after next isam
request.
open a MyISAM database.
See my_base.h for the handle_locking argument
if handle_locking and HA_OPEN_ABORT_IF_CRASHED then abort if the table
is marked crashed or if we are not using locking and the table doesn't
have an open count of 0.
******************************************************************************/
MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
MI_INFO *mi_open(const char *name, int mode, uint open_flags)
{
int lock_error,kfile,open_mode,save_errno;
uint i,j,len,errpos,head_length,base_pos,offset,info_length,extra,keys,
@ -139,12 +137,12 @@ MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
errpos=2;
VOID(my_seek(kfile,0L,MY_SEEK_SET,MYF(0)));
if (!(handle_locking & HA_OPEN_TMP_TABLE))
if (!(open_flags & HA_OPEN_TMP_TABLE))
{
if ((lock_error=my_lock(kfile,F_RDLCK,0L,F_TO_EOF,
MYF(handle_locking & HA_OPEN_WAIT_IF_LOCKED ?
MYF(open_flags & HA_OPEN_WAIT_IF_LOCKED ?
0 : MY_DONT_WAIT))) &&
!(handle_locking & HA_OPEN_IGNORE_IF_LOCKED))
!(open_flags & HA_OPEN_IGNORE_IF_LOCKED))
goto err;
}
errpos=3;
@ -176,6 +174,14 @@ MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
disk_pos=my_n_base_info_read(disk_cache+base_pos, &share->base);
share->state.state_length=base_pos;
if ((open_flags & HA_OPEN_ABORT_IF_CRASHED) &&
((share->state.changed & STATE_CRASHED) ||
(my_disable_locking && share->state.open_count)))
{
my_errno=((share->state.changed & STATE_CRASHED_ON_REPAIR) ?
HA_ERR_CRASHED_ON_REPAIR : HA_ERR_CRASHED);
goto err;
}
/* Correct max_file_length based on length of sizeof_t */
max_data_file_length=
(share->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ?
@ -273,7 +279,10 @@ MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
}
}
if (share->keyinfo[i].flag & HA_FULLTEXT) /* SerG */
{
share->keyinfo[i].seg=pos-FT_SEGS; /* SerG */
share->fulltext_index=1;
}
share->keyinfo[i].end=pos;
pos->type=HA_KEYTYPE_END; /* End */
pos->length=share->base.rec_reflength;
@ -401,7 +410,7 @@ MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
((share->options & (HA_OPTION_READ_ONLY_DATA | HA_OPTION_TMP_TABLE |
HA_OPTION_COMPRESS_RECORD |
HA_OPTION_TEMP_COMPRESS_RECORD)) ||
(handle_locking & HA_OPEN_TMP_TABLE)) ? 0 : 1;
(open_flags & HA_OPEN_TMP_TABLE)) ? 0 : 1;
if (share->concurrent_insert)
{
share->lock.get_status=mi_get_status;
@ -484,7 +493,7 @@ MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
info.lock_type=F_RDLCK;
share->r_locks++;
}
if ((handle_locking & HA_OPEN_TMP_TABLE) ||
if ((open_flags & HA_OPEN_TMP_TABLE) ||
(share->options & HA_OPTION_TMP_TABLE))
{
share->temporary=share->delay_key_write=1;
@ -492,7 +501,7 @@ MI_INFO *mi_open(const char *name, int mode, uint handle_locking)
share->w_locks++; /* We don't have to update status */
info.lock_type=F_WRLCK;
}
if (((handle_locking & HA_OPEN_DELAY_KEY_WRITE) ||
if (((open_flags & HA_OPEN_DELAY_KEY_WRITE) ||
(share->options & HA_OPTION_DELAY_KEY_WRITE)) &&
myisam_delay_key_write)
share->delay_key_write=1;

View file

@ -16,7 +16,7 @@
/* Descript, check and repair of ISAM tables */
#include "myisamdef.h"
#include "fulltext.h"
#include <m_ctype.h>
#include <stdarg.h>
@ -123,6 +123,7 @@ int main(int argc, char **argv)
llstr(check_param.total_deleted,buff2));
}
free_defaults(default_argv);
ft_free_stopwords();
my_end(check_param.testflag & T_INFO ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
exit(error);
#ifndef _lint
@ -151,13 +152,14 @@ enum options {OPT_CHARSETS_DIR=256, OPT_SET_CHARSET,OPT_START_CHECK_POS};
static struct option long_options[] =
{
{"analyze", no_argument, 0, 'a'},
{"block-search", required_argument, 0, 'b'},
{"analyze", no_argument, 0, 'a'},
{"block-search", required_argument,0, 'b'},
{"backup", no_argument, 0, 'B'},
{"character-sets-dir",required_argument,0, OPT_CHARSETS_DIR},
{"check", no_argument, 0, 'c'},
{"check", no_argument, 0, 'c'},
{"check-only-changed",no_argument, 0, 'C'},
#ifndef DBUG_OFF
{"debug", required_argument, 0, '#'},
{"debug", optional_argument, 0, '#'},
#endif
{"description", no_argument, 0, 'd'},
{"data-file-length", required_argument, 0, 'D'},
@ -232,6 +234,7 @@ static void usage(void)
-T, --read-only Don't mark table as checked\n");
puts("Repair options (When using -r or -o) \n\
-B, --backup Make a backup of the .MYD file as 'filename-time.BAK'\n\
-D, --data-file-length=# Max length of data file (when recreating data\n\
file when it's full)\n\
-e, --extend-check Try to recover every possible row from the data file\n\
@ -296,7 +299,7 @@ static void get_options(register int *argc,register char ***argv)
set_all_changeable_vars(changeable_vars);
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
while ((c=getopt_long(*argc,*argv,"acCdeifF?lqrmosSTuUvVw#:b:D:k:O:R:A::t:",
while ((c=getopt_long(*argc,*argv,"aBcCdeifF?lqrmosSTuUvVw#:b:D:k:O:R:A::t:",
long_options, &option_index)) != EOF)
{
switch(c) {
@ -313,6 +316,9 @@ static void get_options(register int *argc,register char ***argv)
case 'b':
check_param.search_after_block=strtoul(optarg,NULL,10);
break;
case 'B':
check_param.testflag|= T_BACKUP_DATA;
break;
case 'c':
check_param.testflag|= T_CHECK;
break;
@ -406,7 +412,7 @@ static void get_options(register int *argc,register char ***argv)
check_param.testflag|= T_UPDATE_STATE;
break;
case '#':
DBUG_PUSH(optarg ? optarg : "d:t:o,/tmp/isamchk");
DBUG_PUSH(optarg ? optarg : "d:t:o,/tmp/myisamchk.trace");
break;
case 'V':
print_version();
@ -520,7 +526,6 @@ static int myisamchk(MI_CHECK *param, my_string filename)
share->r_locks=0;
raid_chunks=share->base.raid_chunks;
/*
Skipp the checking of the file if:
We are using --fast and the table is closed properly
@ -587,7 +592,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
recreate=1;
if (!(param->testflag & (T_REP | T_REP_BY_SORT)))
{
param->testflag|=T_REP_BY_SORT; /* if only STATISTICS */
param->testflag|=T_REP_BY_SORT; /* if only STATISTICS */
if (!(param->testflag & T_SILENT))
printf("- '%s' has old table-format. Recreating index\n",filename);
if (!rep_quick)
@ -606,6 +611,9 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
else
{
if (share->fulltext_index)
ft_init_stopwords(ft_precompiled_stopwords); /* SerG */
if (!(param->testflag & T_READONLY))
lock_type = F_WRLCK; /* table is changed */
else
@ -649,9 +657,10 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
if (!error)
{
if (param->testflag & T_REP_BY_SORT &&
if ((param->testflag & T_REP_BY_SORT) &&
(share->state.key_map ||
(rep_quick && !param->keys_in_use && !recreate)))
(rep_quick && !param->keys_in_use && !recreate)) &&
mi_test_if_sort_rep(info, info->state->records, 1))
error=mi_repair_by_sort(&check_param,info,fixed_name,rep_quick);
else if (param->testflag & (T_REP | T_REP_BY_SORT))
error=mi_repair(&check_param, info,fixed_name,rep_quick);
@ -662,7 +671,8 @@ static int myisamchk(MI_CHECK *param, my_string filename)
{ /* Change temp file to org file */
VOID(my_close(info->dfile,MYF(MY_WME))); /* Close new file */
error|=change_to_newfile(fixed_name,MI_NAME_DEXT,DATA_TMP_EXT,
raid_chunks);
raid_chunks,
MYF(0));
#ifdef USE_RAID
if (share->base.raid_type)
{
@ -811,9 +821,12 @@ end2:
{
if (param->out_flag & O_NEW_DATA)
error|=change_to_newfile(fixed_name,MI_NAME_DEXT,DATA_TMP_EXT,
raid_chunks);
raid_chunks,
((param->testflag & T_BACKUP_DATA) ?
MYF(MY_REDEL_MAKE_BACKUP) : MYF(0)));
if (param->out_flag & O_NEW_INDEX)
error|=change_to_newfile(fixed_name,MI_NAME_IEXT,INDEX_TMP_EXT,0);
error|=change_to_newfile(fixed_name,MI_NAME_IEXT,INDEX_TMP_EXT,0,
MYF(0));
}
VOID(fflush(stdout)); VOID(fflush(stderr));
if (param->error_printed)
@ -1381,6 +1394,7 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...)
if (param->testflag & T_SILENT)
fprintf(stderr,"%s: MyISAM file %s\n",my_progname,
param->isam_file_name);
param->out_flag|= O_DATA_LOST;
}
param->warning_printed=1;
va_start(args,fmt);
@ -1405,6 +1419,7 @@ void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
{
if (param->testflag & T_SILENT)
fprintf(stderr,"%s: ISAM file %s\n",my_progname,param->isam_file_name);
param->out_flag|= O_DATA_LOST;
}
param->error_printed|=1;
va_start(args,fmt);

View file

@ -179,7 +179,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */
global_changed, /* If changed since open */
not_flushed,
temporary,delay_key_write,
concurrent_insert;
concurrent_insert,
fulltext_index;
myf write_flag;
int rnd; /* rnd-counter */
MI_DECODE_TREE *decode_trees;
@ -294,7 +295,7 @@ struct st_myisam_info {
mi_int2store(x,boh); }
#define mi_test_if_nod(x) (x[0] & 128 ? info->s->base.key_reflength : 0)
#define mi_mark_crashed(x) (x)->s->state.changed|=STATE_CRASHED
#define mi_mark_crashed_on_repair(x) (x)->s->state.changed|=STATE_CRASHED|STATE_CRASHED_ON_REPAIR
#define mi_mark_crashed_on_repair(x) { (x)->s->state.changed|=STATE_CRASHED|STATE_CRASHED_ON_REPAIR ; (x)->update|= HA_STATE_CHANGED; }
#define mi_is_crashed(x) ((x)->s->state.changed & STATE_CRASHED)
#define mi_is_crashed_on_repair(x) ((x)->s->state.changed & STATE_CRASHED_ON_REPAIR)

View file

@ -23,6 +23,7 @@
/*
If flag & 1 Return date and time
If flag & 2 Return short date format YYMMDD
if flag & 4 Return time in HHMMDD format.
*/
@ -56,4 +57,9 @@ void get_date(register my_string to, int flag, time_t date)
start_time->tm_hour,
start_time->tm_min,
start_time->tm_sec);
else if (flag & 4)
sprintf(strend(to),"%02d%02d%02d",
start_time->tm_hour,
start_time->tm_min,
start_time->tm_sec);
} /* get_date */

View file

@ -47,6 +47,19 @@ static my_bool win32_init_tcp_ip();
#endif
static my_bool my_init_done=0;
ulong atoi_octal(const char *str)
{
long int tmp;
while (*str && isspace(*str))
str++;
str2int(str,
(*str == '0' ? 8 : 10), /* Octalt or decimalt */
0, INT_MAX, &tmp);
return (ulong) tmp;
}
/* Init my_sys functions and my_sys variabels */
void my_init(void)
@ -73,10 +86,12 @@ void my_init(void)
if ((home_dir=getenv("HOME")) != 0)
home_dir=intern_filename(home_dir_buff,home_dir);
#ifndef VMS
/* Default creation of new files */
if ((str=getenv("UMASK")) != 0)
my_umask=atoi(str) | 0600; /* Default creation of new files */
my_umask=(int) (atoi_octal(str) | 0600);
/* Default creation of new dir's */
if ((str=getenv("UMASK_DIR")) != 0)
my_umask_dir=atoi(str) | 0700; /* Default creation of new dir's */
my_umask_dir=(int) (atoi_octal(str) | 0700);
#endif
#ifdef VMS
init_ctype(); /* Stupid linker don't link _ctype.c */

View file

@ -97,6 +97,7 @@ int my_close(File fd, myf MyFlags)
pthread_mutex_lock(&THR_LOCK_open);
if ((err = close(fd)))
{
DBUG_PRINT("error",("Got error %d on close",err));
my_errno=errno;
if (MyFlags & (MY_FAE | MY_WME))
my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno);

View file

@ -18,6 +18,7 @@
#define USES_TYPES /* sys/types is included */
#include "mysys_priv.h"
#include <my_dir.h>
#include <m_string.h>
#include "mysys_err.h"
#if defined(HAVE_SYS_UTIME_H)
#include <sys/utime.h>
@ -30,21 +31,45 @@ struct utimbuf {
};
#endif
/* Rename with copy stat form old file */
/* Copy stats from old file to new file, deletes orginal and */
/* changes new file name to old file name */
/*
Rename with copy stat form old file
Copy stats from old file to new file, deletes orginal and
changes new file name to old file name
if MY_REDEL_MAKE_COPY is given, then the orginal file
is renamed to org_name-'current_time'.BAK
*/
#define REDEL_EXT ".BAK"
int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
{
int error=1;
DBUG_ENTER("my_redel");
DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %d",
org_name,tmp_name,MyFlags));
if (my_copystat(org_name,tmp_name,MyFlags) < 0 ||
my_delete(org_name,MyFlags) ||
my_rename(tmp_name,org_name,MyFlags))
DBUG_RETURN(1);
DBUG_RETURN(0);
if (my_copystat(org_name,tmp_name,MyFlags) < 0)
goto end;
if (MyFlags & MY_REDEL_MAKE_BACKUP)
{
char name_buff[FN_REFLEN+20];
char ext[20];
ext[0]='-';
get_date(ext+1,2+4,(time_t) 0);
strmov(strend(ext),REDEL_EXT);
if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2),
MyFlags))
goto end;
}
else if (my_delete(org_name,MyFlags))
goto end;
if (my_rename(tmp_name,org_name,MyFlags))
goto end;
error=0;
end:
DBUG_RETURN(error);
} /* my_redel */

View file

@ -25,11 +25,11 @@ WARNING: THIS IS VERY MUCH A FIRST-CUT ALPHA. Comments/patches welcome.
# Documentation continued at end of file
my $VERSION = "1.6";
my $VERSION = "1.7";
my $OPTIONS = <<"_OPTIONS";
Usage: $0 db_name new_db_name
Usage: $0 db_name [new_db_name | directory]
-?, --help display this helpscreen and exit
-u, --user=# user for database login if not current user
@ -126,7 +126,9 @@ my $dsn = ";host=localhost";
$dsn .= ";port=$opt{port}" if $opt{port};
$dsn .= ";mysql_socket=$opt{socket}" if $opt{socket};
my $dbh = DBI->connect("dbi:mysql:$dsn", $opt{user}, $opt{password}, {
my $dbh = DBI->connect("dbi:mysql:$dsn;mysql_read_default_group=mysqlhotcopy",
$opt{user}, $opt{password},
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 1,
@ -143,20 +145,23 @@ if ( $opt{checkpoint} ) {
}
# --- get variables from database ---
my $sth_vars = $dbh->prepare("show variables");
my $sth_vars = $dbh->prepare("show variables like 'datadir'");
$sth_vars->execute;
while ( my ($var,$value) = $sth_vars->fetchrow_array ) {
$mysqld_vars{ $var } = $value;
}
my $datadir = $mysqld_vars{datadir}
my $datadir = $mysqld_vars{'datadir'}
|| die "datadir not in mysqld variables";
$datadir =~ s:/$::;
# --- get target path ---
my $tgt_dirname;
if ($tgt_name =~ m:^\w+$:) {
my ($tgt_dirname, $to_other_database);
$to_other_database=0;
if ($tgt_name =~ m:^\w+$: && @db_desc <= 1)
{
$tgt_dirname = "$datadir/$tgt_name";
$to_other_database=1;
}
elsif ($tgt_name =~ m:/: || $tgt_name eq '.') {
$tgt_dirname = $tgt_name;
@ -209,6 +214,7 @@ foreach my $rdb ( @db_desc ) {
$hc_locks .= ", " if ( length $hc_locks && @hc_tables );
$hc_locks .= join ", ", map { "$_ READ" } @hc_tables;
$hc_tables .= ", " if ( length $hc_tables && @hc_tables );
$hc_tables .= join ", ", @hc_tables;
$num_tables += scalar @hc_tables;
@ -223,19 +229,30 @@ if (length $tgt_name ) {
# explicit destination directory specified
# GNU `cp -r` error message
die "copying multiple databases, but last argument ($tgt_name) is not a directory\n"
if ( @db_desc > 1 && !(-e $tgt_name && -d $tgt_name ) );
die "copying multiple databases, but last argument ($tgt_dirname) is not a directory\n"
if ( @db_desc > 1 && !(-e $tgt_dirname && -d $tgt_dirname ) );
foreach my $rdb ( @db_desc ) {
$rdb->{target} = "$tgt_name/$rdb->{src}";
if ($to_other_database)
{
foreach my $rdb ( @db_desc ) {
$rdb->{target} = "$tgt_dirname";
}
}
}
else
{
die "Last argument ($tgt_dirname) is not a directory\n"
if (!(-e $tgt_dirname && -d $tgt_dirname ) );
foreach my $rdb ( @db_desc ) {
$rdb->{target} = "$tgt_dirname/$rdb->{src}";
}
}
}
else {
die "Error: expected \$opt{suffix} to exist" unless ( exists $opt{suffix} );
foreach my $rdb ( @db_desc ) {
$rdb->{target} = "$datadir/$rdb->{src}$opt{suffix}";
}
die "Error: expected \$opt{suffix} to exist" unless ( exists $opt{suffix} );
foreach my $rdb ( @db_desc ) {
$rdb->{target} = "$datadir/$rdb->{src}$opt{suffix}";
}
}
print Dumper( \@db_desc ) if ( $opt{debug} );
@ -571,6 +588,9 @@ where ":" delimits the subsets, the /^foo_/ indicates all tables
with names begining with "foo_" and the "+" indicates all tables
not copied by the previous subsets.
newdb is either another not existing database or a full path to a directory
where we can create a directory 'db'
Add option to lock each table in turn for people who don't need
cross-table integrity.

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;