Merge from 4.1
This commit is contained in:
commit
697cfe7f07
@ -16,7 +16,7 @@
|
||||
|
||||
/* This file is originally from the mysql distribution. Coded by monty */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
/* This file is originally from the mysql distribution. Coded by monty */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
|
@ -48,6 +48,11 @@
|
||||
#define USE_PRAGMA_INTERFACE
|
||||
#endif
|
||||
|
||||
/* Determine when to use "#pragma implementation" */
|
||||
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define USE_PRAGMA_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#if defined(i386) && !defined(__i386__)
|
||||
#define __i386__
|
||||
#endif
|
||||
|
@ -605,6 +605,7 @@ extern int my_access(const char *path, int amode);
|
||||
#else
|
||||
#define my_access access
|
||||
#endif
|
||||
extern int check_if_legal_filename(const char *path);
|
||||
|
||||
#ifndef TERMINATE
|
||||
extern void TERMINATE(FILE *file);
|
||||
|
@ -1212,8 +1212,8 @@ start_master()
|
||||
$NOT_FIRST_MASTER_EXTRA_OPTS"
|
||||
fi
|
||||
|
||||
CUR_MYERR=$MASTER_MYERR
|
||||
CUR_MYSOCK=$MASTER_MYSOCK
|
||||
CUR_MYERR=$MASTER_MYERR$1
|
||||
CUR_MYSOCK=$MASTER_MYSOCK$1
|
||||
|
||||
# For embedded server we collect the server flags and return
|
||||
if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
|
||||
|
@ -15,39 +15,107 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include "mysys_priv.h"
|
||||
#include <m_string.h>
|
||||
|
||||
#ifdef __WIN__
|
||||
|
||||
/*
|
||||
* Check a file or path for accessability.
|
||||
*
|
||||
* SYNOPSIS
|
||||
* file_access()
|
||||
* pathpath to check
|
||||
* amodemode to check
|
||||
*
|
||||
* DESCRIPTION
|
||||
* This function wraps the normal access method because the access
|
||||
* available in MSVCRT> +reports that filenames such as LPT1 and
|
||||
* COM1 are valid (they are but should not be so for us).
|
||||
*
|
||||
* RETURN VALUES
|
||||
* 0 ok
|
||||
* -1 error
|
||||
*/
|
||||
Check a file or path for accessability.
|
||||
|
||||
SYNOPSIS
|
||||
file_access()
|
||||
path Path to file
|
||||
amode Access method
|
||||
|
||||
DESCRIPTION
|
||||
This function wraps the normal access method because the access
|
||||
available in MSVCRT> +reports that filenames such as LPT1 and
|
||||
COM1 are valid (they are but should not be so for us).
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
-1 error (We use -1 as my_access is mapped to access on other platforms)
|
||||
*/
|
||||
|
||||
int my_access(const char *path, int amode)
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileinfo;
|
||||
BOOL result;
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileinfo;
|
||||
BOOL result;
|
||||
|
||||
result = GetFileAttributesEx(path, GetFileExInfoStandard,
|
||||
&fileinfo);
|
||||
if (! result)
|
||||
return -1;
|
||||
if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) &&
|
||||
(amode & 2))
|
||||
return -1;
|
||||
return 0;
|
||||
result= GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo);
|
||||
if (! result ||
|
||||
(fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && (amode & W_OK))
|
||||
{
|
||||
my_errno= errno= EACCES;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __WIN__ */
|
||||
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__)
|
||||
|
||||
/*
|
||||
List of file names that causes problem on windows
|
||||
|
||||
NOTE that one can also not have file names of type CON.TXT
|
||||
*/
|
||||
|
||||
static const char *reserved_names[]=
|
||||
{
|
||||
"CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6",
|
||||
"COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6",
|
||||
"LPT7", "LPT8", "LPT9", "CLOCK$",
|
||||
NullS
|
||||
};
|
||||
|
||||
#define MAX_RESERVED_NAME_LENGTH 6
|
||||
|
||||
/*
|
||||
Check if a path will access a reserverd file name that may cause problems
|
||||
|
||||
SYNOPSIS
|
||||
check_if_legal_filename
|
||||
path Path to file
|
||||
|
||||
RETURN
|
||||
0 ok
|
||||
1 reserved file name
|
||||
*/
|
||||
|
||||
int check_if_legal_filename(const char *path)
|
||||
{
|
||||
const char *end;
|
||||
const char **reserved_name;
|
||||
DBUG_ENTER("check_if_legal_filename");
|
||||
|
||||
path+= dirname_length(path); /* To start of filename */
|
||||
if (!(end= strchr(path, FN_EXTCHAR)))
|
||||
end= strend(path);
|
||||
if (path == end || (uint) (path - end) > MAX_RESERVED_NAME_LENGTH)
|
||||
DBUG_RETURN(0); /* Simplify inner loop */
|
||||
|
||||
for (reserved_name= reserved_names; *reserved_name; reserved_name++)
|
||||
{
|
||||
const char *name= path;
|
||||
while (name != end)
|
||||
{
|
||||
if (my_toupper(&my_charset_latin1, *path) !=
|
||||
my_toupper(&my_charset_latin1, *name))
|
||||
break;
|
||||
if (name++ == end)
|
||||
DBUG_RETURN(1); /* Found wrong path */
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef OS2
|
||||
int check_if_legal_filename(const char *path)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* OS2 */
|
||||
|
@ -39,13 +39,16 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
|
||||
very well
|
||||
*/
|
||||
#ifdef __WIN__
|
||||
if (! (Flags & O_CREAT) && my_access(FileName, F_OK))
|
||||
fd=0;
|
||||
if (check_if_legal_filename(FileName))
|
||||
{
|
||||
errno= EACCES;
|
||||
fd= 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
make_ftype(type,Flags);
|
||||
fd = fopen(FileName, type);
|
||||
make_ftype(type,Flags);
|
||||
fd = fopen(FileName, type);
|
||||
}
|
||||
|
||||
if (fd != 0)
|
||||
|
@ -47,12 +47,15 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
|
||||
FileName, Flags, MyFlags));
|
||||
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
|
||||
/*
|
||||
if we are not creating, then we need to use my_access to make
|
||||
sure the file exists since Windows doesn't handle files like
|
||||
"com1.sym" very well
|
||||
Check that we don't try to open or create a file name that may
|
||||
cause problems for us in the future (like PRN)
|
||||
*/
|
||||
if (! (Flags & O_CREAT) && my_access(FileName, F_OK))
|
||||
return -1;
|
||||
if (check_if_legal_filename(FileName))
|
||||
{
|
||||
errno= EACCES;
|
||||
DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN,
|
||||
EE_FILENOTFOUND, MyFlags));
|
||||
}
|
||||
if (Flags & O_SHARE)
|
||||
fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
|
||||
MY_S_IREAD | MY_S_IWRITE);
|
||||
|
@ -70,7 +70,7 @@
|
||||
tonu@mysql.com & monty@mysql.com
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -342,7 +342,6 @@ private:
|
||||
* Complete metadata for one index. The array of attributes has
|
||||
* variable size.
|
||||
*/
|
||||
struct DescEnt;
|
||||
friend struct DescEnt;
|
||||
struct DescEnt {
|
||||
DescHead m_descHead;
|
||||
|
@ -19,7 +19,7 @@
|
||||
** This file implements classes defined in field.h
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@ have disables the InnoDB inlining in this file. */
|
||||
in Windows?
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
NDB Cluster
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* Handler-calling-functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
** to usage.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* This file defines all compare functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* This file defines all numerical functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* This file defines all spatial functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
** (This shouldn't be needed)
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@ SUBSELECT TODO:
|
||||
(sql_select.h/sql_select.cc)
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* Sum functions (COUNT, MIN...) */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* This file defines all time functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/* Compability file */
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
/* Compability file ; This file only contains dummy functions */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
#include "mysql_priv.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#undef write // remove pthread.h macro definition, conflict with write() class member
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(MYSQL_CLIENT)
|
||||
#if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT)
|
||||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
QUICK_RANGEs are also created in this step.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* Procedures (functions with changes output of select) */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
The actual communction is handled by the net_xxx functions in net_serv.cc
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
The actual communction is handled by the net_xxx functions in net_serv.cc
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
new attribute.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
** - type set is out of optimization yet
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* Analyse database */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
**
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
needs something like 'ssh'.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
|
@ -423,7 +423,7 @@ static const uint signed_longlong_len=19;
|
||||
static const char *unsigned_longlong_str="18446744073709551615";
|
||||
static const uint unsigned_longlong_len=20;
|
||||
|
||||
inline static uint int_token(const char *str,uint length)
|
||||
static inline uint int_token(const char *str,uint length)
|
||||
{
|
||||
if (length < long_len) // quick normal case
|
||||
return NUM;
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* interface for memory mapped files */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_INTERFACE
|
||||
#pragma interface /* gcc class implementation */
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -3180,7 +3180,7 @@ unsent_create_error:
|
||||
if (!(res= open_and_lock_tables(thd, all_tables)))
|
||||
{
|
||||
/* Skip first table, which is the table we are inserting in */
|
||||
lex->select_lex.table_list.first= (byte*)first_table->next_local;
|
||||
select_lex->table_list.first= (byte*)first_table->next_local;
|
||||
|
||||
res= mysql_insert_select_prepare(thd);
|
||||
if (!res && (result= new select_insert(first_table, first_table->table,
|
||||
@ -3192,13 +3192,13 @@ unsent_create_error:
|
||||
insert/replace from SELECT give its SELECT_LEX for SELECT,
|
||||
and item_list belong to SELECT
|
||||
*/
|
||||
lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
|
||||
select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
|
||||
res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE);
|
||||
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
|
||||
select_lex->resolve_mode= SELECT_LEX::INSERT_MODE;
|
||||
delete result;
|
||||
}
|
||||
/* revert changes for SP */
|
||||
lex->select_lex.table_list.first= (byte*) first_table;
|
||||
select_lex->table_list.first= (byte*) first_table;
|
||||
}
|
||||
|
||||
if (first_table->view && !first_table->contain_auto_increment)
|
||||
|
@ -1479,13 +1479,11 @@ bool show_binlogs(THD* thd)
|
||||
{
|
||||
IO_CACHE *index_file;
|
||||
LOG_INFO cur;
|
||||
IO_CACHE log;
|
||||
File file;
|
||||
const char *errmsg= 0;
|
||||
MY_STAT stat_area;
|
||||
char fname[FN_REFLEN];
|
||||
List<Item> field_list;
|
||||
uint length;
|
||||
int cur_dir_len;
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlogs");
|
||||
|
||||
@ -1505,34 +1503,35 @@ bool show_binlogs(THD* thd)
|
||||
index_file=mysql_bin_log.get_index_file();
|
||||
|
||||
mysql_bin_log.get_current_log(&cur);
|
||||
int cur_dir_len = dirname_length(cur.log_file_name);
|
||||
cur_dir_len= dirname_length(cur.log_file_name);
|
||||
|
||||
reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0);
|
||||
|
||||
/* The file ends with EOF or empty line */
|
||||
while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1)
|
||||
{
|
||||
fname[--length] = '\0'; /* remove the newline */
|
||||
int dir_len;
|
||||
ulonglong file_length= 0; // Length if open fails
|
||||
fname[--length] = '\0'; // remove the newline
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
int dir_len = dirname_length(fname);
|
||||
protocol->store(fname + dir_len, length-dir_len, &my_charset_bin);
|
||||
if(!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length-dir_len)))
|
||||
dir_len= dirname_length(fname);
|
||||
length-= dir_len;
|
||||
protocol->store(fname + dir_len, length, &my_charset_bin);
|
||||
|
||||
if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length)))
|
||||
file_length= cur.pos; /* The active log, use the active position */
|
||||
else
|
||||
{
|
||||
/* this is the active log, use the active position */
|
||||
protocol->store((ulonglong) cur.pos);
|
||||
} else {
|
||||
/* this is an old log, open it and find the size */
|
||||
if ((file=open_binlog(&log, fname+dir_len, &errmsg)) >= 0)
|
||||
if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY,
|
||||
MYF(0))) >= 0)
|
||||
{
|
||||
protocol->store((ulonglong) my_b_filelength(&log));
|
||||
end_io_cache(&log);
|
||||
file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0));
|
||||
my_close(file, MYF(0));
|
||||
} else {
|
||||
/* the file wasn't openable, but 0 is an invalid value anyway */
|
||||
protocol->store((ulonglong) 0);
|
||||
}
|
||||
}
|
||||
protocol->store(file_length);
|
||||
if (protocol->write())
|
||||
goto err;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
/* mysql_select and join optimization */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
/* This file is originally from the mysql distribution. Coded by monty */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
dynamic functions, so this shouldn't be a real problem.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: implement sql_udf.h
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
(We will refer to this code as to elsie-code further.)
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user