Portability fixes for Fortre C++ 5.0 (on Sun) in 32 and 64 bit modes.
This commit is contained in:
parent
5333cfb429
commit
a2bdf9265f
39
BUILD/compile-solaris-sparc-forte
Executable file
39
BUILD/compile-solaris-sparc-forte
Executable file
@ -0,0 +1,39 @@
|
||||
#! /bin/sh
|
||||
|
||||
gmake -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
aclocal && autoheader && aclocal && automake && autoconf
|
||||
(cd bdb/dist && sh s_all)
|
||||
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
if [ -d gemini ]
|
||||
then
|
||||
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
fi
|
||||
|
||||
|
||||
# Assume Forte is installed in /opt/SUNWSpro
|
||||
|
||||
PATH=/opt/SUNWspro/bin/:$PATH
|
||||
|
||||
# For "optimal" code for this computer add -fast to EXTRA
|
||||
# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT
|
||||
|
||||
EXTRA_64_BIT="-xarch=v9" # Remove comment to get 64 bit binaries
|
||||
EXTRA="-fast" # Remove comment to target current machine
|
||||
|
||||
#
|
||||
# The following should not need to be touched
|
||||
#
|
||||
|
||||
STD="-mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
|
||||
ASFLAGS="$EXTRA_64_BIT" \
|
||||
CC=cc-5.0 CFLAGS="-Xa -xstrconst $STD" \
|
||||
CXX=CC CXXFLAGS="-noex $STD" \
|
||||
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
|
||||
|
||||
gmake -j 4
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
make test
|
||||
fi
|
@ -1,19 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
gmake -k clean || true
|
||||
/bin/rm -f */.deps/*.P config.cache
|
||||
|
||||
aclocal && autoheader && aclocal && automake && autoconf
|
||||
(cd bdb/dist && sh s_all)
|
||||
(cd innobase && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
if [ -d gemini ]
|
||||
then
|
||||
(cd gemini && aclocal && autoheader && aclocal && automake && autoconf)
|
||||
fi
|
||||
|
||||
PATH=/opt/SUNWspro/bin/:$PATH
|
||||
CC=cc CFLAGS="-Xa -fast -xO4 -native -xstrconst -mt -D_FORTREC_" \
|
||||
CXX=CC CXXFLAGS="-noex -xO4 -mt" \
|
||||
./configure --prefix=/usr/local/mysql --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client
|
||||
|
||||
gmake -j 4
|
@ -40,6 +40,7 @@ miguel@hegel.local
|
||||
miguel@light.
|
||||
miguel@light.local
|
||||
monty@bitch.mysql.fi
|
||||
monty@butch.
|
||||
monty@donna.mysql.fi
|
||||
monty@hundin.mysql.fi
|
||||
monty@mashka.mysql.fi
|
||||
|
@ -176,7 +176,7 @@ static void dump_remote_file(NET* net, const char* fname)
|
||||
}
|
||||
|
||||
|
||||
static my_bool
|
||||
extern "C" static my_bool
|
||||
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
char *argument)
|
||||
{
|
||||
|
@ -72,12 +72,14 @@ case $MACHINE_TYPE in
|
||||
esac
|
||||
|
||||
# Save some variables and the command line options for mysqlbug
|
||||
SAVE_ASFLAGS="$ASFLAGS"
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
SAVE_LDFLAGS="$LDFLAGS"
|
||||
SAVE_CXXLDFLAGS="$CXXLDFLAGS"
|
||||
CONF_COMMAND="$0 $ac_configure_args"
|
||||
AC_SUBST(CONF_COMMAND)
|
||||
AC_SUBST(SAVE_ASFLAGS)
|
||||
AC_SUBST(SAVE_CFLAGS)
|
||||
AC_SUBST(SAVE_CXXFLAGS)
|
||||
AC_SUBST(SAVE_LDFLAGS)
|
||||
@ -602,8 +604,9 @@ AC_ARG_ENABLE(assembler,
|
||||
AC_MSG_CHECKING(if we should use assembler functions)
|
||||
# For now we only support assembler on i386 and sparc systems
|
||||
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386")
|
||||
AM_CONDITIONAL(ASSEMBLER_sparc, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
|
||||
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc_TRUE" = "")
|
||||
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
|
||||
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
|
||||
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
|
||||
|
||||
if test "$ASSEMBLER_TRUE" = ""
|
||||
then
|
||||
|
@ -38,6 +38,14 @@
|
||||
#define HAVE_ERRNO_AS_DEFINE
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
/* Macros to make switching between C and C++ mode easier */
|
||||
#ifdef __cplusplus
|
||||
#define C_MODE_START extern "C" {
|
||||
#define C_MODE_END }
|
||||
#else
|
||||
#define C_MODE_START
|
||||
#define C_MODE_END
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
|
||||
#include <config-win.h>
|
||||
@ -121,13 +129,9 @@
|
||||
/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */
|
||||
#define ulonglong2double(A) my_ulonglong2double(A)
|
||||
#define my_off_t2double(A) my_ulonglong2double(A)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
C_MODE_START
|
||||
double my_ulonglong2double(unsigned long long A);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
C_MODE_END
|
||||
#endif /* _AIX */
|
||||
|
||||
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
|
||||
@ -385,7 +389,9 @@ typedef int my_socket; /* File descriptor for sockets */
|
||||
#endif
|
||||
/* Type for fuctions that handles signals */
|
||||
#define sig_handler RETSIGTYPE
|
||||
C_MODE_START
|
||||
typedef void (*sig_return)();/* Returns type from signal */
|
||||
C_MODE_END
|
||||
#if defined(__GNUC__) && !defined(_lint)
|
||||
typedef char pchar; /* Mixed prototypes can take char */
|
||||
typedef char puchar; /* Mixed prototypes can take char */
|
||||
@ -399,8 +405,10 @@ typedef int pbool; /* Mixed prototypes can't take char */
|
||||
typedef int pshort; /* Mixed prototypes can't take short int */
|
||||
typedef double pfloat; /* Mixed prototypes can't take float */
|
||||
#endif
|
||||
C_MODE_START
|
||||
typedef int (*qsort_cmp)(const void *,const void *);
|
||||
typedef int (*qsort_cmp2)(void*, const void *,const void *);
|
||||
C_MODE_END
|
||||
#ifdef HAVE_mit_thread
|
||||
#define qsort_t void
|
||||
#undef QSORT_TYPE_IS_VOID
|
||||
@ -1038,13 +1046,4 @@ typedef union {
|
||||
#define statistic_add(V,C,L) (V)+=(C)
|
||||
#endif
|
||||
|
||||
/* Macros to make switching between C and C++ mode easier */
|
||||
#ifdef __cplusplus
|
||||
#define C_MODE_START extern "C" {
|
||||
#define C_MODE_END }
|
||||
#else
|
||||
#define C_MODE_START
|
||||
#define C_MODE_END
|
||||
#endif
|
||||
|
||||
#endif /* _global_h */
|
||||
#endif /* my_global_h */
|
||||
|
@ -296,7 +296,7 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def);
|
||||
#define T_VERBOSE (1L << 28)
|
||||
#define T_VERY_SILENT (1L << 29)
|
||||
#define T_WAIT_FOREVER (1L << 30)
|
||||
#define T_WRITE_LOOP (1L << 31)
|
||||
#define T_WRITE_LOOP ((ulong) 1L << 31)
|
||||
|
||||
#define T_REP_ANY (T_REP | T_REP_BY_SORT | T_REP_PARALLEL)
|
||||
|
||||
|
@ -41,12 +41,13 @@ typedef struct st_queue {
|
||||
#define queue_element(queue,index) ((queue)->root[index+1])
|
||||
#define queue_end(queue) ((queue)->root[(queue)->elements])
|
||||
#define queue_replaced(queue) _downheap(queue,1)
|
||||
typedef int (*queue_compare)(void *,byte *, byte *);
|
||||
|
||||
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
|
||||
pbool max_at_top, int (*compare)(void *,byte *, byte *),
|
||||
pbool max_at_top, queue_compare compare,
|
||||
void *first_cmp_arg);
|
||||
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
|
||||
pbool max_at_top, int (*compare)(void *,byte *, byte *),
|
||||
pbool max_at_top, queue_compare compare,
|
||||
void *first_cmp_arg);
|
||||
void delete_queue(QUEUE *queue);
|
||||
void queue_insert(QUEUE *queue,byte *element);
|
||||
|
@ -10,6 +10,7 @@ Created 1/20/1994 Heikki Tuuri
|
||||
#define ut0ut_h
|
||||
|
||||
#include "univ.i"
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#ifndef MYSQL_SERVER
|
||||
#include <ctype.h>
|
||||
|
@ -1654,8 +1654,8 @@ log_reset_first_header_and_checkpoint(
|
||||
lsn = ut_dulint_add(start, LOG_BLOCK_HDR_SIZE);
|
||||
|
||||
/* Write the label of ibbackup --restore */
|
||||
sprintf(hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, "ibbackup ");
|
||||
ut_sprintf_timestamp(hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
|
||||
sprintf((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, "ibbackup ");
|
||||
ut_sprintf_timestamp((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
|
||||
+ strlen("ibbackup "));
|
||||
buf = hdr_buf + LOG_CHECKPOINT_1;
|
||||
|
||||
|
@ -353,7 +353,7 @@ cmp_data_data_slow(
|
||||
data2++;
|
||||
}
|
||||
|
||||
return(0);
|
||||
return(0); /* Not reached */
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
@ -474,7 +474,7 @@ trx_sys_update_mysql_binlog_offset(
|
||||
|
||||
mlog_write_string(sys_header + field
|
||||
+ TRX_SYS_MYSQL_LOG_NAME,
|
||||
file_name, 1 + ut_strlen(file_name), mtr);
|
||||
(byte*) file_name, 1 + ut_strlen(file_name), mtr);
|
||||
}
|
||||
|
||||
if (mach_read_from_4(sys_header + field
|
||||
|
@ -67,7 +67,7 @@ struct st_file_buffer {
|
||||
char *buffer,*pos,*end;
|
||||
my_off_t pos_in_file;
|
||||
int bits;
|
||||
uint byte;
|
||||
uint bytes;
|
||||
};
|
||||
|
||||
struct st_huff_tree;
|
||||
@ -1832,7 +1832,7 @@ static void init_file_buffer(File file, pbool read_buffer)
|
||||
file_buffer.pos=file_buffer.buffer;
|
||||
file_buffer.bits=BITS_SAVED;
|
||||
}
|
||||
file_buffer.byte=0;
|
||||
file_buffer.bytes=0;
|
||||
}
|
||||
|
||||
|
||||
@ -1863,13 +1863,13 @@ static void write_bits (register ulong value, register uint bits)
|
||||
{
|
||||
if ((file_buffer.bits-=(int) bits) >= 0)
|
||||
{
|
||||
file_buffer.byte|=value << file_buffer.bits;
|
||||
file_buffer.bytes|=value << file_buffer.bits;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg3 uint byte_buff;
|
||||
bits= (uint) -file_buffer.bits;
|
||||
byte_buff=file_buffer.byte | (uint) (value >> bits);
|
||||
byte_buff=file_buffer.bytes | (uint) (value >> bits);
|
||||
#if BITS_SAVED == 32
|
||||
*file_buffer.pos++= (byte) (byte_buff >> 24) ;
|
||||
*file_buffer.pos++= (byte) (byte_buff >> 16) ;
|
||||
@ -1895,7 +1895,7 @@ static void write_bits (register ulong value, register uint bits)
|
||||
if (file_buffer.pos >= file_buffer.end)
|
||||
VOID(flush_buffer((uint) ~0));
|
||||
file_buffer.bits=(int) (BITS_SAVED - bits);
|
||||
file_buffer.byte=(uint) (value << (BITS_SAVED - bits));
|
||||
file_buffer.bytes=(uint) (value << (BITS_SAVED - bits));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1907,7 +1907,7 @@ static void flush_bits (void)
|
||||
uint bits,byte_buff;
|
||||
|
||||
bits=(file_buffer.bits) & ~7;
|
||||
byte_buff = file_buffer.byte >> bits;
|
||||
byte_buff = file_buffer.bytes >> bits;
|
||||
bits=BITS_SAVED - bits;
|
||||
while (bits > 0)
|
||||
{
|
||||
@ -1915,7 +1915,7 @@ static void flush_bits (void)
|
||||
*file_buffer.pos++= (byte) (uchar) (byte_buff >> bits) ;
|
||||
}
|
||||
file_buffer.bits=BITS_SAVED;
|
||||
file_buffer.byte=0;
|
||||
file_buffer.bytes=0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b)
|
||||
static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
|
||||
{
|
||||
/* ORDER BY word DESC, ndepth DESC */
|
||||
int i=_mi_compare_text(cs, (*b)->word+1,(*b)->len-1,
|
||||
(*a)->word+1,(*a)->len-1,0);
|
||||
int i=_mi_compare_text(cs, (uchar*) (*b)->word+1,(*b)->len-1,
|
||||
(uchar*) (*a)->word+1,(*a)->len-1,0);
|
||||
if (!i)
|
||||
i=CMP_NUM((*b)->ndepth,(*a)->ndepth);
|
||||
return i;
|
||||
@ -255,7 +255,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
|
||||
r=_mi_compare_text(ftb->charset,
|
||||
info->lastkey + (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
ftbw->len - (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
ftbw->word + (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
(uchar*) ftbw->word + (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
ftbw->len - (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
0);
|
||||
}
|
||||
@ -473,7 +473,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
|
||||
r=_mi_compare_text(ftb->charset,
|
||||
info->lastkey + (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
ftbw->len - (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
ftbw->word + (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
(uchar*) ftbw->word + (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
ftbw->len - (ftbw->flags&FTB_FLAG_TRUNC),
|
||||
0);
|
||||
}
|
||||
@ -576,7 +576,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
|
||||
for (a=0, b=ftb->queue.elements, c=(a+b)/2; b-a>1; c=(a+b)/2)
|
||||
{
|
||||
ftbw=ftb->list[c];
|
||||
if (_mi_compare_text(ftb->charset, word.pos, word.len,
|
||||
if (_mi_compare_text(ftb->charset, (uchar*) word.pos, word.len,
|
||||
(uchar*) ftbw->word+1, ftbw->len-1,
|
||||
(my_bool) (ftbw->flags&FTB_FLAG_TRUNC)) >0)
|
||||
b=c;
|
||||
@ -586,7 +586,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
|
||||
for (; c>=0; c--)
|
||||
{
|
||||
ftbw=ftb->list[c];
|
||||
if (_mi_compare_text(ftb->charset, word.pos,word.len,
|
||||
if (_mi_compare_text(ftb->charset, (uchar*) word.pos, word.len,
|
||||
(uchar*) ftbw->word+1,ftbw->len-1,
|
||||
(my_bool) (ftbw->flags&FTB_FLAG_TRUNC)))
|
||||
break;
|
||||
|
@ -157,6 +157,7 @@ static int _mi_find_writepos(MI_INFO *info,
|
||||
ulong *length) /* length of block at filepos */
|
||||
{
|
||||
MI_BLOCK_INFO block_info;
|
||||
ulong tmp;
|
||||
DBUG_ENTER("_mi_find_writepos");
|
||||
|
||||
if (info->s->state.dellink != HA_OFFSET_ERROR)
|
||||
@ -182,21 +183,22 @@ static int _mi_find_writepos(MI_INFO *info,
|
||||
{
|
||||
/* No deleted blocks; Allocate a new block */
|
||||
*filepos=info->state->data_file_length;
|
||||
if ((*length=reclength+3 + test(reclength >= (65520-3))) <
|
||||
if ((tmp=reclength+3 + test(reclength >= (65520-3))) <
|
||||
info->s->base.min_block_length)
|
||||
*length=info->s->base.min_block_length;
|
||||
tmp= info->s->base.min_block_length;
|
||||
else
|
||||
*length= ((*length+MI_DYN_ALIGN_SIZE-1) &
|
||||
(~ (ulong) (MI_DYN_ALIGN_SIZE-1)));
|
||||
tmp= ((tmp+MI_DYN_ALIGN_SIZE-1) &
|
||||
(~ (ulong) (MI_DYN_ALIGN_SIZE-1)));
|
||||
if (info->state->data_file_length >
|
||||
(info->s->base.max_data_file_length- *length))
|
||||
(info->s->base.max_data_file_length - tmp))
|
||||
{
|
||||
my_errno=HA_ERR_RECORD_FILE_FULL;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (*length > MI_MAX_BLOCK_LENGTH)
|
||||
*length=MI_MAX_BLOCK_LENGTH;
|
||||
info->state->data_file_length+= *length;
|
||||
if (tmp > MI_MAX_BLOCK_LENGTH)
|
||||
tmp=MI_MAX_BLOCK_LENGTH;
|
||||
*length= tmp;
|
||||
info->state->data_file_length+= tmp;
|
||||
info->s->state.split++;
|
||||
info->update|=HA_STATE_WRITE_AT_END;
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
|
||||
printf("Key %d - Merging %u keys\n",sinfo->key+1, sinfo->keys);
|
||||
if (merge_many_buff(sinfo, keys, (uchar **)mergebuf,
|
||||
dynamic_element(&sinfo->buffpek, 0, BUFFPEK *),
|
||||
&maxbuffer, &sinfo->tempfile))
|
||||
(int*) &maxbuffer, &sinfo->tempfile))
|
||||
{
|
||||
got_error=1;
|
||||
continue;
|
||||
|
@ -60,19 +60,19 @@ static int my_aes_create_key(KEYINSTANCE *aes_key,
|
||||
enum encrypt_dir direction, const char *key,
|
||||
int key_length)
|
||||
{
|
||||
char rkey[AES_KEY_LENGTH/8]; /* The real key to be used for encryption */
|
||||
char *rkey_end=rkey+AES_KEY_LENGTH/8; /* Real key boundary */
|
||||
char *ptr; /* Start of the real key*/
|
||||
uint8 rkey[AES_KEY_LENGTH/8]; /* The real key to be used for encryption */
|
||||
uint8 *rkey_end=rkey+AES_KEY_LENGTH/8; /* Real key boundary */
|
||||
uint8 *ptr; /* Start of the real key*/
|
||||
const char *sptr; /* Start of the working key */
|
||||
const char *key_end=key+key_length; /* Working key boundary*/
|
||||
|
||||
bzero(rkey,AES_KEY_LENGTH/8); /* Set initial key */
|
||||
bzero((char*) rkey,AES_KEY_LENGTH/8); /* Set initial key */
|
||||
|
||||
for (ptr= rkey, sptr= key; sptr < key_end; ptr++,sptr++)
|
||||
{
|
||||
if (ptr == rkey_end)
|
||||
ptr= rkey; /* Just loop over tmp_key until we used all key */
|
||||
*ptr^= *sptr;
|
||||
*ptr^= (uint8) *sptr;
|
||||
}
|
||||
#ifdef AES_USE_KEY_BITS
|
||||
/*
|
||||
@ -128,7 +128,7 @@ int my_aes_encrypt(const char* source, int source_length, char* dest,
|
||||
const char* key, int key_length)
|
||||
{
|
||||
KEYINSTANCE aes_key;
|
||||
char block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */
|
||||
uint8 block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */
|
||||
int rc; /* result codes */
|
||||
int num_blocks; /* number of complete blocks */
|
||||
char pad_len; /* pad size for the last block */
|
||||
@ -141,7 +141,8 @@ int my_aes_encrypt(const char* source, int source_length, char* dest,
|
||||
|
||||
for (i = num_blocks; i > 0; i--) /* Encode complete blocks */
|
||||
{
|
||||
rijndaelEncrypt(aes_key.rk, aes_key.nr, source, dest);
|
||||
rijndaelEncrypt(aes_key.rk, aes_key.nr, (const uint8*) source,
|
||||
(uint8*) dest);
|
||||
source+= AES_BLOCK_SIZE;
|
||||
dest+= AES_BLOCK_SIZE;
|
||||
}
|
||||
@ -150,7 +151,7 @@ int my_aes_encrypt(const char* source, int source_length, char* dest,
|
||||
pad_len = AES_BLOCK_SIZE - (source_length - AES_BLOCK_SIZE*num_blocks);
|
||||
memcpy(block, source, 16 - pad_len);
|
||||
bfill(block + AES_BLOCK_SIZE - pad_len, pad_len, pad_len);
|
||||
rijndaelEncrypt(aes_key.rk, aes_key.nr, block, dest);
|
||||
rijndaelEncrypt(aes_key.rk, aes_key.nr, block, (uint8*) dest);
|
||||
return AES_BLOCK_SIZE*(num_blocks + 1);
|
||||
}
|
||||
|
||||
@ -175,7 +176,7 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
|
||||
const char *key, int key_length)
|
||||
{
|
||||
KEYINSTANCE aes_key;
|
||||
char block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */
|
||||
uint8 block[AES_BLOCK_SIZE]; /* 128 bit block used for padding */
|
||||
int rc; /* Result codes */
|
||||
int num_blocks; /* Number of complete blocks */
|
||||
uint pad_len; /* Pad size for the last block */
|
||||
@ -191,12 +192,13 @@ int my_aes_decrypt(const char *source, int source_length, char *dest,
|
||||
|
||||
for (i = num_blocks-1; i > 0; i--) /* Decode all but last blocks */
|
||||
{
|
||||
rijndaelDecrypt(aes_key.rk, aes_key.nr, source, dest);
|
||||
rijndaelDecrypt(aes_key.rk, aes_key.nr, (const uint8*) source,
|
||||
(uint8*) dest);
|
||||
source+= AES_BLOCK_SIZE;
|
||||
dest+= AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
rijndaelDecrypt(aes_key.rk, aes_key.nr, source, block);
|
||||
rijndaelDecrypt(aes_key.rk, aes_key.nr, (const uint8*) source, block);
|
||||
/* Use last char in the block as size */
|
||||
pad_len = (uint) (uchar) block[AES_BLOCK_SIZE-1];
|
||||
|
||||
|
@ -101,6 +101,7 @@ SUFFIXES = .sh
|
||||
-e 's!@''CXX''@!@CXX@!'\
|
||||
-e 's!@''GXX''@!@GXX@!'\
|
||||
-e 's!@''PERL''@!@PERL@!' \
|
||||
-e 's!@''ASFLAGS''@!@SAVE_ASFLAGS@!'\
|
||||
-e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\
|
||||
-e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\
|
||||
-e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\
|
||||
|
@ -8,7 +8,7 @@ VERSION="@VERSION@@MYSQL_SERVER_SUFFIX@"
|
||||
COMPILATION_COMMENT="@COMPILATION_COMMENT@"
|
||||
BUGmysql="mysql@lists.mysql.com"
|
||||
# This is set by configure
|
||||
COMP_ENV_INFO="CC='@CC@' CFLAGS='@CFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' LDFLAGS='@LDFLAGS@'"
|
||||
COMP_ENV_INFO="CC='@CC@' CFLAGS='@CFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' LDFLAGS='@LDFLAGS@' ASFLAGS='@ASFLAGS@'"
|
||||
CONFIGURE_LINE="@CONF_COMMAND@"
|
||||
|
||||
LIBC_INFO=""
|
||||
|
18
sql/field.cc
18
sql/field.cc
@ -3703,12 +3703,12 @@ int Field_string::pack_cmp(const char *b, uint length)
|
||||
}
|
||||
|
||||
|
||||
uint Field_string::packed_col_length(const char *ptr, uint length)
|
||||
uint Field_string::packed_col_length(const char *data_ptr, uint length)
|
||||
{
|
||||
if (length > 255)
|
||||
return uint2korr(ptr)+2;
|
||||
return uint2korr(data_ptr)+2;
|
||||
else
|
||||
return (uint) ((uchar) *ptr)+1;
|
||||
return (uint) ((uchar) *data_ptr)+1;
|
||||
}
|
||||
|
||||
uint Field_string::max_packed_col_length(uint max_length)
|
||||
@ -3922,12 +3922,12 @@ int Field_varstring::pack_cmp(const char *b, uint key_length)
|
||||
return my_sortncmp(a,a_length, b,b_length);
|
||||
}
|
||||
|
||||
uint Field_varstring::packed_col_length(const char *ptr, uint length)
|
||||
uint Field_varstring::packed_col_length(const char *data_ptr, uint length)
|
||||
{
|
||||
if (length > 255)
|
||||
return uint2korr(ptr)+2;
|
||||
return uint2korr(data_ptr)+2;
|
||||
else
|
||||
return (uint) ((uchar) *ptr)+1;
|
||||
return (uint) ((uchar) *data_ptr)+1;
|
||||
}
|
||||
|
||||
uint Field_varstring::max_packed_col_length(uint max_length)
|
||||
@ -4408,12 +4408,12 @@ char *Field_blob::pack_key_from_key_image(char *to, const char *from,
|
||||
return to+length;
|
||||
}
|
||||
|
||||
uint Field_blob::packed_col_length(const char *ptr, uint length)
|
||||
uint Field_blob::packed_col_length(const char *data_ptr, uint length)
|
||||
{
|
||||
if (length > 255)
|
||||
return uint2korr(ptr)+2;
|
||||
return uint2korr(data_ptr)+2;
|
||||
else
|
||||
return (uint) ((uchar) *ptr)+1;
|
||||
return (uint) ((uchar) *data_ptr)+1;
|
||||
}
|
||||
|
||||
uint Field_blob::max_packed_col_length(uint max_length)
|
||||
|
@ -732,7 +732,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file,
|
||||
org_max_rows=max_rows=param->max_rows;
|
||||
|
||||
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
|
||||
(int (*) (void *, byte *,byte*))
|
||||
(queue_compare)
|
||||
(cmp=get_ptr_compare(sort_length)),(void*) &sort_length))
|
||||
DBUG_RETURN(1); /* purecov: inspected */
|
||||
for (buffpek= Fb ; buffpek <= Tb ; buffpek++)
|
||||
|
@ -360,7 +360,7 @@ static void usage(int version)
|
||||
}
|
||||
|
||||
|
||||
static my_bool
|
||||
extern "C" static my_bool
|
||||
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
char *argument __attribute__((unused)))
|
||||
{
|
||||
|
@ -3344,7 +3344,7 @@ ha_innobase::estimate_number_of_rows(void)
|
||||
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
|
||||
dict_index_t* index;
|
||||
ulonglong estimate;
|
||||
ulonglong data_file_length;
|
||||
ulonglong local_data_file_length;
|
||||
|
||||
/* Warning: since it is not sure that MySQL calls external_lock
|
||||
before calling this function, the trx field in prebuilt can be
|
||||
@ -3354,7 +3354,7 @@ ha_innobase::estimate_number_of_rows(void)
|
||||
|
||||
index = dict_table_get_first_index_noninline(prebuilt->table);
|
||||
|
||||
data_file_length = ((ulonglong) index->stat_n_leaf_pages)
|
||||
local_data_file_length = ((ulonglong) index->stat_n_leaf_pages)
|
||||
* UNIV_PAGE_SIZE;
|
||||
|
||||
/* Calculate a minimum length for a clustered index record and from
|
||||
@ -3363,7 +3363,7 @@ ha_innobase::estimate_number_of_rows(void)
|
||||
by a threshold factor, we must add a safety factor 2 in front
|
||||
of the formula below. */
|
||||
|
||||
estimate = 2 * data_file_length / dict_index_calc_min_rec_len(index);
|
||||
estimate = 2 * local_data_file_length / dict_index_calc_min_rec_len(index);
|
||||
|
||||
DBUG_RETURN((ha_rows) estimate);
|
||||
}
|
||||
@ -3847,9 +3847,9 @@ innodb_show_status(
|
||||
DBUG_ENTER("innodb_show_status");
|
||||
|
||||
if (innodb_skip) {
|
||||
fprintf(stderr,
|
||||
"Cannot call SHOW INNODB STATUS because skip-innodb is defined\n");
|
||||
|
||||
my_message(ER_NOT_SUPPORTED_YET,
|
||||
"Cannot call SHOW INNODB STATUS because skip-innodb is defined",
|
||||
MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -190,13 +190,15 @@ THR_LOCK_DATA **ha_isammrg::store_lock(THD *thd,
|
||||
THR_LOCK_DATA **to,
|
||||
enum thr_lock_type lock_type)
|
||||
{
|
||||
MRG_TABLE *table;
|
||||
MRG_TABLE *open_table;
|
||||
|
||||
for (table=file->open_tables ; table != file->end_table ; table++)
|
||||
for (open_table=file->open_tables ;
|
||||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
{
|
||||
*(to++)= &table->table->lock;
|
||||
if (lock_type != TL_IGNORE && table->table->lock.type == TL_UNLOCK)
|
||||
table->table->lock.type=lock_type;
|
||||
*(to++)= &open_table->table->lock;
|
||||
if (lock_type != TL_IGNORE && open_table->table->lock.type == TL_UNLOCK)
|
||||
open_table->table->lock.type=lock_type;
|
||||
}
|
||||
return to;
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ void ha_myisam::update_create_info(HA_CREATE_INFO *create_info)
|
||||
}
|
||||
|
||||
|
||||
int ha_myisam::create(const char *name, register TABLE *table,
|
||||
int ha_myisam::create(const char *name, register TABLE *table_arg,
|
||||
HA_CREATE_INFO *info)
|
||||
{
|
||||
int error;
|
||||
@ -1016,20 +1016,20 @@ int ha_myisam::create(const char *name, register TABLE *table,
|
||||
MI_KEYDEF *keydef;
|
||||
MI_COLUMNDEF *recinfo,*recinfo_pos;
|
||||
MI_KEYSEG *keyseg;
|
||||
uint options=table->db_options_in_use;
|
||||
uint options=table_arg->db_options_in_use;
|
||||
DBUG_ENTER("ha_myisam::create");
|
||||
|
||||
type=HA_KEYTYPE_BINARY; // Keep compiler happy
|
||||
if (!(my_multi_malloc(MYF(MY_WME),
|
||||
&recinfo,(table->fields*2+2)*sizeof(MI_COLUMNDEF),
|
||||
&keydef, table->keys*sizeof(MI_KEYDEF),
|
||||
&recinfo,(table_arg->fields*2+2)*sizeof(MI_COLUMNDEF),
|
||||
&keydef, table_arg->keys*sizeof(MI_KEYDEF),
|
||||
&keyseg,
|
||||
((table->key_parts + table->keys) * sizeof(MI_KEYSEG)),
|
||||
((table_arg->key_parts + table_arg->keys) * sizeof(MI_KEYSEG)),
|
||||
0)))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
pos=table->key_info;
|
||||
for (i=0; i < table->keys ; i++, pos++)
|
||||
pos=table_arg->key_info;
|
||||
for (i=0; i < table_arg->keys ; i++, pos++)
|
||||
{
|
||||
keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT));
|
||||
keydef[i].seg=keyseg;
|
||||
@ -1072,7 +1072,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
|
||||
{
|
||||
keydef[i].seg[j].null_bit=field->null_bit;
|
||||
keydef[i].seg[j].null_pos= (uint) (field->null_ptr-
|
||||
(uchar*) table->record[0]);
|
||||
(uchar*) table_arg->record[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1090,19 +1090,19 @@ int ha_myisam::create(const char *name, register TABLE *table,
|
||||
keydef[i].seg[j].flag|=HA_BLOB_PART;
|
||||
/* save number of bytes used to pack length */
|
||||
keydef[i].seg[j].bit_start= (uint) (field->pack_length() -
|
||||
table->blob_ptr_size);
|
||||
table_arg->blob_ptr_size);
|
||||
}
|
||||
}
|
||||
keyseg+=pos->key_parts;
|
||||
}
|
||||
|
||||
recpos=0; recinfo_pos=recinfo;
|
||||
while (recpos < (uint) table->reclength)
|
||||
while (recpos < (uint) table_arg->reclength)
|
||||
{
|
||||
Field **field,*found=0;
|
||||
minpos=table->reclength; length=0;
|
||||
minpos=table_arg->reclength; length=0;
|
||||
|
||||
for (field=table->field ; *field ; field++)
|
||||
for (field=table_arg->field ; *field ; field++)
|
||||
{
|
||||
if ((fieldpos=(*field)->offset()) >= recpos &&
|
||||
fieldpos <= minpos)
|
||||
@ -1148,7 +1148,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
|
||||
{
|
||||
recinfo_pos->null_bit=found->null_bit;
|
||||
recinfo_pos->null_pos= (uint) (found->null_ptr-
|
||||
(uchar*) table->record[0]);
|
||||
(uchar*) table_arg->record[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1163,13 +1163,13 @@ int ha_myisam::create(const char *name, register TABLE *table,
|
||||
}
|
||||
MI_CREATE_INFO create_info;
|
||||
bzero((char*) &create_info,sizeof(create_info));
|
||||
create_info.max_rows=table->max_rows;
|
||||
create_info.reloc_rows=table->min_rows;
|
||||
create_info.max_rows=table_arg->max_rows;
|
||||
create_info.reloc_rows=table_arg->min_rows;
|
||||
create_info.auto_increment=(info->auto_increment_value ?
|
||||
info->auto_increment_value -1 :
|
||||
(ulonglong) 0);
|
||||
create_info.data_file_length= ((ulonglong) table->max_rows *
|
||||
table->avg_row_length);
|
||||
create_info.data_file_length= ((ulonglong) table_arg->max_rows *
|
||||
table_arg->avg_row_length);
|
||||
create_info.raid_type=info->raid_type;
|
||||
create_info.raid_chunks= (info->raid_chunks ? info->raid_chunks :
|
||||
RAID_DEFAULT_CHUNKS);
|
||||
@ -1179,7 +1179,7 @@ int ha_myisam::create(const char *name, register TABLE *table,
|
||||
create_info.index_file_name=info->index_file_name;
|
||||
|
||||
error=mi_create(fn_format(buff,name,"","",2+4),
|
||||
table->keys,keydef,
|
||||
table_arg->keys,keydef,
|
||||
(uint) (recinfo_pos-recinfo), recinfo,
|
||||
0, (MI_UNIQUEDEF*) 0,
|
||||
&create_info,
|
||||
|
@ -262,13 +262,15 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd,
|
||||
THR_LOCK_DATA **to,
|
||||
enum thr_lock_type lock_type)
|
||||
{
|
||||
MYRG_TABLE *table;
|
||||
MYRG_TABLE *open_table;
|
||||
|
||||
for (table=file->open_tables ; table != file->end_table ; table++)
|
||||
for (open_table=file->open_tables ;
|
||||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
{
|
||||
*(to++)= &table->table->lock;
|
||||
if (lock_type != TL_IGNORE && table->table->lock.type == TL_UNLOCK)
|
||||
table->table->lock.type=lock_type;
|
||||
*(to++)= &open_table->table->lock;
|
||||
if (lock_type != TL_IGNORE && open_table->table->lock.type == TL_UNLOCK)
|
||||
open_table->table->lock.type=lock_type;
|
||||
}
|
||||
return to;
|
||||
}
|
||||
@ -279,14 +281,16 @@ void ha_myisammrg::update_create_info(HA_CREATE_INFO *create_info)
|
||||
DBUG_ENTER("ha_myisammrg::update_create_info");
|
||||
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
|
||||
{
|
||||
MYRG_TABLE *table;
|
||||
MYRG_TABLE *open_table;
|
||||
THD *thd=current_thd;
|
||||
create_info->merge_list.next= &create_info->merge_list.first;
|
||||
create_info->merge_list.elements=0;
|
||||
|
||||
for (table=file->open_tables ; table != file->end_table ; table++)
|
||||
for (open_table=file->open_tables ;
|
||||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
{
|
||||
char *name=table->table->filename;
|
||||
char *name=open_table->table->filename;
|
||||
char buff[FN_REFLEN];
|
||||
TABLE_LIST *ptr;
|
||||
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
|
||||
@ -340,13 +344,15 @@ void ha_myisammrg::append_create_info(String *packet)
|
||||
packet->append(get_type(&merge_insert_method,file->merge_insert_method-1));
|
||||
}
|
||||
packet->append(" UNION=(",8);
|
||||
MYRG_TABLE *table,*first;
|
||||
MYRG_TABLE *open_table,*first;
|
||||
|
||||
for (first=table=file->open_tables ; table != file->end_table ; table++)
|
||||
for (first=open_table=file->open_tables ;
|
||||
open_table != file->end_table ;
|
||||
open_table++)
|
||||
{
|
||||
char *name=table->table->filename;
|
||||
char *name= open_table->table->filename;
|
||||
fn_format(buff,name,"","",3);
|
||||
if (table != first)
|
||||
if (open_table != first)
|
||||
packet->append(',');
|
||||
packet->append(buff,(uint) strlen(buff));
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class hash_filo
|
||||
{
|
||||
const uint size, key_offset, key_length;
|
||||
const hash_get_key get_key;
|
||||
void (*free_element)(void*);
|
||||
hash_free_key free_element;
|
||||
bool init;
|
||||
|
||||
hash_filo_element *first_link,*last_link;
|
||||
@ -49,7 +49,7 @@ public:
|
||||
HASH cache;
|
||||
|
||||
hash_filo(uint size_arg, uint key_offset_arg , uint key_length_arg,
|
||||
hash_get_key get_key_arg,void (*free_element_arg)(void*))
|
||||
hash_get_key get_key_arg, hash_free_key free_element_arg)
|
||||
:size(size_arg), key_offset(key_offset_arg), key_length(key_length_arg),
|
||||
get_key(get_key_arg), free_element(free_element_arg),init(0)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ bool hostname_cache_init()
|
||||
|
||||
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
|
||||
sizeof(struct in_addr),NULL,
|
||||
(void (*)(void*)) free)))
|
||||
(hash_free_key) free)))
|
||||
return 1;
|
||||
hostname_cache->clear();
|
||||
return 0;
|
||||
|
@ -292,9 +292,9 @@ public:
|
||||
virtual void set(uint pos,Item *item)=0;
|
||||
virtual byte *get_value(Item *item)=0;
|
||||
void sort()
|
||||
{
|
||||
qsort(base,used_count,size,compare);
|
||||
}
|
||||
{
|
||||
qsort(base,used_count,size,compare);
|
||||
}
|
||||
int find(Item *item);
|
||||
};
|
||||
|
||||
|
@ -711,13 +711,14 @@ double Item_func_rand::val()
|
||||
}
|
||||
else if (!thd->rand_used)
|
||||
{
|
||||
// no need to send a Rand log event if seed was given eg: RAND(seed),
|
||||
// as it will be replicated in the query as such.
|
||||
/*
|
||||
No need to send a Rand log event if seed was given eg: RAND(seed),
|
||||
as it will be replicated in the query as such.
|
||||
|
||||
// save the seed only the first time RAND() is used in the query
|
||||
|
||||
// once events are forwarded rather than recreated,
|
||||
// the following can be skipped if inside the slave thread
|
||||
Save the seed only the first time RAND() is used in the query
|
||||
Once events are forwarded rather than recreated,
|
||||
the following can be skipped if inside the slave thread
|
||||
*/
|
||||
thd->rand_used=1;
|
||||
thd->rand_saved_seed1=thd->rand.seed1;
|
||||
thd->rand_saved_seed2=thd->rand.seed2;
|
||||
@ -1957,13 +1958,13 @@ void Item_func_set_user_var::print(String *str)
|
||||
|
||||
user_var_entry *Item_func_get_user_var::get_entry()
|
||||
{
|
||||
if (!entry || ! entry->value)
|
||||
if (!var_entry || ! var_entry->value)
|
||||
{
|
||||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
null_value=0;
|
||||
return entry;
|
||||
return var_entry;
|
||||
}
|
||||
|
||||
|
||||
@ -2032,8 +2033,8 @@ void Item_func_get_user_var::fix_length_and_dec()
|
||||
maybe_null=1;
|
||||
decimals=NOT_FIXED_DEC;
|
||||
max_length=MAX_BLOB_WIDTH;
|
||||
if ((entry= get_variable(&thd->user_vars, name, 0)))
|
||||
const_var_flag= thd->query_id != entry->update_query_id;
|
||||
if ((var_entry= get_variable(&thd->user_vars, name, 0)))
|
||||
const_var_flag= thd->query_id != var_entry->update_query_id;
|
||||
}
|
||||
|
||||
|
||||
@ -2208,18 +2209,18 @@ bool Item_func_match::fix_index()
|
||||
{
|
||||
List_iterator_fast<Item> li(fields);
|
||||
Item_field *item;
|
||||
uint ft_to_key[MAX_KEY], ft_cnt[MAX_KEY], fts=0, key;
|
||||
uint ft_to_key[MAX_KEY], ft_cnt[MAX_KEY], fts=0, keynr;
|
||||
uint max_cnt=0, mkeys=0;
|
||||
|
||||
if (this->key == NO_SUCH_KEY)
|
||||
if (key == NO_SUCH_KEY)
|
||||
return 0;
|
||||
|
||||
for (key=0 ; key<table->keys ; key++)
|
||||
for (keynr=0 ; keynr < table->keys ; keynr++)
|
||||
{
|
||||
if ((table->key_info[key].flags & HA_FULLTEXT) &&
|
||||
(table->keys_in_use_for_query & (((key_map)1) << key)))
|
||||
if ((table->key_info[keynr].flags & HA_FULLTEXT) &&
|
||||
(table->keys_in_use_for_query & (((key_map)1) << keynr)))
|
||||
{
|
||||
ft_to_key[fts]=key;
|
||||
ft_to_key[fts]=keynr;
|
||||
ft_cnt[fts]=0;
|
||||
fts++;
|
||||
}
|
||||
@ -2230,45 +2231,45 @@ bool Item_func_match::fix_index()
|
||||
|
||||
while ((item=(Item_field*)(li++)))
|
||||
{
|
||||
for (key=0 ; key<fts ; key++)
|
||||
for (keynr=0 ; keynr < fts ; keynr++)
|
||||
{
|
||||
KEY *ft_key=&table->key_info[ft_to_key[key]];
|
||||
KEY *ft_key=&table->key_info[ft_to_key[keynr]];
|
||||
uint key_parts=ft_key->key_parts;
|
||||
|
||||
for (uint part=0 ; part < key_parts ; part++)
|
||||
{
|
||||
if (item->field->eq(ft_key->key_part[part].field))
|
||||
ft_cnt[key]++;
|
||||
ft_cnt[keynr]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (key=0 ; key<fts ; key++)
|
||||
for (keynr=0 ; keynr < fts ; keynr++)
|
||||
{
|
||||
if (ft_cnt[key] > max_cnt)
|
||||
if (ft_cnt[keynr] > max_cnt)
|
||||
{
|
||||
mkeys=0;
|
||||
max_cnt=ft_cnt[mkeys]=ft_cnt[key];
|
||||
ft_to_key[mkeys]=ft_to_key[key];
|
||||
max_cnt=ft_cnt[mkeys]=ft_cnt[keynr];
|
||||
ft_to_key[mkeys]=ft_to_key[keynr];
|
||||
continue;
|
||||
}
|
||||
if (max_cnt && ft_cnt[key] == max_cnt)
|
||||
if (max_cnt && ft_cnt[keynr] == max_cnt)
|
||||
{
|
||||
mkeys++;
|
||||
ft_cnt[mkeys]=ft_cnt[key];
|
||||
ft_to_key[mkeys]=ft_to_key[key];
|
||||
ft_cnt[mkeys]=ft_cnt[keynr];
|
||||
ft_to_key[mkeys]=ft_to_key[keynr];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (key=0 ; key<=mkeys ; key++)
|
||||
for (keynr=0 ; keynr <= mkeys ; keynr++)
|
||||
{
|
||||
// for now, partial keys won't work. SerG
|
||||
if (max_cnt < fields.elements ||
|
||||
max_cnt < table->key_info[ft_to_key[key]].key_parts)
|
||||
max_cnt < table->key_info[ft_to_key[keynr]].key_parts)
|
||||
continue;
|
||||
|
||||
this->key=ft_to_key[key];
|
||||
key=ft_to_key[keynr];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2276,7 +2277,7 @@ bool Item_func_match::fix_index()
|
||||
err:
|
||||
if (mode == FT_BOOL)
|
||||
{
|
||||
this->key=NO_SUCH_KEY;
|
||||
key=NO_SUCH_KEY;
|
||||
return 0;
|
||||
}
|
||||
my_printf_error(ER_FT_MATCHING_KEY_NOT_FOUND,
|
||||
|
@ -901,7 +901,7 @@ public:
|
||||
class Item_func_get_user_var :public Item_func
|
||||
{
|
||||
LEX_STRING name;
|
||||
user_var_entry *entry;
|
||||
user_var_entry *var_entry;
|
||||
bool const_var_flag;
|
||||
|
||||
public:
|
||||
|
20
sql/log.cc
20
sql/log.cc
@ -1027,7 +1027,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
||||
{
|
||||
bool should_rotate = 0;
|
||||
THD *thd=event_info->thd;
|
||||
const char* db = event_info->get_db();
|
||||
const char *local_db = event_info->get_db();
|
||||
#ifdef USING_TRANSACTIONS
|
||||
IO_CACHE *file = ((event_info->get_cache_stmt()) ?
|
||||
&thd->transaction.trans_log :
|
||||
@ -1037,7 +1037,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
|
||||
#endif
|
||||
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
|
||||
(thd->master_access & SUPER_ACL)) ||
|
||||
(db && !db_ok(db, binlog_do_db, binlog_ignore_db)))
|
||||
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||
return 0;
|
||||
@ -1237,7 +1237,7 @@ err:
|
||||
*/
|
||||
|
||||
bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
|
||||
time_t query_start)
|
||||
time_t query_start_arg)
|
||||
{
|
||||
bool error=0;
|
||||
if (is_open())
|
||||
@ -1255,7 +1255,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
|
||||
VOID(pthread_mutex_unlock(&LOCK_log));
|
||||
return 0;
|
||||
}
|
||||
if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start)
|
||||
if ((specialflag & SPECIAL_LONG_LOG_FORMAT) || query_start_arg)
|
||||
{
|
||||
current_time=time(NULL);
|
||||
if (current_time != last_time)
|
||||
@ -1283,13 +1283,13 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
|
||||
thd->ip ? thd->ip : "") == (uint) -1)
|
||||
tmp_errno=errno;
|
||||
}
|
||||
if (query_start)
|
||||
if (query_start_arg)
|
||||
{
|
||||
/* For slow query log */
|
||||
if (my_b_printf(&log_file,
|
||||
"# Query_time: %lu Lock_time: %lu Rows_sent: %lu Rows_examined: %lu\n",
|
||||
(ulong) (current_time - query_start),
|
||||
(ulong) (thd->time_after_lock - query_start),
|
||||
(ulong) (current_time - query_start_arg),
|
||||
(ulong) (thd->time_after_lock - query_start_arg),
|
||||
(ulong) thd->sent_row_count,
|
||||
(ulong) thd->examined_row_count) == (uint) -1)
|
||||
tmp_errno=errno;
|
||||
@ -1316,11 +1316,11 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
|
||||
}
|
||||
if (thd->query_start_used)
|
||||
{
|
||||
if (query_start != thd->query_start())
|
||||
if (query_start_arg != thd->query_start())
|
||||
{
|
||||
query_start=thd->query_start();
|
||||
query_start_arg=thd->query_start();
|
||||
end=strmov(end,",timestamp=");
|
||||
end=int10_to_str((long) query_start,end,10);
|
||||
end=int10_to_str((long) query_start_arg,end,10);
|
||||
}
|
||||
}
|
||||
if (end != buff)
|
||||
|
@ -391,9 +391,9 @@ void Log_event::init_show_field_list(List<Item>* field_list)
|
||||
/*
|
||||
* only called by SHOW BINLOG EVENTS
|
||||
*/
|
||||
int Log_event::net_send(THD* thd, const char* log_name, my_off_t pos)
|
||||
int Log_event::net_send(THD* thd_arg, const char* log_name, my_off_t pos)
|
||||
{
|
||||
String* packet = &thd->packet;
|
||||
String* packet = &thd_arg->packet;
|
||||
const char* p = strrchr(log_name, FN_LIBCHAR);
|
||||
const char* event_type;
|
||||
if (p)
|
||||
@ -407,7 +407,7 @@ int Log_event::net_send(THD* thd, const char* log_name, my_off_t pos)
|
||||
net_store_data(packet, server_id);
|
||||
net_store_data(packet, (longlong) log_pos);
|
||||
pack_info(packet);
|
||||
return my_net_write(&thd->net, (char*) packet->ptr(), packet->length());
|
||||
return my_net_write(&thd_arg->net, (char*) packet->ptr(), packet->length());
|
||||
}
|
||||
|
||||
#endif /* MYSQL_CLIENT */
|
||||
@ -1090,18 +1090,18 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
|
||||
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
|
||||
Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex,
|
||||
const char* db_arg, const char* table_name_arg,
|
||||
List<Item>& fields_arg,
|
||||
enum enum_duplicates handle_dup)
|
||||
:Log_event(thd),thread_id(thd->thread_id), num_fields(0),fields(0),
|
||||
:Log_event(thd_arg),thread_id(thd_arg->thread_id), num_fields(0),fields(0),
|
||||
field_lens(0),field_block_len(0),
|
||||
table_name(table_name_arg ? table_name_arg : ""),
|
||||
db(db_arg), fname(ex->file_name)
|
||||
{
|
||||
time_t end_time;
|
||||
time(&end_time);
|
||||
exec_time = (ulong) (end_time - thd->start_time);
|
||||
exec_time = (ulong) (end_time - thd_arg->start_time);
|
||||
/* db can never be a zero pointer in 4.0 */
|
||||
db_len = (uint32) strlen(db);
|
||||
table_name_len = (uint32) strlen(table_name);
|
||||
@ -1170,8 +1170,8 @@ Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
|
||||
*/
|
||||
|
||||
Load_log_event::Load_log_event(const char* buf, int event_len,
|
||||
bool old_format):
|
||||
Log_event(buf, old_format),num_fields(0),fields(0),
|
||||
bool old_format)
|
||||
:Log_event(buf, old_format),num_fields(0),fields(0),
|
||||
field_lens(0),field_block_len(0),
|
||||
table_name(0),db(0),fname(0)
|
||||
{
|
||||
@ -1318,14 +1318,14 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
|
||||
}
|
||||
|
||||
|
||||
void Load_log_event::set_fields(List<Item> &fields)
|
||||
void Load_log_event::set_fields(List<Item> &field_list)
|
||||
{
|
||||
uint i;
|
||||
const char* field = this->fields;
|
||||
for (i = 0; i < num_fields; i++)
|
||||
const char *field= fields;
|
||||
for (i= 0; i < num_fields; i++)
|
||||
{
|
||||
fields.push_back(new Item_field(db, table_name, field));
|
||||
field += field_lens[i] + 1;
|
||||
field_list.push_back(new Item_field(db, table_name, field));
|
||||
field+= field_lens[i] + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1799,8 +1799,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
||||
ex.field_term->length(0);
|
||||
|
||||
ex.skip_lines = skip_lines;
|
||||
List<Item> fields;
|
||||
set_fields(fields);
|
||||
List<Item> field_list;
|
||||
set_fields(field_list);
|
||||
thd->slave_proxy_id = thd->thread_id;
|
||||
if (net)
|
||||
{
|
||||
@ -1811,7 +1811,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
||||
*/
|
||||
thd->net.pkt_nr = net->pkt_nr;
|
||||
}
|
||||
if (mysql_load(thd, &ex, &tables, fields, handle_dup, net != 0,
|
||||
if (mysql_load(thd, &ex, &tables, field_list, handle_dup, net != 0,
|
||||
TL_WRITE))
|
||||
thd->query_error = 1;
|
||||
if (thd->cuted_fields)
|
||||
|
@ -311,9 +311,8 @@ void mysql_init_multi_delete(LEX *lex);
|
||||
void init_max_user_conn(void);
|
||||
void init_update_queries(void);
|
||||
void free_max_user_conn(void);
|
||||
pthread_handler_decl(handle_one_connection,arg);
|
||||
pthread_handler_decl(handle_bootstrap,arg);
|
||||
sig_handler end_thread_signal(int sig);
|
||||
extern "C" pthread_handler_decl(handle_one_connection,arg);
|
||||
extern "C" pthread_handler_decl(handle_bootstrap,arg);
|
||||
void end_thread(THD *thd,bool put_in_cache);
|
||||
void flush_thread_cache();
|
||||
void mysql_execute_command(void);
|
||||
@ -559,7 +558,7 @@ int write_record(TABLE *table,COPY_INFO *info);
|
||||
extern ulong volatile manager_status;
|
||||
extern bool volatile manager_thread_in_use, mqh_used;
|
||||
extern pthread_t manager_thread;
|
||||
pthread_handler_decl(handle_manager, arg);
|
||||
extern "C" pthread_handler_decl(handle_manager, arg);
|
||||
|
||||
/* sql_test.cc */
|
||||
#ifndef DBUG_OFF
|
||||
@ -736,7 +735,7 @@ timestamp_type str_to_TIME(const char *str, uint length, TIME *l_time,
|
||||
|
||||
int test_if_number(char *str,int *res,bool allow_wildcards);
|
||||
void change_byte(byte *,uint,char,char);
|
||||
void unireg_abort(int exit_code);
|
||||
extern "C" void unireg_abort(int exit_code);
|
||||
void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
|
||||
SQL_SELECT *select,
|
||||
int use_record_cache, bool print_errors);
|
||||
|
@ -444,20 +444,20 @@ pthread_cond_t eventShutdown;
|
||||
#endif
|
||||
|
||||
static void start_signal_handler(void);
|
||||
static void *signal_hand(void *arg);
|
||||
extern "C" static pthread_handler_decl(signal_hand, arg);
|
||||
static void set_options(void);
|
||||
static void get_options(int argc,char **argv);
|
||||
static char *get_relative_path(const char *path);
|
||||
static void fix_paths(void);
|
||||
static pthread_handler_decl(handle_connections_sockets,arg);
|
||||
static pthread_handler_decl(kill_server_thread,arg);
|
||||
extern "C" static pthread_handler_decl(handle_connections_sockets,arg);
|
||||
extern "C" static pthread_handler_decl(kill_server_thread,arg);
|
||||
static int bootstrap(FILE *file);
|
||||
static void close_server_sock();
|
||||
static bool read_init_file(char *file_name);
|
||||
#ifdef __NT__
|
||||
static pthread_handler_decl(handle_connections_namedpipes,arg);
|
||||
extern "C" static pthread_handler_decl(handle_connections_namedpipes,arg);
|
||||
#endif
|
||||
extern pthread_handler_decl(handle_slave,arg);
|
||||
extern "C" extern pthread_handler_decl(handle_slave,arg);
|
||||
#ifdef SET_RLIMIT_NOFILE
|
||||
static uint set_maximum_open_files(uint max_file_limit);
|
||||
#endif
|
||||
@ -771,7 +771,7 @@ static void __cdecl kill_server(int sig_ptr)
|
||||
|
||||
|
||||
#ifdef USE_ONE_SIGNAL_HAND
|
||||
static pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
|
||||
extern "C" static pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
|
||||
{
|
||||
SHUTDOWN_THD;
|
||||
my_thread_init(); // Initialize new thread
|
||||
@ -786,7 +786,7 @@ static pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
|
||||
#define sigset signal
|
||||
#endif
|
||||
|
||||
static sig_handler print_signal_warning(int sig)
|
||||
extern "C" static sig_handler print_signal_warning(int sig)
|
||||
{
|
||||
if (!DBUG_IN_USE)
|
||||
{
|
||||
@ -812,7 +812,7 @@ void unireg_end(int signal_number __attribute__((unused)))
|
||||
}
|
||||
|
||||
|
||||
void unireg_abort(int exit_code)
|
||||
extern "C" void unireg_abort(int exit_code)
|
||||
{
|
||||
DBUG_ENTER("unireg_abort");
|
||||
if (exit_code)
|
||||
@ -1162,7 +1162,7 @@ void close_connection(NET *net,uint errcode,bool lock)
|
||||
/* Called when a thread is aborted */
|
||||
/* ARGSUSED */
|
||||
|
||||
sig_handler end_thread_signal(int sig __attribute__((unused)))
|
||||
extern "C" static sig_handler end_thread_signal(int sig __attribute__((unused)))
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
DBUG_ENTER("end_thread_signal");
|
||||
@ -1253,7 +1253,7 @@ void flush_thread_cache()
|
||||
*/
|
||||
|
||||
#ifdef THREAD_SPECIFIC_SIGPIPE
|
||||
static sig_handler abort_thread(int sig __attribute__((unused)))
|
||||
extern "C" static sig_handler abort_thread(int sig __attribute__((unused)))
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
DBUG_ENTER("abort_thread");
|
||||
@ -1327,7 +1327,7 @@ static void start_signal_handler(void)
|
||||
#define UNSAFE_DEFAULT_LINUX_THREADS 200
|
||||
#endif
|
||||
|
||||
static sig_handler handle_segfault(int sig)
|
||||
extern "C" static sig_handler handle_segfault(int sig)
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
/*
|
||||
@ -1512,7 +1512,7 @@ static void start_signal_handler(void)
|
||||
/* This threads handles all signals and alarms */
|
||||
|
||||
/* ARGSUSED */
|
||||
static void *signal_hand(void *arg __attribute__((unused)))
|
||||
extern "C" static void *signal_hand(void *arg __attribute__((unused)))
|
||||
{
|
||||
sigset_t set;
|
||||
int sig;
|
||||
@ -1640,7 +1640,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
static int my_message_sql(uint error, const char *str,
|
||||
extern "C" static int my_message_sql(uint error, const char *str,
|
||||
myf MyFlags __attribute__((unused)))
|
||||
{
|
||||
NET *net;
|
||||
@ -1674,7 +1674,7 @@ int uname(struct utsname *a)
|
||||
|
||||
|
||||
#ifdef __WIN__
|
||||
pthread_handler_decl(handle_shutdown,arg)
|
||||
extern "C" pthread_handler_decl(handle_shutdown,arg)
|
||||
{
|
||||
MSG msg;
|
||||
SHUTDOWN_THD;
|
||||
@ -1702,7 +1702,7 @@ int __stdcall handle_kill(ulong ctrl_type)
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
pthread_handler_decl(handle_shutdown,arg)
|
||||
extern "C" pthread_handler_decl(handle_shutdown,arg)
|
||||
{
|
||||
SHUTDOWN_THD;
|
||||
my_thread_init();
|
||||
@ -2500,7 +2500,7 @@ inline void kill_broken_server()
|
||||
|
||||
/* Handle new connections and spawn new process to handle them */
|
||||
|
||||
pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
||||
extern "C" pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
||||
{
|
||||
my_socket sock,new_sock;
|
||||
uint error_count=0;
|
||||
@ -2707,7 +2707,7 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
|
||||
|
||||
|
||||
#ifdef __NT__
|
||||
pthread_handler_decl(handle_connections_namedpipes,arg)
|
||||
extern "C" pthread_handler_decl(handle_connections_namedpipes,arg)
|
||||
{
|
||||
HANDLE hConnectedPipe;
|
||||
BOOL fConnected;
|
||||
@ -3218,7 +3218,7 @@ struct my_option my_long_options[] =
|
||||
(gptr*) &report_port, (gptr*) &report_port, 0, GET_UINT, REQUIRED_ARG,
|
||||
MYSQL_PORT, 0, 0, 0, 0, 0},
|
||||
{"rpl-recovery-rank", OPT_RPL_RECOVERY_RANK, "Undocumented",
|
||||
(gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_UINT,
|
||||
(gptr*) &rpl_recovery_rank, (gptr*) &rpl_recovery_rank, 0, GET_ULONG,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"relay-log", OPT_RELAY_LOG, "Undocumented",
|
||||
(gptr*) &opt_relay_logname, (gptr*) &opt_relay_logname, 0,
|
||||
@ -3910,7 +3910,7 @@ static void set_options(void)
|
||||
}
|
||||
|
||||
|
||||
static my_bool
|
||||
extern "C" static my_bool
|
||||
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
char *argument)
|
||||
{
|
||||
|
@ -2461,9 +2461,9 @@ int QUICK_SELECT::get_next()
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE); // All ranges used
|
||||
if (range->flag & NO_MIN_RANGE) // Read first record
|
||||
{
|
||||
int error;
|
||||
if ((error=file->index_first(record)))
|
||||
DBUG_RETURN(error); // Empty table
|
||||
int local_error;
|
||||
if ((local_error=file->index_first(record)))
|
||||
DBUG_RETURN(local_error); // Empty table
|
||||
if (cmp_next(range) == 0)
|
||||
DBUG_RETURN(0);
|
||||
range=0; // No matching records; go to next range
|
||||
@ -2496,13 +2496,13 @@ int QUICK_SELECT::get_next()
|
||||
/* compare if found key is over max-value */
|
||||
/* Returns 0 if key <= range->max_key */
|
||||
|
||||
int QUICK_SELECT::cmp_next(QUICK_RANGE *range)
|
||||
int QUICK_SELECT::cmp_next(QUICK_RANGE *range_arg)
|
||||
{
|
||||
if (range->flag & NO_MAX_RANGE)
|
||||
if (range_arg->flag & NO_MAX_RANGE)
|
||||
return (0); /* key can't be to large */
|
||||
|
||||
KEY_PART *key_part=key_parts;
|
||||
for (char *key=range->max_key, *end=key+range->max_length;
|
||||
for (char *key=range_arg->max_key, *end=key+range_arg->max_length;
|
||||
key < end;
|
||||
key+= key_part++->part_length)
|
||||
{
|
||||
@ -2523,7 +2523,7 @@ int QUICK_SELECT::cmp_next(QUICK_RANGE *range)
|
||||
if (cmp > 0)
|
||||
return 1;
|
||||
}
|
||||
return (range->flag & NEAR_MAX) ? 1 : 0; // Exact match
|
||||
return (range_arg->flag & NEAR_MAX) ? 1 : 0; // Exact match
|
||||
}
|
||||
|
||||
|
||||
@ -2607,9 +2607,9 @@ int QUICK_SELECT_DESC::get_next()
|
||||
|
||||
if (range->flag & NO_MAX_RANGE) // Read last record
|
||||
{
|
||||
int error;
|
||||
if ((error=file->index_last(record)))
|
||||
DBUG_RETURN(error); // Empty table
|
||||
int local_error;
|
||||
if ((local_error=file->index_last(record)))
|
||||
DBUG_RETURN(local_error); // Empty table
|
||||
if (cmp_prev(range) == 0)
|
||||
DBUG_RETURN(0);
|
||||
range=0; // No matching records; go to next range
|
||||
@ -2655,16 +2655,18 @@ int QUICK_SELECT_DESC::get_next()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns 0 if found key is inside range (found key >= range->min_key).
|
||||
*/
|
||||
int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range)
|
||||
Returns 0 if found key is inside range (found key >= range->min_key).
|
||||
*/
|
||||
|
||||
int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range_arg)
|
||||
{
|
||||
if (range->flag & NO_MIN_RANGE)
|
||||
if (range_arg->flag & NO_MIN_RANGE)
|
||||
return (0); /* key can't be to small */
|
||||
|
||||
KEY_PART *key_part = key_parts;
|
||||
for (char *key = range->min_key, *end = key + range->min_length;
|
||||
for (char *key = range_arg->min_key, *end = key + range_arg->min_length;
|
||||
key < end;
|
||||
key += key_part++->part_length)
|
||||
{
|
||||
@ -2688,42 +2690,45 @@ int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range)
|
||||
if (cmp < 0)
|
||||
return 1;
|
||||
}
|
||||
return (range->flag & NEAR_MIN) ? 1 : 0; // Exact match
|
||||
return (range_arg->flag & NEAR_MIN) ? 1 : 0; // Exact match
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* True if this range will require using HA_READ_AFTER_KEY
|
||||
See comment in get_next() about this
|
||||
*/
|
||||
|
||||
bool QUICK_SELECT_DESC::range_reads_after_key(QUICK_RANGE *range)
|
||||
bool QUICK_SELECT_DESC::range_reads_after_key(QUICK_RANGE *range_arg)
|
||||
{
|
||||
return ((range->flag & (NO_MAX_RANGE | NEAR_MAX)) ||
|
||||
!(range->flag & EQ_RANGE) ||
|
||||
head->key_info[index].key_length != range->max_length) ? 1 : 0;
|
||||
return ((range_arg->flag & (NO_MAX_RANGE | NEAR_MAX)) ||
|
||||
!(range_arg->flag & EQ_RANGE) ||
|
||||
head->key_info[index].key_length != range_arg->max_length) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/* True if we are reading over a key that may have a NULL value */
|
||||
|
||||
bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range,
|
||||
bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg,
|
||||
uint used_key_parts)
|
||||
{
|
||||
uint offset,end;
|
||||
KEY_PART *key_part = key_parts,
|
||||
*key_part_end= key_part+used_key_parts;
|
||||
|
||||
for (offset= 0, end = min(range->min_length, range->max_length) ;
|
||||
for (offset= 0, end = min(range_arg->min_length, range_arg->max_length) ;
|
||||
offset < end && key_part != key_part_end ;
|
||||
offset += key_part++->part_length)
|
||||
{
|
||||
uint null_length=test(key_part->null_bit);
|
||||
if (!memcmp((char*) range->min_key+offset, (char*) range->max_key+offset,
|
||||
if (!memcmp((char*) range_arg->min_key+offset,
|
||||
(char*) range_arg->max_key+offset,
|
||||
key_part->part_length + null_length))
|
||||
{
|
||||
offset+=null_length;
|
||||
continue;
|
||||
}
|
||||
if (null_length && range->min_key[offset])
|
||||
if (null_length && range_arg->min_key[offset])
|
||||
return 1; // min_key is null and max_key isn't
|
||||
// Range doesn't cover NULL. This is ok if there is no more null parts
|
||||
break;
|
||||
@ -2736,7 +2741,7 @@ bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range,
|
||||
*/
|
||||
if (key_part != key_part_end && key_part->null_bit)
|
||||
{
|
||||
if (offset >= range->min_length || range->min_key[offset])
|
||||
if (offset >= range_arg->min_length || range_arg->min_key[offset])
|
||||
return 1; // Could be null
|
||||
key_part++;
|
||||
}
|
||||
|
@ -188,14 +188,15 @@ err2:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint32* slave_list_key(SLAVE_INFO* si, uint* len,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" static uint32
|
||||
*slave_list_key(SLAVE_INFO* si, uint* len,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*len = 4;
|
||||
return &si->server_id;
|
||||
}
|
||||
|
||||
static void slave_info_free(void *s)
|
||||
extern "C" static void slave_info_free(void *s)
|
||||
{
|
||||
my_free((gptr) s, MYF(MY_WME));
|
||||
}
|
||||
@ -203,7 +204,7 @@ static void slave_info_free(void *s)
|
||||
void init_slave_list()
|
||||
{
|
||||
hash_init(&slave_list, SLAVE_LIST_CHUNK, 0, 0,
|
||||
(hash_get_key) slave_list_key, slave_info_free, 0);
|
||||
(hash_get_key) slave_list_key, (hash_free_key) slave_info_free, 0);
|
||||
pthread_mutex_init(&LOCK_slave_list, MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
|
||||
|
@ -556,7 +556,7 @@ void init_table_rule_hash(HASH* h, bool* h_inited)
|
||||
{
|
||||
hash_init(h, TABLE_RULE_HASH_SIZE,0,0,
|
||||
(hash_get_key) get_table_key,
|
||||
(void (*)(void*)) free_table_ent, 0);
|
||||
(hash_free_key) free_table_ent, 0);
|
||||
*h_inited = 1;
|
||||
}
|
||||
|
||||
@ -1809,7 +1809,7 @@ This may also be a network problem, or just a bug in the master or slave code.\
|
||||
|
||||
|
||||
/* slave I/O thread */
|
||||
pthread_handler_decl(handle_slave_io,arg)
|
||||
extern "C" pthread_handler_decl(handle_slave_io,arg)
|
||||
{
|
||||
THD *thd; // needs to be first for thread_stack
|
||||
MYSQL *mysql;
|
||||
@ -2080,7 +2080,7 @@ err:
|
||||
|
||||
/* slave SQL logic thread */
|
||||
|
||||
pthread_handler_decl(handle_slave_sql,arg)
|
||||
extern "C" pthread_handler_decl(handle_slave_sql,arg)
|
||||
{
|
||||
THD *thd; /* needs to be first for thread_stack */
|
||||
char llbuff[22],llbuff1[22];
|
||||
|
@ -414,8 +414,8 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,ulonglong pos,
|
||||
int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset,
|
||||
const char** errmsg);
|
||||
|
||||
pthread_handler_decl(handle_slave_io,arg);
|
||||
pthread_handler_decl(handle_slave_sql,arg);
|
||||
extern "C" pthread_handler_decl(handle_slave_io,arg);
|
||||
extern "C" pthread_handler_decl(handle_slave_sql,arg);
|
||||
extern bool volatile abort_loop;
|
||||
extern MASTER_INFO main_mi, *active_mi; /* active_mi for multi-master */
|
||||
extern volatile int active_mi_in_use;
|
||||
|
@ -141,7 +141,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
||||
if (!acl_cache)
|
||||
acl_cache=new hash_filo(ACL_CACHE_SIZE,0,0,
|
||||
(hash_get_key) acl_entry_get_key,
|
||||
(void (*)(void*)) free);
|
||||
(hash_free_key) free);
|
||||
if (dont_read_acl_tables)
|
||||
DBUG_RETURN(0); /* purecov: tested */
|
||||
|
||||
|
@ -39,8 +39,8 @@ static key_map get_key_map_from_key_list(TABLE *table,
|
||||
List<String> *index_list);
|
||||
|
||||
|
||||
static byte *cache_key(const byte *record,uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" static byte *cache_key(const byte *record,uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
TABLE *entry=(TABLE*) record;
|
||||
*length=entry->key_length;
|
||||
@ -50,7 +50,7 @@ static byte *cache_key(const byte *record,uint *length,
|
||||
void table_cache_init(void)
|
||||
{
|
||||
VOID(hash_init(&open_cache,table_cache_size+16,0,0,cache_key,
|
||||
(void (*)(void*)) free_cache_entry,0));
|
||||
(hash_free_key) free_cache_entry,0));
|
||||
mysql_rm_tmp_tables();
|
||||
}
|
||||
|
||||
|
126
sql/sql_cache.cc
126
sql/sql_cache.cc
@ -458,33 +458,6 @@ byte *query_cache_table_get_key(const byte *record, uint *length,
|
||||
Query_cache_query methods
|
||||
*****************************************************************************/
|
||||
|
||||
void Query_cache_query::init_n_lock()
|
||||
{
|
||||
DBUG_ENTER("Query_cache_query::init_n_lock");
|
||||
res=0; wri = 0; len = 0;
|
||||
my_rwlock_init(&lock, NULL);
|
||||
lock_writing();
|
||||
DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx",
|
||||
((byte*) this)-ALIGN_SIZE(sizeof(Query_cache_block))));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void Query_cache_query::unlock_n_destroy()
|
||||
{
|
||||
DBUG_ENTER("Query_cache_query::unlock_n_destroy");
|
||||
DBUG_PRINT("qcache", ("destroyed & unlocked query for block 0x%lx",
|
||||
((byte*)this)-ALIGN_SIZE(sizeof(Query_cache_block))));
|
||||
/*
|
||||
The following call is not needed on system where one can destroy an
|
||||
active semaphore
|
||||
*/
|
||||
this->unlock_writing();
|
||||
rwlock_destroy(&lock);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Following methods work for block read/write locking only in this
|
||||
particular case and in interaction with structure_guard_mutex.
|
||||
@ -536,6 +509,34 @@ inline void Query_cache_query::unlock_reading()
|
||||
RW_UNLOCK(&lock);
|
||||
}
|
||||
|
||||
|
||||
void Query_cache_query::init_n_lock()
|
||||
{
|
||||
DBUG_ENTER("Query_cache_query::init_n_lock");
|
||||
res=0; wri = 0; len = 0;
|
||||
my_rwlock_init(&lock, NULL);
|
||||
lock_writing();
|
||||
DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx",
|
||||
((byte*) this)-ALIGN_SIZE(sizeof(Query_cache_block))));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void Query_cache_query::unlock_n_destroy()
|
||||
{
|
||||
DBUG_ENTER("Query_cache_query::unlock_n_destroy");
|
||||
DBUG_PRINT("qcache", ("destroyed & unlocked query for block 0x%lx",
|
||||
((byte*)this)-ALIGN_SIZE(sizeof(Query_cache_block))));
|
||||
/*
|
||||
The following call is not needed on system where one can destroy an
|
||||
active semaphore
|
||||
*/
|
||||
this->unlock_writing();
|
||||
rwlock_destroy(&lock);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
byte *query_cache_query_get_key(const byte *record, uint *length,
|
||||
@ -699,19 +700,19 @@ void query_cache_invalidate_by_MyISAM_filename(const char *filename)
|
||||
Query_cache methods
|
||||
*****************************************************************************/
|
||||
|
||||
Query_cache::Query_cache(ulong query_cache_limit,
|
||||
ulong min_allocation_unit,
|
||||
ulong min_result_data_size,
|
||||
uint def_query_hash_size ,
|
||||
uint def_table_hash_size)
|
||||
Query_cache::Query_cache(ulong query_cache_limit_arg,
|
||||
ulong min_allocation_unit_arg,
|
||||
ulong min_result_data_size_arg,
|
||||
uint def_query_hash_size_arg,
|
||||
uint def_table_hash_size_arg)
|
||||
:query_cache_size(0),
|
||||
query_cache_limit(query_cache_limit),
|
||||
query_cache_limit(query_cache_limit_arg),
|
||||
queries_in_cache(0), hits(0), inserts(0), refused(0),
|
||||
total_blocks(0),
|
||||
min_allocation_unit(ALIGN_SIZE(min_allocation_unit)),
|
||||
min_result_data_size(ALIGN_SIZE(min_result_data_size)),
|
||||
def_query_hash_size(ALIGN_SIZE(def_query_hash_size)),
|
||||
def_table_hash_size(ALIGN_SIZE(def_table_hash_size)),
|
||||
min_allocation_unit(ALIGN_SIZE(min_allocation_unit_arg)),
|
||||
min_result_data_size(ALIGN_SIZE(min_result_data_size_arg)),
|
||||
def_query_hash_size(ALIGN_SIZE(def_query_hash_size_arg)),
|
||||
def_table_hash_size(ALIGN_SIZE(def_table_hash_size_arg)),
|
||||
initialized(0)
|
||||
{
|
||||
ulong min_needed= (ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||
@ -736,13 +737,13 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
|
||||
|
||||
void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
||||
{
|
||||
TABLE_COUNTER_TYPE tables;
|
||||
TABLE_COUNTER_TYPE local_tables;
|
||||
ulong tot_length;
|
||||
DBUG_ENTER("Query_cache::store_query");
|
||||
if (query_cache_size == 0)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
if ((tables = is_cacheable(thd, thd->query_length,
|
||||
if ((local_tables = is_cacheable(thd, thd->query_length,
|
||||
thd->query, &thd->lex, tables_used)))
|
||||
{
|
||||
NET *net = &thd->net;
|
||||
@ -788,7 +789,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
||||
Query_cache_block *query_block;
|
||||
query_block= write_block_data(tot_length, (gptr) thd->query,
|
||||
ALIGN_SIZE(sizeof(Query_cache_query)),
|
||||
Query_cache_block::QUERY, tables, 1);
|
||||
Query_cache_block::QUERY, local_tables, 1);
|
||||
if (query_block != 0)
|
||||
{
|
||||
DBUG_PRINT("qcache", ("query block 0x%lx allocated, %lu",
|
||||
@ -805,7 +806,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
||||
STRUCT_UNLOCK(&structure_guard_mutex);
|
||||
goto end;
|
||||
}
|
||||
if (!register_all_tables(query_block, tables_used, tables))
|
||||
if (!register_all_tables(query_block, tables_used, local_tables))
|
||||
{
|
||||
refused++;
|
||||
DBUG_PRINT("warning", ("tables list including failed"));
|
||||
@ -1780,7 +1781,7 @@ inline ulong Query_cache::get_min_append_result_data_size()
|
||||
my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
|
||||
ulong data_len,
|
||||
Query_cache_block *query_block,
|
||||
my_bool first_block)
|
||||
my_bool first_block_arg)
|
||||
{
|
||||
ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_result)));
|
||||
@ -1790,7 +1791,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
|
||||
DBUG_PRINT("qcache", ("data_len %lu, all_headers_len %lu",
|
||||
data_len, all_headers_len));
|
||||
|
||||
ulong min_size = (first_block ?
|
||||
ulong min_size = (first_block_arg ?
|
||||
get_min_first_result_data_size():
|
||||
get_min_append_result_data_size());
|
||||
*result_block = allocate_block(max(min_size, align_len),
|
||||
@ -1817,7 +1818,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
|
||||
Query_cache_block *next_block;
|
||||
if ((success = allocate_data_chain(&next_block,
|
||||
len - new_block->length,
|
||||
query_block, first_block)))
|
||||
query_block, first_block_arg)))
|
||||
double_linked_list_join(new_block, next_block);
|
||||
}
|
||||
if (success)
|
||||
@ -1886,14 +1887,23 @@ void Query_cache::invalidate_table(Query_cache_block *table_block)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Store all used tables
|
||||
|
||||
SYNOPSIS
|
||||
register_all_tables()
|
||||
block Store tables in this block
|
||||
tables_used List if used tables
|
||||
tables_arg Not used ?
|
||||
*/
|
||||
|
||||
my_bool Query_cache::register_all_tables(Query_cache_block *block,
|
||||
TABLE_LIST *tables_used,
|
||||
TABLE_COUNTER_TYPE tables)
|
||||
TABLE_COUNTER_TYPE tables_arg)
|
||||
{
|
||||
TABLE_COUNTER_TYPE n;
|
||||
DBUG_PRINT("qcache", ("register tables block 0x%lx, n %d, header %x",
|
||||
(ulong) block, (int) tables,
|
||||
(ulong) block, (int) tables_arg,
|
||||
(int) ALIGN_SIZE(sizeof(Query_cache_block))));
|
||||
|
||||
Query_cache_block_table *block_table = block->table(0);
|
||||
@ -2185,28 +2195,28 @@ void Query_cache::split_block(Query_cache_block *block, ulong len)
|
||||
|
||||
|
||||
Query_cache_block *
|
||||
Query_cache::join_free_blocks(Query_cache_block *first_block,
|
||||
Query_cache::join_free_blocks(Query_cache_block *first_block_arg,
|
||||
Query_cache_block *block_in_list)
|
||||
{
|
||||
Query_cache_block *second_block;
|
||||
DBUG_ENTER("Query_cache::join_free_blocks");
|
||||
DBUG_PRINT("qcache",
|
||||
("join first 0x%lx, pnext 0x%lx, in list 0x%lx",
|
||||
(ulong) first_block, (ulong) first_block->pnext,
|
||||
(ulong) first_block_arg, (ulong) first_block_arg->pnext,
|
||||
(ulong) block_in_list));
|
||||
|
||||
exclude_from_free_memory_list(block_in_list);
|
||||
second_block = first_block->pnext;
|
||||
second_block = first_block_arg->pnext;
|
||||
// May be was not free block
|
||||
second_block->used=0;
|
||||
second_block->destroy();
|
||||
total_blocks--;
|
||||
|
||||
first_block->length += second_block->length;
|
||||
first_block->pnext = second_block->pnext;
|
||||
second_block->pnext->pprev = first_block;
|
||||
first_block_arg->length += second_block->length;
|
||||
first_block_arg->pnext = second_block->pnext;
|
||||
second_block->pnext->pprev = first_block_arg;
|
||||
|
||||
DBUG_RETURN(first_block);
|
||||
DBUG_RETURN(first_block_arg);
|
||||
}
|
||||
|
||||
|
||||
@ -2423,7 +2433,7 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
|
||||
char *query,
|
||||
LEX *lex, TABLE_LIST *tables_used)
|
||||
{
|
||||
TABLE_COUNTER_TYPE tables = 0;
|
||||
TABLE_COUNTER_TYPE table_count = 0;
|
||||
DBUG_ENTER("Query_cache::is_cacheable");
|
||||
|
||||
if (lex->sql_command == SQLCOM_SELECT &&
|
||||
@ -2440,7 +2450,7 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
|
||||
|
||||
for (; tables_used; tables_used= tables_used->next)
|
||||
{
|
||||
tables++;
|
||||
table_count++;
|
||||
DBUG_PRINT("qcache", ("table %s, db %s, type %u",
|
||||
tables_used->real_name,
|
||||
tables_used->db, tables_used->table->db_type));
|
||||
@ -2464,7 +2474,7 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
|
||||
{
|
||||
ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
|
||||
MYRG_INFO *file = handler->myrg_info();
|
||||
tables+= (file->end_table - file->open_tables);
|
||||
table_count+= (file->end_table - file->open_tables);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2474,8 +2484,8 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
|
||||
DBUG_PRINT("qcache", ("not in autocommin mode"));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
DBUG_PRINT("qcache", ("select is using %d tables", tables));
|
||||
DBUG_RETURN(tables);
|
||||
DBUG_PRINT("qcache", ("select is using %d tables", table_count));
|
||||
DBUG_RETURN(table_count);
|
||||
}
|
||||
|
||||
DBUG_PRINT("qcache",
|
||||
|
@ -178,7 +178,7 @@ extern "C"
|
||||
my_bool not_used);
|
||||
}
|
||||
void query_cache_insert(NET *thd, const char *packet, ulong length);
|
||||
void query_cache_invalidate_by_MyISAM_filename(const char* filename);
|
||||
extern "C" void query_cache_invalidate_by_MyISAM_filename(const char* filename);
|
||||
|
||||
|
||||
struct Query_cache_memory_bin
|
||||
|
@ -59,14 +59,14 @@ template class List_iterator<Alter_column>;
|
||||
** User variables
|
||||
****************************************************************************/
|
||||
|
||||
static byte* get_var_key(user_var_entry *entry, uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" static byte *get_var_key(user_var_entry *entry, uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*length=(uint) entry->name.length;
|
||||
return (byte*) entry->name.str;
|
||||
}
|
||||
|
||||
static void free_var(user_var_entry *entry)
|
||||
extern "C" static void free_var(user_var_entry *entry)
|
||||
{
|
||||
char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry));
|
||||
if (entry->value && entry->value != pos)
|
||||
@ -148,7 +148,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
|
||||
user_connect=(USER_CONN *)0;
|
||||
hash_init(&user_vars, USER_VARS_HASH_SIZE, 0, 0,
|
||||
(hash_get_key) get_var_key,
|
||||
(void (*)(void*)) free_var,0);
|
||||
(hash_free_key) free_var,0);
|
||||
#ifdef USING_TRANSACTIONS
|
||||
bzero((char*) &transaction,sizeof(transaction));
|
||||
if (opt_using_transactions)
|
||||
@ -320,20 +320,21 @@ void THD::add_changed_table(TABLE *table)
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
void THD::add_changed_table(const char *key, long key_length)
|
||||
{
|
||||
DBUG_ENTER("THD::add_changed_table(key)");
|
||||
CHANGED_TABLE_LIST** prev = &transaction.changed_tables;
|
||||
CHANGED_TABLE_LIST* curr = transaction.changed_tables;
|
||||
CHANGED_TABLE_LIST **prev_changed = &transaction.changed_tables;
|
||||
CHANGED_TABLE_LIST *curr = transaction.changed_tables;
|
||||
|
||||
for (; curr; prev = &(curr->next), curr = curr->next)
|
||||
for (; curr; prev_changed = &(curr->next), curr = curr->next)
|
||||
{
|
||||
int cmp = (long)curr->key_length - (long)key_length;
|
||||
if (cmp < 0)
|
||||
{
|
||||
list_include(prev, curr, changed_table_dup(key, key_length));
|
||||
list_include(prev_changed, curr, changed_table_dup(key, key_length));
|
||||
DBUG_PRINT("info",
|
||||
("key_length %u %u", key_length, (*prev)->key_length));
|
||||
("key_length %u %u", key_length, (*prev_changed)->key_length));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
else if (cmp == 0)
|
||||
@ -341,10 +342,10 @@ void THD::add_changed_table(const char *key, long key_length)
|
||||
cmp = memcmp(curr->key, key, curr->key_length);
|
||||
if (cmp < 0)
|
||||
{
|
||||
list_include(prev, curr, changed_table_dup(key, key_length));
|
||||
list_include(prev_changed, curr, changed_table_dup(key, key_length));
|
||||
DBUG_PRINT("info",
|
||||
("key_length %u %u", key_length,
|
||||
(*prev)->key_length));
|
||||
(*prev_changed)->key_length));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
else if (cmp == 0)
|
||||
@ -354,9 +355,9 @@ void THD::add_changed_table(const char *key, long key_length)
|
||||
}
|
||||
}
|
||||
}
|
||||
*prev = changed_table_dup(key, key_length);
|
||||
*prev_changed = changed_table_dup(key, key_length);
|
||||
DBUG_PRINT("info", ("key_length %u %u", key_length,
|
||||
(*prev)->key_length));
|
||||
(*prev_changed)->key_length));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ cleanup:
|
||||
|
||||
#define MEM_STRIP_BUF_SIZE current_thd->variables.sortbuff_size
|
||||
|
||||
int refposcmp2(void* arg, const void *a,const void *b)
|
||||
extern "C" static int refposcmp2(void* arg, const void *a,const void *b)
|
||||
{
|
||||
return memcmp(a,b, *(int*) arg);
|
||||
}
|
||||
@ -392,7 +392,7 @@ void multi_delete::send_error(uint errcode,const char *err)
|
||||
|
||||
int multi_delete::do_deletes(bool from_send_error)
|
||||
{
|
||||
int error = 0, counter = 0;
|
||||
int local_error= 0, counter= 0;
|
||||
|
||||
if (from_send_error)
|
||||
{
|
||||
@ -413,27 +413,27 @@ int multi_delete::do_deletes(bool from_send_error)
|
||||
TABLE *table = table_being_deleted->table;
|
||||
if (tempfiles[counter]->get(table))
|
||||
{
|
||||
error=1;
|
||||
local_error=1;
|
||||
break;
|
||||
}
|
||||
|
||||
READ_RECORD info;
|
||||
init_read_record(&info,thd,table,NULL,0,0);
|
||||
while (!(error=info.read_record(&info)) &&
|
||||
while (!(local_error=info.read_record(&info)) &&
|
||||
(!thd->killed || from_send_error || not_trans_safe))
|
||||
{
|
||||
if ((error=table->file->delete_row(table->record[0])))
|
||||
if ((local_error=table->file->delete_row(table->record[0])))
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
table->file->print_error(local_error,MYF(0));
|
||||
break;
|
||||
}
|
||||
deleted++;
|
||||
}
|
||||
end_read_record(&info);
|
||||
if (error == -1) // End of file
|
||||
error = 0;
|
||||
if (local_error == -1) // End of file
|
||||
local_error = 0;
|
||||
}
|
||||
return error;
|
||||
return local_error;
|
||||
}
|
||||
|
||||
|
||||
@ -449,11 +449,11 @@ bool multi_delete::send_eof()
|
||||
thd->proc_info="deleting from reference tables";
|
||||
|
||||
/* Does deletes for the last n - 1 tables, returns 0 if ok */
|
||||
int error = do_deletes(0); // returns 0 if success
|
||||
int local_error= do_deletes(0); // returns 0 if success
|
||||
|
||||
/* reset used flags */
|
||||
thd->proc_info="end";
|
||||
if (error)
|
||||
if (local_error)
|
||||
{
|
||||
::send_error(&thd->net);
|
||||
return 1;
|
||||
@ -473,10 +473,10 @@ bool multi_delete::send_eof()
|
||||
Query_log_event qinfo(thd, thd->query, thd->query_length);
|
||||
if (mysql_bin_log.write(&qinfo) &&
|
||||
!not_trans_safe)
|
||||
error=1; // Log write failed: roll back the SQL statement
|
||||
local_error=1; // Log write failed: roll back the SQL statement
|
||||
}
|
||||
/* Commit or rollback the current SQL statement */
|
||||
VOID(ha_autocommit_or_rollback(thd,error > 0));
|
||||
VOID(ha_autocommit_or_rollback(thd,local_error > 0));
|
||||
}
|
||||
if (deleted)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list);
|
||||
static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup,
|
||||
char *query, uint query_length, bool log_on);
|
||||
static void end_delayed_insert(THD *thd);
|
||||
static pthread_handler_decl(handle_delayed_insert,arg);
|
||||
extern "C" static pthread_handler_decl(handle_delayed_insert,arg);
|
||||
static void unlink_blobs(register TABLE *table);
|
||||
|
||||
/* Define to force use of my_malloc() if the allocated memory block is big */
|
||||
@ -913,7 +913,7 @@ void kill_delayed_threads(void)
|
||||
* Create a new delayed insert thread
|
||||
*/
|
||||
|
||||
static pthread_handler_decl(handle_delayed_insert,arg)
|
||||
extern "C" static pthread_handler_decl(handle_delayed_insert,arg)
|
||||
{
|
||||
delayed_insert *di=(delayed_insert*) arg;
|
||||
THD *thd= &di->thd;
|
||||
|
@ -32,7 +32,7 @@ pthread_t manager_thread;
|
||||
pthread_mutex_t LOCK_manager;
|
||||
pthread_cond_t COND_manager;
|
||||
|
||||
pthread_handler_decl(handle_manager,arg __attribute__((unused)))
|
||||
extern "C" pthread_handler_decl(handle_manager,arg __attribute__((unused)))
|
||||
{
|
||||
int error = 0;
|
||||
ulong status;
|
||||
|
@ -259,14 +259,14 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
|
||||
started with corresponding variable that is greater then 0.
|
||||
*/
|
||||
|
||||
static byte* get_key_conn(user_conn *buff, uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
extern "C" static byte *get_key_conn(user_conn *buff, uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
*length=buff->len;
|
||||
return (byte*) buff->user;
|
||||
}
|
||||
|
||||
static void free_user(struct user_conn *uc)
|
||||
extern "C" static void free_user(struct user_conn *uc)
|
||||
{
|
||||
my_free((char*) uc,MYF(0));
|
||||
}
|
||||
@ -274,7 +274,7 @@ static void free_user(struct user_conn *uc)
|
||||
void init_max_user_conn(void)
|
||||
{
|
||||
(void) hash_init(&hash_user_connections,max_connections,0,0,
|
||||
(hash_get_key) get_key_conn, (void (*)(void*)) free_user,
|
||||
(hash_get_key) get_key_conn, (hash_free_key) free_user,
|
||||
0);
|
||||
}
|
||||
|
||||
@ -713,7 +713,7 @@ end_thread:
|
||||
Used when creating the initial grant tables
|
||||
*/
|
||||
|
||||
pthread_handler_decl(handle_bootstrap,arg)
|
||||
extern "C" pthread_handler_decl(handle_bootstrap,arg)
|
||||
{
|
||||
THD *thd=(THD*) arg;
|
||||
FILE *file=bootstrap_file;
|
||||
|
@ -98,7 +98,7 @@ static void init_syms(udf_func *tmp)
|
||||
}
|
||||
}
|
||||
|
||||
static byte* get_hash_key(const byte *buff,uint *length,
|
||||
extern "C" static byte* get_hash_key(const byte *buff,uint *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
udf_func *udf=(udf_func*) buff;
|
||||
|
@ -688,7 +688,7 @@ void multi_update::send_error(uint errcode,const char *err)
|
||||
|
||||
int multi_update::do_updates (bool from_send_error)
|
||||
{
|
||||
int error = 0, counter = 0;
|
||||
int local_error= 0, counter= 0;
|
||||
|
||||
if (from_send_error)
|
||||
{
|
||||
@ -713,7 +713,7 @@ int multi_update::do_updates (bool from_send_error)
|
||||
TABLE *tmp_table=tmp_tables[counter];
|
||||
if (tmp_table->file->extra(HA_EXTRA_NO_CACHE))
|
||||
{
|
||||
error=1;
|
||||
local_error=1;
|
||||
break;
|
||||
}
|
||||
List<Item> list;
|
||||
@ -729,35 +729,36 @@ int multi_update::do_updates (bool from_send_error)
|
||||
tmp_table->used_keys&=field->part_of_key;
|
||||
}
|
||||
tmp_table->used_fields=tmp_table->fields;
|
||||
error=0; list.pop(); // we get position some other way ...
|
||||
error = tmp_table->file->rnd_init(1);
|
||||
if (error)
|
||||
return error;
|
||||
while (!(error=tmp_table->file->rnd_next(tmp_table->record[0])) &&
|
||||
local_error=0;
|
||||
list.pop(); // we get position some other way ...
|
||||
local_error = tmp_table->file->rnd_init(1);
|
||||
if (local_error)
|
||||
return local_error;
|
||||
while (!(local_error=tmp_table->file->rnd_next(tmp_table->record[0])) &&
|
||||
(!thd->killed || from_send_error || not_trans_safe))
|
||||
{
|
||||
found++;
|
||||
error= table->file->rnd_pos(table->record[0],
|
||||
(byte*) (*(tmp_table->field))->ptr);
|
||||
if (error)
|
||||
return error;
|
||||
local_error= table->file->rnd_pos(table->record[0],
|
||||
(byte*) (*(tmp_table->field))->ptr);
|
||||
if (local_error)
|
||||
return local_error;
|
||||
table->status|= STATUS_UPDATED;
|
||||
store_record(table,1);
|
||||
error= fill_record(*fields_by_tables[counter + 1],list) ||
|
||||
/* compare_record(table, query_id) || */
|
||||
table->file->update_row(table->record[1],table->record[0]);
|
||||
if (error)
|
||||
local_error= (fill_record(*fields_by_tables[counter + 1],list) ||
|
||||
/* compare_record(table, query_id) || */
|
||||
table->file->update_row(table->record[1],table->record[0]));
|
||||
if (local_error)
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
table->file->print_error(local_error,MYF(0));
|
||||
break;
|
||||
}
|
||||
else
|
||||
updated++;
|
||||
}
|
||||
if (error == HA_ERR_END_OF_FILE)
|
||||
error = 0;
|
||||
if (local_error == HA_ERR_END_OF_FILE)
|
||||
local_error = 0;
|
||||
}
|
||||
return error;
|
||||
return local_error;
|
||||
}
|
||||
|
||||
|
||||
@ -768,17 +769,17 @@ bool multi_update::send_eof()
|
||||
thd->proc_info="updating the reference tables";
|
||||
|
||||
/* Does updates for the last n - 1 tables, returns 0 if ok */
|
||||
int error = (num_updated) ? do_updates(false) : 0; /* do_updates returns 0 if success */
|
||||
int local_error = (num_updated) ? do_updates(false) : 0;
|
||||
|
||||
/* reset used flags */
|
||||
#ifndef NOT_USED
|
||||
update_tables->table->no_keyread=0;
|
||||
#endif
|
||||
if (error == -1)
|
||||
error = 0;
|
||||
thd->proc_info="end";
|
||||
if (error)
|
||||
send_error(error,"An error occured in multi-table update");
|
||||
if (local_error == -1)
|
||||
local_error= 0;
|
||||
thd->proc_info= "end";
|
||||
if (local_error)
|
||||
send_error(local_error, "An error occured in multi-table update");
|
||||
|
||||
/*
|
||||
Write the SQL statement to the binlog if we updated
|
||||
@ -799,14 +800,14 @@ bool multi_update::send_eof()
|
||||
|
||||
if (mysql_bin_log.is_open() && mysql_bin_log.write(&qinfo) &&
|
||||
!not_trans_safe)
|
||||
error=1; /* Log write failed: roll back the SQL statement */
|
||||
local_error=1; /* Log write failed: roll back the SQL statement */
|
||||
|
||||
/* Commit or rollback the current SQL statement */
|
||||
VOID(ha_autocommit_or_rollback(thd,error > 0));
|
||||
VOID(ha_autocommit_or_rollback(thd, local_error > 0));
|
||||
}
|
||||
else
|
||||
error=0; // this can happen only if it is end of file error
|
||||
if (!error) // if the above log write did not fail ...
|
||||
local_error= 0; // this can happen only if it is end of file error
|
||||
if (!local_error) // if the above log write did not fail ...
|
||||
{
|
||||
char buff[80];
|
||||
sprintf(buff,ER(ER_UPDATE_INFO), (long) found, (long) updated,
|
||||
|
@ -24,11 +24,11 @@ if ASSEMBLER_x86
|
||||
ASRCS = strings-x86.s longlong2str-x86.s
|
||||
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c ctype.c strnlen.c
|
||||
else
|
||||
if ASSEMBLER_sparc
|
||||
if ASSEMBLER_sparc32
|
||||
# These file MUST all be on the same line!! Otherwise automake
|
||||
# generats a very broken makefile
|
||||
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s strxmov-sparc.s
|
||||
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c ctype.c strnlen.c
|
||||
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
|
||||
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c ctype.c strnlen.c strxmov.c
|
||||
else
|
||||
#no assembler
|
||||
ASRCS =
|
||||
@ -75,8 +75,11 @@ clean-local:
|
||||
if ASSEMBLER
|
||||
# On Linux gcc can compile the assembly files
|
||||
%.o : %.s
|
||||
$(AS) -o $@ $<
|
||||
$(AS) $(ASFLAGS) -o $@ $<
|
||||
endif
|
||||
|
||||
str_test: str_test.c $(LIBRARIES)
|
||||
$(LINK) $(FLAGS) -DMAIN $(srcdir)/str_test.c $(LDADD) $(LIBS)
|
||||
|
||||
# Don't update the files from bitkeeper
|
||||
%::SCCS/s.%
|
||||
|
@ -27,11 +27,11 @@ bmove_upp:
|
||||
nop
|
||||
.loop:
|
||||
sub %o1, 1, %o1
|
||||
ldub [%o1], %g2
|
||||
ldub [%o1], %o3
|
||||
sub %o0, 1, %o0
|
||||
subcc %o2, 1, %o2
|
||||
bcc .loop
|
||||
stb %g2, [%o0]
|
||||
stb %o3, [%o0]
|
||||
.end:
|
||||
retl
|
||||
nop
|
||||
|
@ -130,9 +130,6 @@ int main(void)
|
||||
if (errors)
|
||||
fputs("--- Some functions doesn't work!! Fix them\n",stderr);
|
||||
return(errors > 0);
|
||||
|
||||
fputs("Fatal error\n",stderr);
|
||||
return(2);
|
||||
} /* main */
|
||||
|
||||
|
||||
|
@ -22,28 +22,28 @@
|
||||
.type strappend,#function
|
||||
.proc 020
|
||||
strappend:
|
||||
add %o0, %o1, %g3 ! g3 = endpos
|
||||
ldsb [%o0], %g2
|
||||
add %o0, %o1, %o3 ! o3 = endpos
|
||||
ldsb [%o0], %o4
|
||||
.loop1:
|
||||
add %o0, 1, %o0 ! find end of str
|
||||
cmp %g2, 0
|
||||
cmp %o4, 0
|
||||
bne,a .loop1
|
||||
ldsb [%o0], %g2
|
||||
ldsb [%o0], %o4
|
||||
|
||||
sub %o0, 1, %o0
|
||||
cmp %o0, %g3
|
||||
cmp %o0, %o3
|
||||
bgeu .end
|
||||
nop
|
||||
|
||||
stb %o2, [%o0]
|
||||
.loop2:
|
||||
add %o0, 1, %o0
|
||||
cmp %o0, %g3
|
||||
cmp %o0, %o3
|
||||
blu,a .loop2
|
||||
stb %o2, [%o0]
|
||||
.end:
|
||||
retl
|
||||
stb %g0, [%g3]
|
||||
stb %g0, [%o3]
|
||||
.strappend_end:
|
||||
.size strappend,.strappend_end-strappend
|
||||
.ident "Matt Wagner & Monty"
|
||||
|
@ -22,12 +22,12 @@
|
||||
.type strend,#function
|
||||
.proc 0102
|
||||
strend:
|
||||
ldsb [%o0], %g2 ! Handle first char differently to make
|
||||
ldsb [%o0], %o3 ! Handle first char differently to make
|
||||
.loop: ! a faster loop
|
||||
add %o0, 1, %o0
|
||||
cmp %g2, 0
|
||||
cmp %o3, 0
|
||||
bne,a .loop
|
||||
ldsb [%o0], %g2
|
||||
ldsb [%o0], %o3
|
||||
retl
|
||||
sub %o0,1,%o0
|
||||
.strend_end:
|
||||
|
@ -25,16 +25,16 @@ strmake:
|
||||
orcc %g0,%o2,%g0
|
||||
be,a .end
|
||||
nop
|
||||
ldsb [%o1],%g2
|
||||
ldsb [%o1],%o3
|
||||
.loop:
|
||||
stb %g2,[%o0]
|
||||
cmp %g2,0
|
||||
stb %o3,[%o0]
|
||||
cmp %o3,0
|
||||
be .end ! Jump to end on end of string
|
||||
add %o1,1,%o1
|
||||
add %o0,1,%o0
|
||||
subcc %o2,1,%o2
|
||||
bne,a .loop
|
||||
ldsb [%o1],%g2
|
||||
ldsb [%o1],%o3
|
||||
.end:
|
||||
retl
|
||||
stb %g0,[%o0]
|
||||
|
@ -23,10 +23,10 @@
|
||||
.proc 0102
|
||||
strmov:
|
||||
.loop:
|
||||
ldub [%o1], %g2
|
||||
stb %g2, [%o0]
|
||||
ldub [%o1], %o3
|
||||
stb %o3, [%o0]
|
||||
add %o1, 1, %o1
|
||||
cmp %g2, 0
|
||||
cmp %o3, 0
|
||||
bne,a .loop
|
||||
add %o0, 1, %o0
|
||||
retl
|
||||
|
@ -25,16 +25,16 @@ strnmov:
|
||||
orcc %g0,%o2,%g0
|
||||
be,a .end
|
||||
nop
|
||||
ldsb [%o1],%g2
|
||||
ldsb [%o1],%o3
|
||||
.loop:
|
||||
stb %g2,[%o0]
|
||||
cmp %g2,0
|
||||
stb %o3,[%o0]
|
||||
cmp %o3,0
|
||||
be .end ! Jump to end on end of string
|
||||
add %o1,1,%o1
|
||||
add %o0,1,%o0
|
||||
subcc %o2,1,%o2
|
||||
bne,a .loop
|
||||
ldsb [%o1],%g2
|
||||
ldsb [%o1],%o3
|
||||
.end:
|
||||
retl
|
||||
nop
|
||||
|
@ -33,10 +33,10 @@ strstr:
|
||||
|
||||
ldsb [%o1],%o2 ! o2= First char of search
|
||||
.top:
|
||||
ldsb [%o0],%g3 ! g3= First char of rest of str
|
||||
cmp %g3,0
|
||||
ldsb [%o0],%o4 ! o4= First char of rest of str
|
||||
cmp %o4,0
|
||||
be .abort ! Found end null ;
|
||||
cmp %g3,%o2
|
||||
cmp %o4,%o2
|
||||
bne .top
|
||||
add %o0,1,%o0
|
||||
|
||||
@ -45,20 +45,20 @@ strstr:
|
||||
! while (*j)
|
||||
! if (*i++ != *j++) goto skipp;
|
||||
|
||||
or %g0,%o0,%g2
|
||||
add %o1,1,%g3 ! g3= search+1
|
||||
or %g0,%o0,%o3
|
||||
add %o1,1,%o4 ! o4= search+1
|
||||
ldsb [%o0],%o5 ! o5= [current_str+1]
|
||||
|
||||
.loop2:
|
||||
ldsb [%g3],%g4
|
||||
add %g3,1,%g3
|
||||
ldsb [%o4],%g4
|
||||
add %o4,1,%o4
|
||||
cmp %g4,0
|
||||
be .end
|
||||
cmp %o5,%g4
|
||||
bne .top
|
||||
add %g2,1,%g2
|
||||
add %o3,1,%o3
|
||||
ba .loop2
|
||||
ldsb [%g2],%o5
|
||||
ldsb [%o3],%o5
|
||||
|
||||
.end:
|
||||
retl
|
||||
|
@ -15,12 +15,17 @@
|
||||
! Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
! MA 02111-1307, USA
|
||||
|
||||
!
|
||||
! Note that this function only works on 32 bit sparc systems
|
||||
! on 64 bits the offsets to %sp are different !
|
||||
|
||||
.file "strxmov-sparc.s"
|
||||
.section ".text"
|
||||
.align 4
|
||||
.global strxmov
|
||||
.type strxmov,#function
|
||||
.proc 0102
|
||||
|
||||
strxmov:
|
||||
st %o2, [%sp+76] ! store 3rd param before other params
|
||||
st %o3, [%sp+80] ! store 4th param " "
|
||||
@ -28,18 +33,18 @@ strxmov:
|
||||
st %o4, [%sp+84] ! store 5th param
|
||||
be .end
|
||||
st %o5, [%sp+88] ! store last
|
||||
add %sp, 76, %g2 ! put pointer to 3rd arg
|
||||
add %sp, 76, %o4 ! put pointer to 3rd arg
|
||||
.loop:
|
||||
ldub [%o1], %g1 ! set values of src (o1)
|
||||
ldub [%o1], %o5 ! set values of src (o1)
|
||||
add %o1, 1, %o1 ! inc src
|
||||
stb %g1, [%o0] ! and dst (o2) equal
|
||||
cmp %g1, 0 ! second while cmp
|
||||
stb %o5, [%o0] ! and dst (o2) equal
|
||||
cmp %o5, 0 ! second while cmp
|
||||
bne,a .loop
|
||||
add %o0, 1, %o0 ! inc dst
|
||||
ld [%g2], %o1 ! get next param
|
||||
ld [%o4], %o1 ! get next param
|
||||
cmp %o1, 0 ! check if last param
|
||||
bne .loop
|
||||
add %g2, 4, %g2 ! advance to next param
|
||||
add %o4, 4, %o4 ! advance to next param
|
||||
.end:
|
||||
retl
|
||||
stb %g0, [%o0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user