1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-06 05:21:19 +03:00

FLUSH TABLE table_list

Fixes for RENAME TABLE
Portability fixes
This commit is contained in:
monty@donna.mysql.com 2000-08-22 00:18:32 +03:00
parent 48ee575ebc
commit f0952ce3e1
58 changed files with 502 additions and 400 deletions

View File

@ -16818,9 +16818,10 @@ from a database to another:
RENAME TABLE current_database.table_name TO other_database.table_name; RENAME TABLE current_database.table_name TO other_database.table_name;
@end example @end example
When you execute @code{RENAME}, you can't have any locked tables or active When you execute @code{RENAME}, you can't have any locked tables or
transactions. You must also have the @code{ALTER TABLE} privilege on both active transactions. You must also have the @code{ALTER TABLE}
the old and the new table. privilege on the original table and @code{CREATE} and @code{INSERT}
privilege on the new table.
If @strong{MySQL} encounters any errors in a multiple table rename, it If @strong{MySQL} encounters any errors in a multiple table rename, it
will do a reverse rename for all renamed tables to get everything back will do a reverse rename for all renamed tables to get everything back
@ -18222,7 +18223,9 @@ file name, @strong{MySQL} will close and reopen the update log file.
@item @code{PRIVILEGES} @tab Reloads the privileges from the grant tables in @item @code{PRIVILEGES} @tab Reloads the privileges from the grant tables in
the @code{mysql} database. the @code{mysql} database.
@item @code{TABLES} @tab Closes all open tables. @item @code{TABLES} @tab Closes all open tables and force all tables in use to be closed.
@item @code{TABLES table_name [,table_name...]} @tab Flush only the given tables
@item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}. @item @code{TABLES WITH READ LOCK} @tab Closes all open tables and locks all tables for all databases with a read until one executes @code{UNLOCK TABLES}.
@ -35400,6 +35403,8 @@ and will soon be declared beta, gamma and release.
@appendixsubsec Changes in release 3.23.23 @appendixsubsec Changes in release 3.23.23
@itemize @bullet @itemize @bullet
@item @item
Added table_list to @code{FLUSH TABLES} commmand.
@item
Added atomic @code{RENAME} command. Added atomic @code{RENAME} command.
@item @item
Don't count entries with @code{NULL} in @code{COUNT(DISTINCT ..)}. Don't count entries with @code{NULL} in @code{COUNT(DISTINCT ..)}.

View File

@ -286,8 +286,8 @@ int main(int argc,char *argv[])
histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME)); histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME));
else if (getenv("HOME")) else if (getenv("HOME"))
{ {
histfile=(char*) my_malloc(strlen(getenv("HOME")) histfile=(char*) my_malloc((uint) strlen(getenv("HOME"))
+ strlen("/.mysql_history")+2, + (uint) strlen("/.mysql_history")+2,
MYF(MY_WME)); MYF(MY_WME));
if (histfile) if (histfile)
sprintf(histfile,"%s/.mysql_history",getenv("HOME")); sprintf(histfile,"%s/.mysql_history",getenv("HOME"));
@ -743,7 +743,7 @@ static COMMANDS *find_command (char *name,char cmd_char)
end=0; // no arguments to function end=0; // no arguments to function
} }
else else
len=strlen(name); len=(uint) strlen(name);
} }
for (uint i= 0; commands[i].name; i++) for (uint i= 0; commands[i].name; i++)
@ -772,7 +772,7 @@ static bool add_line(String &buffer,char *line,char *in_string)
add_history(line); add_history(line);
#endif #endif
#ifdef USE_MB #ifdef USE_MB
char *strend=line+strlen(line); char *strend=line+(uint) strlen(line);
#endif #endif
for (pos=out=line ; (inchar= (uchar) *pos) ; pos++) for (pos=out=line ; (inchar= (uchar) *pos) ; pos++)
@ -926,14 +926,14 @@ static char *new_command_generator(char *text,int state)
static uint i; static uint i;
if (!state) { if (!state) {
textlen=strlen(text); textlen=(uint) strlen(text);
} }
if (textlen>0) { /* lookup in the hash */ if (textlen>0) { /* lookup in the hash */
if (!state) { if (!state) {
uint len; uint len;
b = find_all_matches(&ht,text,strlen(text),&len); b = find_all_matches(&ht,text,(uint) strlen(text),&len);
if (!b) { if (!b) {
return NullS; return NullS;
} }
@ -961,7 +961,7 @@ static char *new_command_generator(char *text,int state)
} }
ptr= NullS; ptr= NullS;
while (e && !ptr) { /* find valid entry in bucket */ while (e && !ptr) { /* find valid entry in bucket */
if (strlen(e->str)==b->nKeyLength) { if ((uint) strlen(e->str)==b->nKeyLength) {
ptr = strdup(e->str); ptr = strdup(e->str);
} }
/* find the next used entry */ /* find the next used entry */
@ -1054,7 +1054,7 @@ You can turn off this feature to get a quicker startup with -A\n\n");
while ((table_row=mysql_fetch_row(tables))) while ((table_row=mysql_fetch_row(tables)))
{ {
if (!completion_hash_exists(&ht,(char*) table_row[0], if (!completion_hash_exists(&ht,(char*) table_row[0],
strlen((const char*) table_row[0]))) (uint) strlen((const char*) table_row[0])))
add_word(&ht,table_row[0]); add_word(&ht,table_row[0]);
} }
} }
@ -1102,7 +1102,7 @@ You can turn off this feature to get a quicker startup with -A\n\n");
add_word(&ht,field_names[i][j]); add_word(&ht,field_names[i][j]);
field_names[i][num_fields+j] = my_strdup(sql_field->name,MYF(0)); field_names[i][num_fields+j] = my_strdup(sql_field->name,MYF(0));
if (!completion_hash_exists(&ht,field_names[i][num_fields+j], if (!completion_hash_exists(&ht,field_names[i][num_fields+j],
strlen(field_names[i][num_fields+j]))) (uint) strlen(field_names[i][num_fields+j])))
add_word(&ht,field_names[i][num_fields+j]); add_word(&ht,field_names[i][num_fields+j]);
j++; j++;
} }
@ -1351,7 +1351,7 @@ print_table_data(MYSQL_RES *result)
separator.copy("+",1); separator.copy("+",1);
while ((field = mysql_fetch_field(result))) while ((field = mysql_fetch_field(result)))
{ {
uint length=skip_column_names ? 0 : strlen(field->name); uint length=skip_column_names ? 0 : (uint) strlen(field->name);
if (quick) if (quick)
length=max(length,field->length); length=max(length,field->length);
else else
@ -1437,7 +1437,7 @@ print_table_data_vertically(MYSQL_RES *result)
while ((field = mysql_fetch_field(result))) while ((field = mysql_fetch_field(result)))
{ {
uint length=strlen(field->name); uint length=(uint) strlen(field->name);
if (length > max_length) if (length > max_length)
max_length= length; max_length= length;
field->max_length=length; field->max_length=length;

View File

@ -909,7 +909,7 @@ static void print_top(MYSQL_RES *result)
mysql_field_seek(result,0); mysql_field_seek(result,0);
while((field = mysql_fetch_field(result))) while((field = mysql_fetch_field(result)))
{ {
if ((length=strlen(field->name)) > field->max_length) if ((length=(uint) strlen(field->name)) > field->max_length)
field->max_length=length; field->max_length=length;
else else
length=field->max_length; length=field->max_length;
@ -974,7 +974,7 @@ static void print_relative_row_vert(MYSQL_RES *result __attribute__((unused)),
llstr((tmp - last_values[row]), buff)); llstr((tmp - last_values[row]), buff));
/* Find the minimum row length needed to output the relative value */ /* Find the minimum row length needed to output the relative value */
if ((length=strlen(buff) > ex_val_max_len[row]) && ex_status_printed) if ((length=(uint) strlen(buff) > ex_val_max_len[row]) && ex_status_printed)
ex_val_max_len[row] = length; ex_val_max_len[row] = length;
last_values[row] = tmp; last_values[row] = tmp;
} }

View File

@ -782,7 +782,7 @@ static char *add_load_option(char *ptr,const char *object,
if (object) if (object)
{ {
ptr= strxmov(ptr," ",statement," '",NullS); ptr= strxmov(ptr," ",statement," '",NullS);
ptr= field_escape(ptr,object,strlen(object)); ptr= field_escape(ptr,object,(uint) strlen(object));
*ptr++= '\''; *ptr++= '\'';
} }
return ptr; return ptr;
@ -910,7 +910,7 @@ static void dumpTable(uint numFields, char *table)
total_length=net_buffer_length; /* Force row break */ total_length=net_buffer_length; /* Force row break */
row_break=0; row_break=0;
rownr=0; rownr=0;
init_length=strlen(insert_pat)+4; init_length=(uint) strlen(insert_pat)+4;
while ((row=mysql_fetch_row(res))) while ((row=mysql_fetch_row(res)))
{ {
@ -1215,7 +1215,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
fputc(' ',file); fputc(' ',file);
fputs(prefix, file); fputs(prefix, file);
if (string_value) if (string_value)
unescape(file,row[0],strlen(row[0])); unescape(file,row[0],(uint) strlen(row[0]));
else else
fputs(row[0], file); fputs(row[0], file);
return; return;

View File

@ -454,7 +454,7 @@ static char *add_load_option(char *ptr,const char *object,const char *statement)
if (object) if (object)
{ {
ptr= strxmov(ptr," ",statement," '",NullS); ptr= strxmov(ptr," ",statement," '",NullS);
ptr= field_escape(ptr,object,strlen(object)); ptr= field_escape(ptr,object,(uint) strlen(object));
*ptr++= '\''; *ptr++= '\'';
} }
return ptr; return ptr;

View File

@ -290,7 +290,7 @@ list_dbs(MYSQL *mysql,const char *wild)
printf("Wildcard: %s\n",wild); printf("Wildcard: %s\n",wild);
header="Databases"; header="Databases";
length=strlen(header); length=(uint) strlen(header);
field=mysql_fetch_field(result); field=mysql_fetch_field(result);
if (length < field->max_length) if (length < field->max_length)
length=field->max_length; length=field->max_length;
@ -331,7 +331,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
putchar('\n'); putchar('\n');
header="Tables"; header="Tables";
head_length=strlen(header); head_length=(uint) strlen(header);
field=mysql_fetch_field(result); field=mysql_fetch_field(result);
if (head_length < field->max_length) if (head_length < field->max_length)
head_length=field->max_length; head_length=field->max_length;
@ -470,7 +470,7 @@ print_header(const char *header,uint head_length,...)
putchar('|'); putchar('|');
for (;;) for (;;)
{ {
str_length=strlen(field); str_length=(uint) strlen(field);
if (str_length > length) if (str_length > length)
str_length=length+1; str_length=length+1;
pre_space=(uint) (((int) length-(int) str_length)/2)+1; pre_space=(uint) (((int) length-(int) str_length)/2)+1;
@ -520,7 +520,7 @@ print_row(const char *header,uint head_length,...)
putchar('|'); putchar('|');
putchar(' '); putchar(' ');
fputs(field,stdout); fputs(field,stdout);
field_length=strlen(field); field_length=(uint) strlen(field);
for (i=field_length ; i <= length ; i++) for (i=field_length ; i <= length ; i++)
putchar(' '); putchar(' ');
if (!(field=va_arg(args,my_string))) if (!(field=va_arg(args,my_string)))
@ -580,7 +580,7 @@ static void print_res_top(MYSQL_RES *result)
mysql_field_seek(result,0); mysql_field_seek(result,0);
while((field = mysql_fetch_field(result))) while((field = mysql_fetch_field(result)))
{ {
if ((length=strlen(field->name)) > field->max_length) if ((length=(uint) strlen(field->name)) > field->max_length)
field->max_length=length; field->max_length=length;
else else
length=field->max_length; length=field->max_length;

View File

@ -105,7 +105,7 @@ static bool init_line_buffer_from_string(LINE_BUFFER *buffer,my_string str)
{ {
uint length; uint length;
bzero((char*) buffer,sizeof(buffer[0])); bzero((char*) buffer,sizeof(buffer[0]));
length=strlen(str); length=(uint) strlen(str);
if (!(buffer->buffer=buffer->start_of_line=buffer->end_of_line= if (!(buffer->buffer=buffer->start_of_line=buffer->end_of_line=
(char*)my_malloc(length+2,MYF(MY_FAE)))) (char*)my_malloc(length+2,MYF(MY_FAE))))
return 1; return 1;

View File

@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 3.23.22-beta) AM_INIT_AUTOMAKE(mysql, 3.23.23-beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10

View File

@ -222,6 +222,8 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_PERROR #define HAVE_PERROR
#define HAVE_VFPRINT #define HAVE_VFPRINT
#define HAVE_SNPRINTF
#define _snprintf snprintf
#define HAVE_CHSIZE /* System has chsize() function */ #define HAVE_CHSIZE /* System has chsize() function */
#define HAVE_RENAME /* Have rename() as function */ #define HAVE_RENAME /* Have rename() as function */
#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */ #define HAVE_BINARY_STREAMS /* Have "b" flag in streams */

View File

@ -70,7 +70,7 @@ typedef struct st_win_timer
#ifdef __WIN__ #ifdef __WIN__
typedef struct st_win_timer typedef struct st_win_timer
{ {
uint crono; rf_SetTimer crono;
} thr_alarm_t; } thr_alarm_t;
bool thr_got_alarm(thr_alarm_t *alrm); bool thr_got_alarm(thr_alarm_t *alrm);

View File

@ -619,6 +619,8 @@ void mi_update_status(void* param);
void mi_copy_status(void* to,void *from); void mi_copy_status(void* to,void *from);
my_bool mi_check_status(void* param); my_bool mi_check_status(void* param);
void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows); void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows);
int _mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
enum ha_rkey_function search_flag, bool raw_key);
/* Functions needed by mi_check */ /* Functions needed by mi_check */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -25,9 +25,6 @@
SerG SerG
*/ */
int _mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
enum ha_rkey_function search_flag, bool raw_key);
int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
uint key_len, enum ha_rkey_function search_flag) uint key_len, enum ha_rkey_function search_flag)
{ {

View File

@ -16,6 +16,8 @@
MA 02111-1307, USA */ MA 02111-1307, USA */
#include <global.h> #include <global.h>
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
#include <errno.h> #include <errno.h>
#include <my_pthread.h> #include <my_pthread.h>
#include <signal.h> #include <signal.h>
@ -24,8 +26,6 @@
#include <queues.h> #include <queues.h>
#include "thr_alarm.h" #include "thr_alarm.h"
#ifdef THREAD
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* AIX needs this for fd_set */ #include <sys/select.h> /* AIX needs this for fd_set */
#endif #endif
@ -38,7 +38,6 @@ static my_bool alarm_aborted=1;
my_bool thr_alarm_inited=0; my_bool thr_alarm_inited=0;
#if !defined(__WIN__) && !defined(__OS2__) #if !defined(__WIN__) && !defined(__OS2__)
#ifndef DONT_USE_THR_ALARM /* thr_alarm disabled */
static pthread_mutex_t LOCK_alarm; static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set; static sigset_t full_signal_set;
@ -455,10 +454,150 @@ static void *alarm_handler(void *arg __attribute__((unused)))
pthread_exit(0); pthread_exit(0);
return 0; /* Impossible */ return 0; /* Impossible */
} }
#endif #endif /* USE_ALARM_THREAD */
/*****************************************************************************
** thr_alarm for OS/2
*****************************************************************************/
#elif defined(__OS2__)
#define INCL_BASE
#define INCL_NOPMAPI
#include <os2.h>
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{
APIRET rc;
if (alarm_aborted)
{
alrm->crono=0;
alrm->event=0;
return 1;
}
if (!(rc = DosCreateEventSem(NULL,(HEV *)&alrm->event,DC_SEM_SHARED,FALSE)))
{
printf("Error creating event semaphore! [%d] \n",rc);
alrm->crono=0;
alrm->event=0;
return 1;
}
if (!(rc = DosAsyncTimer((long) sec*1000L, (HSEM) alrm->event,(HTIMER *) &alrm->crono))) {
printf("Error starting async timer! [%d] \n",rc);
DosCloseEventSem((HEV) alrm->event);
alrm->crono=0;
alrm->event=0;
return 1;
} /* endif */
return 1;
}
bool thr_got_alarm(thr_alarm_t *alrm)
{
APIRET rc;
if (alrm->crono)
{
rc = DosWaitEventSem((HEV) alrm->event, SEM_IMMEDIATE_RETURN);
if (rc == 0) {
DosCloseEventSem((HEV) alrm->event);
alrm->crono = 0;
alrm->event = 0;
} /* endif */
}
return !alrm->crono || alarm_aborted;
}
void thr_end_alarm(thr_alarm_t *alrm)
{
if (alrm->crono)
{
DosStopTimer((HTIMER) alrm->crono);
DosCloseEventSem((HEV) alrm->event);
alrm->crono = 0;
alrm->event = 0;
}
}
void end_thr_alarm(void)
{
DBUG_ENTER("end_thr_alarm");
alarm_aborted=1; /* No more alarms */
DBUG_VOID_RETURN;
}
void init_thr_alarm(uint max_alarm)
{
DBUG_ENTER("init_thr_alarm");
alarm_aborted=0; /* Yes, Gimmie alarms */
DBUG_VOID_RETURN;
}
/*****************************************************************************
** thr_alarm for win95
*****************************************************************************/
#else /* __WIN__ */
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{
if (alarm_aborted)
{
alrm->crono=0;
return 1;
}
if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL)))
return 1;
return 0;
}
bool thr_got_alarm(thr_alarm_t *alrm)
{
MSG msg;
if (alrm->crono)
{
PeekMessage(&msg,NULL,WM_TIMER,WM_TIMER,PM_REMOVE) ;
if (msg.message == WM_TIMER || alarm_aborted)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
}
}
return !alrm->crono || alarm_aborted;
}
void thr_end_alarm(thr_alarm_t *alrm)
{
if (alrm->crono)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
}
}
void end_thr_alarm(void)
{
DBUG_ENTER("end_thr_alarm");
alarm_aborted=1; /* No more alarms */
DBUG_VOID_RETURN;
}
#endif /* __WIN__ */
#endif /* THREAD */
/****************************************************************************
** Handling of MAIN
***************************************************************************/
#ifdef MAIN #ifdef MAIN
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
static pthread_cond_t COND_thread_count; static pthread_cond_t COND_thread_count;
static pthread_mutex_t LOCK_thread_count; static pthread_mutex_t LOCK_thread_count;
@ -468,7 +607,7 @@ static uint thread_count;
typedef int * fd_set_ptr; typedef int * fd_set_ptr;
#else #else
typedef fd_set * fd_set_ptr; typedef fd_set * fd_set_ptr;
#endif #endif /* HPUX */
static void *test_thread(void *arg) static void *test_thread(void *arg)
{ {
@ -567,8 +706,7 @@ static sig_handler print_signal_warning(int sig)
if (sig == SIGALRM) if (sig == SIGALRM)
alarm(2); /* reschedule alarm */ alarm(2); /* reschedule alarm */
} }
#endif #endif /* USE_ONE_SIGNAL_HAND */
static void *signal_hand(void *arg __attribute__((unused))) static void *signal_hand(void *arg __attribute__((unused)))
@ -718,157 +856,18 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Test succeeded\n"); printf("Test succeeded\n");
return 0; return 0;
} }
#endif /* MAIN */
#else /* DONT_USE_THR_ALARM */ #else /* THREAD */
#ifdef MAIN
int main(int argc __attribute__((unused)),char **argv __attribute__((unused))) int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{ {
#ifndef THREAD
printf("thr_alarm disabled because we are not using threads\n");
#else
printf("thr_alarm disabled with DONT_USE_THR_ALARM\n"); printf("thr_alarm disabled with DONT_USE_THR_ALARM\n");
#endif
exit(1); exit(1);
} }
#endif
#endif
/***************************************************************************** #endif /* THREAD */
** thr_alarm for OS/2 #endif /* MAIN */
*****************************************************************************/
#elif defined(__OS2__)
#define INCL_BASE
#define INCL_NOPMAPI
#include <os2.h>
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{
APIRET rc;
if (alarm_aborted)
{
alrm->crono=0;
alrm->event=0;
return 1;
}
if (!(rc = DosCreateEventSem(NULL,(HEV *)&alrm->event,DC_SEM_SHARED,FALSE)))
{
printf("Error creating event semaphore! [%d] \n",rc);
alrm->crono=0;
alrm->event=0;
return 1;
}
if (!(rc = DosAsyncTimer((long) sec*1000L, (HSEM) alrm->event,(HTIMER *) &alrm->crono))) {
printf("Error starting async timer! [%d] \n",rc);
DosCloseEventSem((HEV) alrm->event);
alrm->crono=0;
alrm->event=0;
return 1;
} /* endif */
return 1;
}
bool thr_got_alarm(thr_alarm_t *alrm)
{
APIRET rc;
if (alrm->crono)
{
rc = DosWaitEventSem((HEV) alrm->event, SEM_IMMEDIATE_RETURN);
if (rc == 0) {
DosCloseEventSem((HEV) alrm->event);
alrm->crono = 0;
alrm->event = 0;
} /* endif */
}
return !alrm->crono || alarm_aborted;
}
void thr_end_alarm(thr_alarm_t *alrm)
{
if (alrm->crono)
{
DosStopTimer((HTIMER) alrm->crono);
DosCloseEventSem((HEV) alrm->event);
alrm->crono = 0;
alrm->event = 0;
}
}
void end_thr_alarm(void)
{
DBUG_ENTER("end_thr_alarm");
alarm_aborted=1; /* No more alarms */
DBUG_VOID_RETURN;
}
void init_thr_alarm(uint max_alarm)
{
DBUG_ENTER("init_thr_alarm");
alarm_aborted=0; /* Yes, Gimmie alarms */
DBUG_VOID_RETURN;
}
#ifdef MAIN
void main()
{
printf("hello world\n");
}
#endif
/*****************************************************************************
** thr_alarm for win95
*****************************************************************************/
#else /* __WIN__ */
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
{
if (alarm_aborted)
{
alrm->crono=0;
return 1;
}
if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL)))
return 1;
return 0;
}
bool thr_got_alarm(thr_alarm_t *alrm)
{
MSG msg;
if (alrm->crono)
{
PeekMessage(&msg,NULL,WM_TIMER,WM_TIMER,PM_REMOVE) ;
if (msg.message == WM_TIMER || alarm_aborted)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
}
}
return !alrm->crono || alarm_aborted;
}
void thr_end_alarm(thr_alarm_t *alrm)
{
if (alrm->crono)
{
KillTimer(NULL, alrm->crono);
alrm->crono = 0;
}
}
void end_thr_alarm(void)
{
DBUG_ENTER("end_thr_alarm");
alarm_aborted=1; /* No more alarms */
DBUG_VOID_RETURN;
}
#endif /* __WIN__ */
#endif

View File

@ -76,13 +76,14 @@ multiple read locks.
#endif #endif
#include "mysys_priv.h" #include "mysys_priv.h"
#ifdef THREAD
#include "thr_lock.h" #include "thr_lock.h"
#include <m_string.h> #include <m_string.h>
#include <errno.h> #include <errno.h>
my_bool thr_lock_inited=0; my_bool thr_lock_inited=0;
#ifdef THREAD
/* The following constants are only for debug output */ /* The following constants are only for debug output */
#define MAX_THREADS 100 #define MAX_THREADS 100
@ -1063,8 +1064,16 @@ void thr_print_locks(void)
pthread_mutex_unlock(&THR_LOCK_lock); pthread_mutex_unlock(&THR_LOCK_lock);
} }
#endif /* THREAD */
/*****************************************************************************
** Test of thread locks
****************************************************************************/
#ifdef MAIN #ifdef MAIN
#ifdef THREAD
struct st_test { struct st_test {
uint lock_nr; uint lock_nr;
enum thr_lock_type lock_type; enum thr_lock_type lock_type;
@ -1283,6 +1292,14 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Test succeeded\n"); printf("Test succeeded\n");
return 0; return 0;
} }
#endif
#endif #else /* THREAD */
int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
{
printf("thr_lock disabled because we are not using threads\n");
exit(1);
}
#endif /* THREAD */
#endif /* MAIN */

View File

@ -37,7 +37,7 @@
#ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT #ifdef HAVE_NONPOSIX_PTHREAD_MUTEX_INIT
#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b)) #define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
#endif #endif
#endif #endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
int safe_mutex_init(safe_mutex_t *mp, int safe_mutex_init(safe_mutex_t *mp,
const pthread_mutexattr_t *attr __attribute__((unused))) const pthread_mutexattr_t *attr __attribute__((unused)))
@ -211,4 +211,4 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line)
return pthread_mutex_destroy(&mp->mutex); return pthread_mutex_destroy(&mp->mutex);
} }
#endif /* SAFE_MUTEX */ #endif /* THREAD && SAFE_MUTEX */

View File

@ -39,7 +39,7 @@
# "3-byte int" or "same as xxx". # "3-byte int" or "same as xxx".
$version="1.47"; $version="1.48";
use DBI; use DBI;
use Getopt::Long; use Getopt::Long;
@ -280,6 +280,14 @@ if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))"))
$dbh->do("drop table crash_q1"); $dbh->do("drop table crash_q1");
$dbh->do("drop table crash_q"); $dbh->do("drop table crash_q");
report("rename table","rename_table",
"create table crash_q (a integer, b integer,c CHAR(10))",
"rename table crash_q to crash_q1",
"drop table crash_q1");
# Make sure both tables will be dropped, even if rename fails.
$dbh->do("drop table crash_q1");
$dbh->do("drop table crash_q");
if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") && if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") &&
$dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)")) $dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)"))
{ {
@ -905,6 +913,9 @@ try_and_report("Automatic rowid", "automatic_rowid",
["MIN on numbers","min","min(a)",1,0], ["MIN on numbers","min","min(a)",1,0],
["MIN on strings","min_str","min(b)","a",1], ["MIN on strings","min_str","min(b)","a",1],
["SUM","sum","sum(a)",1,0], ["SUM","sum","sum(a)",1,0],
["ANY","any","any(a)",$logical_value,0],
["EVERY","every","every(a)",$logical_value,0],
["SOME","some","some(a)",$logical_value,0],
); );
@extra_group_functions= @extra_group_functions=

View File

@ -1,4 +1,4 @@
#This file is automaticly generated by crash-me 1.47 #This file is automaticly generated by crash-me 1.48
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
@ -36,7 +36,7 @@ constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=no # crash me safe crash_me_safe=no # crash me safe
crash_me_version=1.47 # crash me version crash_me_version=1.48 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
@ -283,14 +283,17 @@ group_func_extra_count_distinct_list=yes # Group function COUNT(DISTINCT expr,ex
group_func_extra_std=yes # Group function STD group_func_extra_std=yes # Group function STD
group_func_extra_stddev=yes # Group function STDDEV group_func_extra_stddev=yes # Group function STDDEV
group_func_extra_variance=no # Group function VARIANCE group_func_extra_variance=no # Group function VARIANCE
group_func_sql_any=no # Group function ANY
group_func_sql_avg=yes # Group function AVG group_func_sql_avg=yes # Group function AVG
group_func_sql_count_*=yes # Group function COUNT (*) group_func_sql_count_*=yes # Group function COUNT (*)
group_func_sql_count_column=yes # Group function COUNT column name group_func_sql_count_column=yes # Group function COUNT column name
group_func_sql_count_distinct=yes # Group function COUNT(DISTINCT expr) group_func_sql_count_distinct=yes # Group function COUNT(DISTINCT expr)
group_func_sql_every=no # Group function EVERY
group_func_sql_max=yes # Group function MAX on numbers group_func_sql_max=yes # Group function MAX on numbers
group_func_sql_max_str=yes # Group function MAX on strings group_func_sql_max_str=yes # Group function MAX on strings
group_func_sql_min=yes # Group function MIN on numbers group_func_sql_min=yes # Group function MIN on numbers
group_func_sql_min_str=yes # Group function MIN on strings group_func_sql_min_str=yes # Group function MIN on strings
group_func_sql_some=no # Group function SOME
group_func_sql_sum=yes # Group function SUM group_func_sql_sum=yes # Group function SUM
group_functions=yes # Group functions group_functions=yes # Group functions
has_true_false=no # TRUE and FALSE has_true_false=no # TRUE and FALSE
@ -384,7 +387,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM select_without_from=yes # SELECT without FROM
server_version=MySQL 3.23.19 beta debug # server version server_version=MySQL 3.23.22 beta debug # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values storage_of_float=round # Storage of float values
subqueries=no # subqueries subqueries=no # subqueries

View File

@ -554,7 +554,7 @@ sub new
$limits{'max_index_parts'} = 16; # Is this true ? $limits{'max_index_parts'} = 16; # Is this true ?
$limits{'max_text_size'} = 7000; # 8000 crashes pg 6.3 $limits{'max_text_size'} = 7000; # 8000 crashes pg 6.3
$limits{'query_size'} = 16777216; $limits{'query_size'} = 16777216;
$limits{'unique_index'} = 0; # Unique index works or not $limits{'unique_index'} = 1; # Unique index works or not
# the different cases per query ... # the different cases per query ...
$smds{'q1'} = 'b'; # with time $smds{'q1'} = 'b'; # with time

View File

@ -223,8 +223,8 @@ if ($limits->{'unique_index'})
{ {
$tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count); $tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count);
$tmp=$tmpvar % ($total_rows); $tmp=$tmpvar % ($total_rows);
$tmpquery = "$query ($tmp,1,2,'D')"; $tmpquery = "$query ($tmp,$tmp,2,'D')";
if (!$dbh->do($tmpquery)) if ($dbh->do($tmpquery))
{ {
die "Didn't get an error when inserting duplicate record $tmp\n"; die "Didn't get an error when inserting duplicate record $tmp\n";
} }

View File

@ -264,7 +264,7 @@ bool Field::send(String *packet)
void Field_num::add_zerofill_and_unsigned(String &res) const void Field_num::add_zerofill_and_unsigned(String &res) const
{ {
res.length(strlen(res.ptr())); // Fix length res.length((uint) strlen(res.ptr())); // Fix length
if (unsigned_flag) if (unsigned_flag)
res.append(" unsigned"); res.append(" unsigned");
if (zerofill) if (zerofill)
@ -355,7 +355,7 @@ void Field::store_time(TIME *ltime,timestamp_type type)
case TIMESTAMP_TIME: case TIMESTAMP_TIME:
sprintf(buff, "%02d:%02d:%02d", sprintf(buff, "%02d:%02d:%02d",
ltime->hour,ltime->minute,ltime->second); ltime->hour,ltime->minute,ltime->second);
store(buff,strlen(buff)); store(buff,(uint) strlen(buff));
break; break;
} }
} }
@ -500,8 +500,12 @@ void Field_decimal::store(double nr)
char buff[320]; char buff[320];
fyllchar = zerofill ? (char) '0' : (char) ' '; fyllchar = zerofill ? (char) '0' : (char) ' ';
#ifdef HAVE_SNPRINTF_
snprintf(buff,sizeof(buff), "%.*f",(int) dec,nr);
#else
sprintf(buff,"%.*f",dec,nr); sprintf(buff,"%.*f",dec,nr);
length=strlen(buff); #endif
length=(uint) strlen(buff);
if (length > field_length) if (length > field_length)
{ {
@ -1836,8 +1840,12 @@ String *Field_float::val_str(String *val_buffer,
} }
while (tmp_dec--) while (tmp_dec--)
*to++= *pos++; *to++= *pos++;
#else
#ifdef HAVE_SNPRINTF_
sprintf(to,val_buffer->length(),"%.*f",dec,nr);
#else #else
sprintf(to,"%.*f",dec,nr); sprintf(to,"%.*f",dec,nr);
#endif
to=strend(to); to=strend(to);
#endif #endif
} }
@ -2471,7 +2479,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
void Field_timestamp::sql_type(String &res) const void Field_timestamp::sql_type(String &res) const
{ {
sprintf((char*) res.ptr(),"timestamp(%d)",(int) field_length); sprintf((char*) res.ptr(),"timestamp(%d)",(int) field_length);
res.length(strlen(res.ptr())); res.length((uint) strlen(res.ptr()));
} }
@ -2597,7 +2605,7 @@ String *Field_time::val_str(String *val_buffer,
sprintf((char*) val_buffer->ptr(),"%s%02d:%02d:%02d", sprintf((char*) val_buffer->ptr(),"%s%02d:%02d:%02d",
sign,(int) (tmp/10000), (int) (tmp/100 % 100), sign,(int) (tmp/10000), (int) (tmp/100 % 100),
(int) (tmp % 100)); (int) (tmp % 100));
val_buffer->length(strlen(val_buffer->ptr())); val_buffer->length((uint) strlen(val_buffer->ptr()));
return val_buffer; return val_buffer;
} }
@ -2722,7 +2730,7 @@ String *Field_year::val_str(String *val_buffer,
void Field_year::sql_type(String &res) const void Field_year::sql_type(String &res) const
{ {
sprintf((char*) res.ptr(),"year(%d)",(int) field_length); sprintf((char*) res.ptr(),"year(%d)",(int) field_length);
res.length(strlen(res.ptr())); res.length((uint) strlen(res.ptr()));
} }
@ -3388,7 +3396,7 @@ void Field_string::sql_type(String &res) const
(table->db_options_in_use & HA_OPTION_PACK_RECORD) ? (table->db_options_in_use & HA_OPTION_PACK_RECORD) ?
"varchar" : "char", "varchar" : "char",
(int) field_length); (int) field_length);
res.length(strlen(res.ptr())); res.length((uint) strlen(res.ptr()));
if (binary_flag) if (binary_flag)
res.append(" binary"); res.append(" binary");
} }
@ -3566,7 +3574,7 @@ void Field_varstring::sort_string(char *to,uint length)
void Field_varstring::sql_type(String &res) const void Field_varstring::sql_type(String &res) const
{ {
sprintf((char*) res.ptr(),"varchar(%d)",(int) field_length); sprintf((char*) res.ptr(),"varchar(%d)",(int) field_length);
res.length(strlen(res.ptr())); res.length((uint) strlen(res.ptr()));
if (binary_flag) if (binary_flag)
res.append(" binary"); res.append(" binary");
} }
@ -3980,7 +3988,7 @@ void Field_blob::sql_type(String &res) const
case 3: str="medium"; break; case 3: str="medium"; break;
case 4: str="long"; break; case 4: str="long"; break;
} }
res.set(str,strlen(str)); res.set(str,(uint) strlen(str));
res.append(binary_flag ? "blob" : "text"); res.append(binary_flag ? "blob" : "text");
} }
@ -4191,7 +4199,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
val_ptr->length(0); val_ptr->length(0);
else else
val_ptr->set((const char*) typelib->type_names[tmp-1], val_ptr->set((const char*) typelib->type_names[tmp-1],
strlen(typelib->type_names[tmp-1])); (uint) strlen(typelib->type_names[tmp-1]));
return val_ptr; return val_ptr;
} }
@ -4309,7 +4317,7 @@ String *Field_set::val_str(String *val_buffer,
if (val_buffer->length()) if (val_buffer->length())
val_buffer->append(field_separator); val_buffer->append(field_separator);
String str(typelib->type_names[bitnr], String str(typelib->type_names[bitnr],
strlen(typelib->type_names[bitnr])); (uint) strlen(typelib->type_names[bitnr]));
val_buffer->append(str); val_buffer->append(str);
} }
tmp>>=1; tmp>>=1;

View File

@ -1383,7 +1383,7 @@ static BDB_SHARE *get_share(const char *table_name)
{ {
BDB_SHARE *share; BDB_SHARE *share;
pthread_mutex_lock(&bdb_mutex); pthread_mutex_lock(&bdb_mutex);
uint length=strlen(table_name); uint length=(uint) strlen(table_name);
if (!(share=(BDB_SHARE*) hash_search(&bdb_open_tables, table_name, length))) if (!(share=(BDB_SHARE*) hash_search(&bdb_open_tables, table_name, length)))
{ {
if ((share=(BDB_SHARE *) my_malloc(sizeof(*share)+length+1, if ((share=(BDB_SHARE *) my_malloc(sizeof(*share)+length+1,

View File

@ -349,7 +349,6 @@ int ha_myisam::analyze(THD *thd)
int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt)
{ {
if (!file) return HA_CHECK_INTERNAL_ERROR; if (!file) return HA_CHECK_INTERNAL_ERROR;
int error ;
MI_CHECK param; MI_CHECK param;
myisamchk_init(&param); myisamchk_init(&param);
@ -438,7 +437,6 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows)
bool ha_myisam::activate_all_index(THD *thd) bool ha_myisam::activate_all_index(THD *thd)
{ {
int error=0; int error=0;
char fixed_name[FN_REFLEN];
MI_CHECK param; MI_CHECK param;
MYISAM_SHARE* share = file->s; MYISAM_SHARE* share = file->s;
DBUG_ENTER("activate_all_index"); DBUG_ENTER("activate_all_index");

View File

@ -462,7 +462,7 @@ void handler::print_error(int error, myf errflag)
char key[MAX_KEY_LENGTH]; char key[MAX_KEY_LENGTH];
String str(key,sizeof(key)); String str(key,sizeof(key));
key_unpack(&str,table,(uint) key_nr); key_unpack(&str,table,(uint) key_nr);
uint max_length=MYSQL_ERRMSG_SIZE-strlen(ER(ER_DUP_ENTRY)); uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(ER(ER_DUP_ENTRY));
if (str.length() >= max_length) if (str.length() >= max_length)
{ {
str.length(max_length-4); str.length(max_length-4);

View File

@ -77,7 +77,7 @@ static void add_hostname(struct in_addr *in,const char *name)
host_entry *entry; host_entry *entry;
if (!(entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0))) if (!(entry=(host_entry*) hostname_cache->search((gptr) &in->s_addr,0)))
{ {
uint length=name ? strlen(name) : 0; uint length=name ? (uint) strlen(name) : 0;
if ((entry=(host_entry*) malloc(sizeof(host_entry)+length+1))) if ((entry=(host_entry*) malloc(sizeof(host_entry)+length+1)))
{ {

View File

@ -125,13 +125,14 @@ const char *Item_ident::full_name() const
return field_name ? field_name : name ? name : "tmp_field"; return field_name ? field_name : name ? name : "tmp_field";
if (db_name) if (db_name)
{ {
tmp=(char*) sql_alloc(strlen(db_name)+strlen(table_name)+ tmp=(char*) sql_alloc((uint) strlen(db_name)+(uint) strlen(table_name)+
strlen(field_name)+3); (uint) strlen(field_name)+3);
strxmov(tmp,db_name,".",table_name,".",field_name,NullS); strxmov(tmp,db_name,".",table_name,".",field_name,NullS);
} }
else else
{ {
tmp=(char*) sql_alloc(strlen(table_name)+strlen(field_name)+2); tmp=(char*) sql_alloc((uint) strlen(table_name)+
(uint) strlen(field_name)+2);
strxmov(tmp,table_name,".",field_name,NullS); strxmov(tmp,table_name,".",field_name,NullS);
} }
return tmp; return tmp;

View File

@ -364,7 +364,7 @@ Item *create_func_ucase(Item* a)
Item *create_func_version(void) Item *create_func_version(void)
{ {
return new Item_string(NullS,server_version, strlen(server_version)); return new Item_string(NullS,server_version, (uint) strlen(server_version));
} }
Item *create_func_weekday(Item* a) Item *create_func_weekday(Item* a)

View File

@ -1047,7 +1047,7 @@ udf_handler::fix_fields(THD *thd,TABLE_LIST *tables,Item_result_field *func,
} }
else else
thd=current_thd; // In WHERE / const clause thd=current_thd; // In WHERE / const clause
udf_func *tmp_udf=find_udf(u_d->name,strlen(u_d->name),1); udf_func *tmp_udf=find_udf(u_d->name,(uint) strlen(u_d->name),1);
if (!tmp_udf) if (!tmp_udf)
{ {

View File

@ -997,7 +997,7 @@ String *Item_func_encrypt::val_str(String *str)
} }
pthread_mutex_lock(&LOCK_crypt); pthread_mutex_lock(&LOCK_crypt);
char *tmp=crypt(res->c_ptr(),salt_ptr); char *tmp=crypt(res->c_ptr(),salt_ptr);
str->set(tmp,strlen(tmp)); str->set(tmp,(uint) strlen(tmp));
str->copy(); str->copy();
pthread_mutex_unlock(&LOCK_crypt); pthread_mutex_unlock(&LOCK_crypt);
return str; return str;
@ -1049,14 +1049,14 @@ String *Item_func_database::val_str(String *str)
if (!current_thd->db) if (!current_thd->db)
str->length(0); str->length(0);
else else
str->set((const char*) current_thd->db,strlen(current_thd->db)); str->set((const char*) current_thd->db,(uint) strlen(current_thd->db));
return str; return str;
} }
String *Item_func_user::val_str(String *str) String *Item_func_user::val_str(String *str)
{ {
THD *thd=current_thd; THD *thd=current_thd;
if (str->copy((const char*) thd->user,strlen(thd->user)) || if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) ||
str->append('@') || str->append('@') ||
str->append(thd->host ? thd->host : thd->ip ? thd->ip : "")) str->append(thd->host ? thd->host : thd->ip ? thd->ip : ""))
return &empty_string; return &empty_string;

View File

@ -455,7 +455,7 @@ void Item_func_curtime::fix_length_and_dec()
(int) start->tm_hour, (int) start->tm_hour,
(int) start->tm_min, (int) start->tm_min,
(int) start->tm_sec); (int) start->tm_sec);
buff_length=strlen(buff); buff_length=(uint) strlen(buff);
} }
void Item_func_now::fix_length_and_dec() void Item_func_now::fix_length_and_dec()
@ -478,7 +478,7 @@ void Item_func_now::fix_length_and_dec()
(int) start->tm_hour, (int) start->tm_hour,
(int) start->tm_min, (int) start->tm_min,
(int) start->tm_sec); (int) start->tm_sec);
buff_length=strlen(buff); buff_length=(uint) strlen(buff);
/* For getdate */ /* For getdate */
ltime.year= start->tm_year+1900; ltime.year= start->tm_year+1900;
ltime.month= start->tm_mon+1; ltime.month= start->tm_mon+1;
@ -522,7 +522,7 @@ String *Item_func_sec_to_time::val_str(String *str)
uint sec= (uint) (seconds % 3600); uint sec= (uint) (seconds % 3600);
sprintf(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600), sprintf(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600),
sec/60, sec % 60); sec/60, sec % 60);
str->copy(buff,strlen(buff)); str->copy(buff,(uint) strlen(buff));
return str; return str;
} }

View File

@ -418,7 +418,11 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
return 0; return 0;
/* Create a table entry with the right key and with an old refresh version */ /* Create a table entry with the right key and with an old refresh version */
if (!(table= (TABLE*) thd->calloc(sizeof(*table)+key_length))) /* Note that we must use my_malloc() here as this is freed by the table
cache */
if (!(table= (TABLE*) my_malloc(sizeof(*table)+key_length,
MYF(MY_WME | MY_ZEROFILL))))
return -1; return -1;
memcpy((table->table_cache_key= (char*) (table+1)), key, key_length); memcpy((table->table_cache_key= (char*) (table+1)), key, key_length);
table->key_length=key_length; table->key_length=key_length;
@ -435,7 +439,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
void unlock_table_name(THD *thd, TABLE_LIST *table_list) void unlock_table_name(THD *thd, TABLE_LIST *table_list)
{ {
if (table_list->table) if (table_list->table)
hash_delete(&open_cache, (gptr) table_list->table); hash_delete(&open_cache, (byte*) table_list->table);
} }
static bool locked_named_table(THD *thd, TABLE_LIST *table_list) static bool locked_named_table(THD *thd, TABLE_LIST *table_list)
@ -461,10 +465,7 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
break; break;
} }
wait_for_refresh(thd); wait_for_refresh(thd);
pthread_mutex_lock(&LOCK_open);
} }
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex=0;
thd->mysys_var->current_cond=0;
pthread_mutex_unlock(&thd->mysys_var->mutex);
return result; return result;
} }

View File

@ -221,7 +221,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name)
if(!index_file) return LOG_INFO_INVALID; if(!index_file) return LOG_INFO_INVALID;
int error = 0; int error = 0;
char* fname = linfo->log_file_name; char* fname = linfo->log_file_name;
int log_name_len = strlen(log_name); int log_name_len = (uint) strlen(log_name);
pthread_mutex_lock(&LOCK_index); pthread_mutex_lock(&LOCK_index);
if(my_fseek(index_file, 0L, MY_SEEK_SET, MYF(MY_WME) ) == MY_FILEPOS_ERROR) if(my_fseek(index_file, 0L, MY_SEEK_SET, MYF(MY_WME) ) == MY_FILEPOS_ERROR)
@ -296,7 +296,7 @@ void MYSQL_LOG::make_log_name(char* buf, const char* log_ident)
if(inited) if(inited)
{ {
int dir_len = dirname_length(log_file_name); int dir_len = dirname_length(log_file_name);
int ident_len = strlen(log_ident); int ident_len = (uint) strlen(log_ident);
if(dir_len + ident_len + 1 > FN_REFLEN) if(dir_len + ident_len + 1 > FN_REFLEN)
{ {
buf[0] = 0; buf[0] = 0;

View File

@ -101,7 +101,7 @@ public:
time(&end_time); time(&end_time);
exec_time = end_time - thd->start_time; exec_time = end_time - thd->start_time;
valid_exec_time = 1; valid_exec_time = 1;
db_len = (db) ? strlen(db) : 0; db_len = (db) ? (uint) strlen(db) : 0;
} }
#endif #endif
@ -189,9 +189,9 @@ public:
time(&end_time); time(&end_time);
exec_time = end_time - thd->start_time; exec_time = end_time - thd->start_time;
valid_exec_time = 1; valid_exec_time = 1;
db_len = (db) ? strlen(db) : 0; db_len = (db) ? (uint) strlen(db) : 0;
table_name_len = (table_name) ? strlen(table_name) : 0; table_name_len = (table_name) ? (uint) strlen(table_name) : 0;
fname_len = (fname) ? strlen(fname) : 0; fname_len = (fname) ? (uint) strlen(fname) : 0;
sql_ex.field_term = (*ex->field_term)[0]; sql_ex.field_term = (*ex->field_term)[0];
sql_ex.enclosed = (*ex->enclosed)[0]; sql_ex.enclosed = (*ex->enclosed)[0];
sql_ex.line_term = (*ex->line_term)[0]; sql_ex.line_term = (*ex->line_term)[0];
@ -232,7 +232,7 @@ public:
while((item = li++)) while((item = li++))
{ {
num_fields++; num_fields++;
uchar len = (uchar)strlen(item->name); uchar len = (uchar) strlen(item->name);
field_block_len += len + 1; field_block_len += len + 1;
fields_buf.append(item->name, len + 1); fields_buf.append(item->name, len + 1);
field_lens_buf.append((char*)&len, 1); field_lens_buf.append((char*)&len, 1);
@ -333,7 +333,7 @@ public:
Rotate_log_event(const char* new_log_ident_arg, uint ident_len_arg = 0) : Rotate_log_event(const char* new_log_ident_arg, uint ident_len_arg = 0) :
Log_event(time(NULL)), Log_event(time(NULL)),
new_log_ident(new_log_ident_arg), new_log_ident(new_log_ident_arg),
ident_len(ident_len_arg ? ident_len_arg : strlen(new_log_ident_arg)), ident_len(ident_len_arg ? ident_len_arg : (uint) strlen(new_log_ident_arg)),
alloced(0) alloced(0)
{} {}

View File

@ -423,13 +423,13 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg
arg=""; arg="";
if (net_write_command(net,(uchar) command,arg, if (net_write_command(net,(uchar) command,arg,
length ? length :strlen(arg))) length ? length :(uint) strlen(arg)))
{ {
DBUG_PRINT("error",("Can't send command to server. Error: %d",errno)); DBUG_PRINT("error",("Can't send command to server. Error: %d",errno));
mc_end_server(mysql); mc_end_server(mysql);
if (mc_mysql_reconnect(mysql) || if (mc_mysql_reconnect(mysql) ||
net_write_command(net,(uchar) command,arg, net_write_command(net,(uchar) command,arg,
length ? length :strlen(arg))) length ? length :(uint) strlen(arg)))
{ {
net->last_errno=CR_SERVER_GONE_ERROR; net->last_errno=CR_SERVER_GONE_ERROR;
strmov(net->last_error,ER(net->last_errno)); strmov(net->last_error,ER(net->last_errno));

View File

@ -229,7 +229,7 @@ void flush_thread_cache();
void mysql_execute_command(void); void mysql_execute_command(void);
bool do_command(THD *thd); bool do_command(THD *thd);
bool check_stack_overrun(THD *thd,char *dummy); bool check_stack_overrun(THD *thd,char *dummy);
bool reload_acl_and_cache(uint options); bool reload_acl_and_cache(THD *thd, uint options, TABLE_LIST *tables);
void mysql_rm_db(THD *thd,char *db,bool if_exists); void mysql_rm_db(THD *thd,char *db,bool if_exists);
void table_cache_init(void); void table_cache_init(void);
void table_cache_free(void); void table_cache_free(void);
@ -388,7 +388,7 @@ bool rename_temporary_table(TABLE *table, const char *new_db,
void remove_db_from_cache(const my_string db); void remove_db_from_cache(const my_string db);
void flush_tables(); void flush_tables();
bool remove_table_from_cache(THD *thd, const char *db, const char *table); bool remove_table_from_cache(THD *thd, const char *db, const char *table);
bool close_cached_tables(bool wait_for_refresh); bool close_cached_tables(THD *thd, bool wait_for_refresh, TABLE_LIST *tables);
void copy_field_from_tmp_record(Field *field,int offset); void copy_field_from_tmp_record(Field *field,int offset);
int fill_record(List<Item> &fields,List<Item> &values); int fill_record(List<Item> &fields,List<Item> &values);
int fill_record(Field **field,List<Item> &values); int fill_record(Field **field,List<Item> &values);

View File

@ -118,7 +118,7 @@ static void usage()
static void dump_remote_file(NET* net, const char* fname) static void dump_remote_file(NET* net, const char* fname)
{ {
char buf[FN_REFLEN+1]; char buf[FN_REFLEN+1];
uint len = strlen(fname); uint len = (uint) strlen(fname);
buf[0] = 0; buf[0] = 0;
memcpy(buf + 1, fname, len + 1); memcpy(buf + 1, fname, len + 1);
if(my_net_write(net, buf, len +2) || net_flush(net)) if(my_net_write(net, buf, len +2) || net_flush(net))
@ -234,8 +234,8 @@ static void dump_remote_table(NET* net, const char* db, const char* table)
{ {
char buf[1024]; char buf[1024];
char * p = buf; char * p = buf;
uint table_len = strlen(table); uint table_len = (uint) strlen(table);
uint db_len = strlen(db); uint db_len = (uint) strlen(db);
if(table_len + db_len > sizeof(buf) - 2) if(table_len + db_len > sizeof(buf) - 2)
die("Buffer overrun"); die("Buffer overrun");
@ -267,7 +267,7 @@ static void dump_remote_log_entries(const char* logname)
NET* net = &mysql->net; NET* net = &mysql->net;
int4store(buf, position); int4store(buf, position);
int2store(buf + 4, binlog_flags); int2store(buf + 4, binlog_flags);
len = strlen(logname); len = (uint) strlen(logname);
memcpy(buf + 6, logname,len); memcpy(buf + 6, logname,len);
if(mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 6, 1)) if(mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 6, 1))
die("Error sending the log dump command"); die("Error sending the log dump command");

View File

@ -1138,7 +1138,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
} }
break; break;
case SIGHUP: case SIGHUP:
reload_acl_and_cache(~0); // Flush everything reload_acl_and_cache((THD*) 0,~0, (TABLE_LIST*) 0); // Flush everything
mysql_print_status((THD*) 0); // Send debug some info mysql_print_status((THD*) 0); // Send debug some info
break; break;
#ifdef USE_ONE_SIGNAL_HAND #ifdef USE_ONE_SIGNAL_HAND
@ -2875,7 +2875,7 @@ static void get_options(int argc,char **argv)
berkeley_lock_type=berkeley_lock_types[type-1]; berkeley_lock_type=berkeley_lock_types[type-1];
else else
{ {
if (test_if_int(optarg,strlen(optarg))) if (test_if_int(optarg,(uint) strlen(optarg)))
berkeley_lock_scan_time=atoi(optarg); berkeley_lock_scan_time=atoi(optarg);
else else
{ {
@ -3344,7 +3344,7 @@ static char *get_relative_path(const char *path)
is_prefix(path,DEFAULT_MYSQL_HOME) && is_prefix(path,DEFAULT_MYSQL_HOME) &&
strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR)) strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR))
{ {
path+=strlen(DEFAULT_MYSQL_HOME); path+=(uint) strlen(DEFAULT_MYSQL_HOME);
while (*path == FN_LIBCHAR) while (*path == FN_LIBCHAR)
path++; path++;
} }
@ -3384,7 +3384,7 @@ static void fix_paths(void)
strmov(tmp,mysql_tmpdir); strmov(tmp,mysql_tmpdir);
mysql_tmpdir=tmp; mysql_tmpdir=tmp;
convert_dirname(mysql_tmpdir); convert_dirname(mysql_tmpdir);
mysql_tmpdir=(char*) my_realloc(mysql_tmpdir,strlen(mysql_tmpdir)+1, mysql_tmpdir=(char*) my_realloc(mysql_tmpdir,(uint) strlen(mysql_tmpdir)+1,
MYF(MY_HOLD_ON_ERROR)); MYF(MY_HOLD_ON_ERROR));
} }
} }

View File

@ -64,7 +64,7 @@ void send_error(NET *net, uint sql_errno, const char *err)
} }
else else
{ {
length=strlen(err); length=(uint) strlen(err);
set_if_smaller(length,MYSQL_ERRMSG_SIZE); set_if_smaller(length,MYSQL_ERRMSG_SIZE);
} }
VOID(net_write_command(net,(uchar) 255,(char*) err,length)); VOID(net_write_command(net,(uchar) 255,(char*) err,length));
@ -98,7 +98,7 @@ net_printf(NET *net, uint errcode, ...)
offset= net->return_errno ? 2 : 0; offset= net->return_errno ? 2 : 0;
text_pos=(char*) net->buff+head_length+offset+1; text_pos=(char*) net->buff+head_length+offset+1;
(void) vsprintf(my_const_cast(char*) (text_pos),format,args); (void) vsprintf(my_const_cast(char*) (text_pos),format,args);
length=strlen((char*) text_pos); length=(uint) strlen((char*) text_pos);
if (length >= sizeof(net->last_error)) if (length >= sizeof(net->last_error))
length=sizeof(net->last_error)-1; /* purecov: inspected */ length=sizeof(net->last_error)-1; /* purecov: inspected */
va_end(args); va_end(args);
@ -215,7 +215,7 @@ net_store_length(char *pkg, uint length)
char * char *
net_store_data(char *to,const char *from) net_store_data(char *to,const char *from)
{ {
uint length=strlen(from); uint length=(uint) strlen(from);
to=net_store_length(to,length); to=net_store_length(to,length);
memcpy(to,from,length); memcpy(to,from,length);
return to+length; return to+length;
@ -267,7 +267,7 @@ net_store_data(String *packet,const char *from,uint length)
bool bool
net_store_data(String *packet,const char *from) net_store_data(String *packet,const char *from)
{ {
uint length=strlen(from); uint length=(uint) strlen(from);
uint packet_length=packet->length(); uint packet_length=packet->length();
if (packet_length+5+length > packet->alloced_length() && if (packet_length+5+length > packet->alloced_length() &&
packet->realloc(packet_length+5+length)) packet->realloc(packet_length+5+length))

View File

@ -38,7 +38,7 @@ public:
virtual void set(const char *str,uint length)=0; virtual void set(const char *str,uint length)=0;
virtual void set(longlong nr)=0; virtual void set(longlong nr)=0;
virtual enum_field_types field_type() const=0; virtual enum_field_types field_type() const=0;
void set(const char *str) { set(str,strlen(str)); } void set(const char *str) { set(str,(uint) strlen(str)); }
void make_field(Send_field *tmp_field) void make_field(Send_field *tmp_field)
{ {
init_make_field(tmp_field,field_type()); init_make_field(tmp_field,field_type());

View File

@ -193,5 +193,4 @@
"Fick nätverksfel vid läsning från master", "Fick nätverksfel vid läsning från master",
"Fick nätverksfel vid skrivning till master", "Fick nätverksfel vid skrivning till master",
"Hittar inte ett FULLTEXT index i kolumnlist", "Hittar inte ett FULLTEXT index i kolumnlist",
#ER_LOCK_OR_ACTIVE_TRANSACTION
"Can't execute the given command because you have active locked tables or an active transaction", "Can't execute the given command because you have active locked tables or an active transaction",

View File

@ -467,7 +467,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi)
char* logname = mi->log_file_name; char* logname = mi->log_file_name;
int4store(buf, mi->pos); int4store(buf, mi->pos);
int2store(buf + 4, binlog_flags); int2store(buf + 4, binlog_flags);
len = strlen(logname); len = (uint) strlen(logname);
memcpy(buf + 6, logname,len); memcpy(buf + 6, logname,len);
if(mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 6, 1)) if(mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 6, 1))
// something went wrong, so we will just reconnect and retry later // something went wrong, so we will just reconnect and retry later
@ -486,8 +486,8 @@ static int request_table_dump(MYSQL* mysql, char* db, char* table)
{ {
char buf[1024]; char buf[1024];
char * p = buf; char * p = buf;
uint table_len = strlen(table); uint table_len = (uint) strlen(table);
uint db_len = strlen(db); uint db_len = (uint) strlen(db);
if(table_len + db_len > sizeof(buf) - 2) if(table_len + db_len > sizeof(buf) - 2)
{ {
sql_print_error("request_table_dump: Buffer overrun"); sql_print_error("request_table_dump: Buffer overrun");

View File

@ -199,7 +199,7 @@ int acl_init(bool dont_read_acl_tables)
update_hostname(&user.host,get_field(&mem, table,0)); update_hostname(&user.host,get_field(&mem, table,0));
user.user=get_field(&mem, table,1); user.user=get_field(&mem, table,1);
user.password=get_field(&mem, table,2); user.password=get_field(&mem, table,2);
if (user.password && (length=strlen(user.password)) == 8 && if (user.password && (length=(uint) strlen(user.password)) == 8 &&
protocol_version == PROTOCOL_VERSION) protocol_version == PROTOCOL_VERSION)
{ {
sql_print_error( sql_print_error(
@ -217,7 +217,7 @@ int acl_init(bool dont_read_acl_tables)
get_salt_from_password(user.salt,user.password); get_salt_from_password(user.salt,user.password);
user.access=get_access(table,3); user.access=get_access(table,3);
user.sort=get_sort(2,user.host.hostname,user.user); user.sort=get_sort(2,user.host.hostname,user.user);
user.hostname_length=user.host.hostname ? strlen(user.host.hostname) : 0; user.hostname_length=user.host.hostname ? (uint) strlen(user.host.hostname) : 0;
#ifndef TO_BE_REMOVED #ifndef TO_BE_REMOVED
if (table->fields <= 13) if (table->fields <= 13)
{ // Without grant { // Without grant
@ -497,7 +497,7 @@ static void acl_insert_user(const char *user, const char *host,
acl_user.password=0; acl_user.password=0;
acl_user.access=privileges; acl_user.access=privileges;
acl_user.sort=get_sort(2,acl_user.host.hostname,acl_user.user); acl_user.sort=get_sort(2,acl_user.host.hostname,acl_user.user);
acl_user.hostname_length=strlen(acl_user.host.hostname); acl_user.hostname_length=(uint) strlen(acl_user.host.hostname);
if (password) if (password)
{ {
acl_user.password=(char*) ""; // Just point at something acl_user.password=(char*) ""; // Just point at something
@ -713,7 +713,7 @@ static void init_check_host(void)
(void) push_dynamic(&acl_wild_hosts,(char*) &acl_user->host); (void) push_dynamic(&acl_wild_hosts,(char*) &acl_user->host);
} }
else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host, else if (!hash_search(&acl_check_hosts,(byte*) &acl_user->host,
strlen(acl_user->host.hostname))) (uint) strlen(acl_user->host.hostname)))
{ {
if (hash_insert(&acl_check_hosts,(byte*) acl_user)) if (hash_insert(&acl_check_hosts,(byte*) acl_user))
{ // End of memory { // End of memory
@ -737,8 +737,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0; return 0;
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
if (host && hash_search(&acl_check_hosts,(byte*) host,strlen(host)) || if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) ||
ip && hash_search(&acl_check_hosts,(byte*) ip,strlen(ip))) ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip)))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host return 0; // Found host
@ -778,10 +778,10 @@ bool change_password(THD *thd, const char *host, const char *user,
if (!host) if (!host)
host=thd->ip; /* purecov: tested */ host=thd->ip; /* purecov: tested */
/* password should always be 0 or 16 chars; simple hack to avoid cracking */ /* password should always be 0 or 16 chars; simple hack to avoid cracking */
length=strlen(new_password); length=(uint) strlen(new_password);
new_password[length & 16]=0; new_password[length & 16]=0;
if (strcmp(thd->user,user) || if (!thd || strcmp(thd->user,user) ||
my_strcasecmp(host,thd->host ? thd->host : thd->ip)) my_strcasecmp(host,thd->host ? thd->host : thd->ip))
{ {
if (check_access(thd, UPDATE_ACL, "mysql",0,1)) if (check_access(thd, UPDATE_ACL, "mysql",0,1))
@ -820,7 +820,7 @@ bool change_password(THD *thd, const char *host, const char *user,
acl_user->user, acl_user->user,
acl_user->host.hostname ? acl_user->host.hostname : "", acl_user->host.hostname ? acl_user->host.hostname : "",
new_password)); new_password));
mysql_update_log.write(buff,strlen(buff)); mysql_update_log.write(buff,(uint) strlen(buff));
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
return 0; return 0;
} }
@ -919,8 +919,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
tables.db=(char*) "mysql"; tables.db=(char*) "mysql";
if (!(table=open_ltable(thd,&tables,TL_WRITE))) if (!(table=open_ltable(thd,&tables,TL_WRITE)))
DBUG_RETURN(1); /* purecov: deadcode */ DBUG_RETURN(1); /* purecov: deadcode */
table->field[0]->store(host,strlen(host)); table->field[0]->store(host,(uint) strlen(host));
table->field[1]->store(user,strlen(user)); table->field[1]->store(user,(uint) strlen(user));
if (table->file->index_read_idx(table->record[0],0, if (table->file->index_read_idx(table->record[0],0,
(byte*) table->field[0]->ptr,0, (byte*) table->field[0]->ptr,0,
@ -930,7 +930,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_RETURN(1); /* purecov: deadcode */ DBUG_RETURN(1); /* purecov: deadcode */
} }
store_record(table,1); store_record(table,1);
table->field[2]->store(new_password,strlen(new_password)); table->field[2]->store(new_password,(uint) strlen(new_password));
if ((error=table->file->update_row(table->record[1],table->record[0]))) if ((error=table->file->update_row(table->record[1],table->record[0])))
{ {
table->file->print_error(error,MYF(0)); /* purecov: deadcode */ table->file->print_error(error,MYF(0)); /* purecov: deadcode */
@ -982,14 +982,14 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
restore_record(table,2); // cp empty row from record[2] restore_record(table,2); // cp empty row from record[2]
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(combo.user.str,combo.user.length); table->field[1]->store(combo.user.str,combo.user.length);
table->field[2]->store(password,strlen(password)); table->field[2]->store(password,(uint) strlen(password));
} }
else else
{ {
ima = 1; ima = 1;
store_record(table,1); // Save copy for update store_record(table,1); // Save copy for update
if (combo.password.str) // If password given if (combo.password.str) // If password given
table->field[2]->store(password,strlen(password)); table->field[2]->store(password,(uint) strlen(password));
} }
for (i = 3, j = SELECT_ACL; // starting from reload for (i = 3, j = SELECT_ACL; // starting from reload
@ -1064,7 +1064,7 @@ static int replace_db_table(TABLE *table, const char *db,
} }
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(db,strlen(db)); table->field[1]->store(db,(uint) strlen(db));
table->field[2]->store(combo.user.str,combo.user.length); table->field[2]->store(combo.user.str,combo.user.length);
table->file->index_init(0); table->file->index_init(0);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,0, if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,0,
@ -1079,7 +1079,7 @@ static int replace_db_table(TABLE *table, const char *db,
ima = 0; // no row ima = 0; // no row
restore_record(table,2); // cp empty row from record[2] restore_record(table,2); // cp empty row from record[2]
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(db,strlen(db)); table->field[1]->store(db,(uint) strlen(db));
table->field[2]->store(combo.user.str,combo.user.length); table->field[2]->store(combo.user.str,combo.user.length);
} }
else else
@ -1166,7 +1166,7 @@ public:
db = strdup_root(&memex,d); db = strdup_root(&memex,d);
user = strdup_root(&memex,u); user = strdup_root(&memex,u);
tname= strdup_root(&memex,t); tname= strdup_root(&memex,t);
key_length =strlen(d)+strlen(u)+strlen(t)+3; key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3;
hash_key = (char*) alloc_root(&memex,key_length); hash_key = (char*) alloc_root(&memex,key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname); strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
(void) hash_init(&hash_columns,0,0,0, (hash_get_key) get_key_column,0, (void) hash_init(&hash_columns,0,0,0, (hash_get_key) get_key_column,0,
@ -1187,7 +1187,7 @@ public:
privs = cols = 0; /* purecov: inspected */ privs = cols = 0; /* purecov: inspected */
return; /* purecov: inspected */ return; /* purecov: inspected */
} }
key_length = strlen(db) + strlen(user) + strlen (tname) + 3; key_length = (uint) strlen(db) + (uint) strlen(user) + (uint) strlen (tname) + 3;
hash_key = (char*) alloc_root(&memex,key_length); hash_key = (char*) alloc_root(&memex,key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname); strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
privs = (uint) form->field[6]->val_int(); privs = (uint) form->field[6]->val_int();
@ -1200,10 +1200,10 @@ public:
if (cols) if (cols)
{ {
int key_len; int key_len;
col_privs->field[0]->store(host,strlen(host)); col_privs->field[0]->store(host,(uint) strlen(host));
col_privs->field[1]->store(db,strlen(db)); col_privs->field[1]->store(db,(uint) strlen(db));
col_privs->field[2]->store(user,strlen(user)); col_privs->field[2]->store(user,(uint) strlen(user));
col_privs->field[3]->store(tname,strlen(tname)); col_privs->field[3]->store(tname,(uint) strlen(tname));
key_len=(col_privs->field[0]->pack_length()+ key_len=(col_privs->field[0]->pack_length()+
col_privs->field[1]->pack_length()+ col_privs->field[1]->pack_length()+
col_privs->field[2]->pack_length()+ col_privs->field[2]->pack_length()+
@ -1307,9 +1307,9 @@ static int replace_column_table(GRANT_TABLE *g_t,
DBUG_ENTER("replace_column_table"); DBUG_ENTER("replace_column_table");
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(db,strlen(db)); table->field[1]->store(db,(uint) strlen(db));
table->field[2]->store(combo.user.str,combo.user.length); table->field[2]->store(combo.user.str,combo.user.length);
table->field[3]->store(table_name,strlen(table_name)); table->field[3]->store(table_name,(uint) strlen(table_name));
key_length=(table->field[0]->pack_length()+ table->field[1]->pack_length()+ key_length=(table->field[0]->pack_length()+ table->field[1]->pack_length()+
table->field[2]->pack_length()+ table->field[3]->pack_length()); table->field[2]->pack_length()+ table->field[3]->pack_length());
key_copy(key,table,0,key_length); key_copy(key,table,0,key_length);
@ -1483,9 +1483,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
restore_record(table,2); // Get empty record restore_record(table,2); // Get empty record
table->field[0]->store(combo.host.str,combo.host.length); table->field[0]->store(combo.host.str,combo.host.length);
table->field[1]->store(db,strlen(db)); table->field[1]->store(db,(uint) strlen(db));
table->field[2]->store(combo.user.str,combo.user.length); table->field[2]->store(combo.user.str,combo.user.length);
table->field[3]->store(table_name,strlen(table_name)); table->field[3]->store(table_name,(uint) strlen(table_name));
store_record(table,1); // store at pos 1 store_record(table,1); // store at pos 1
if (table->file->index_read_idx(table->record[0],0, if (table->file->index_read_idx(table->record[0],0,
@ -1530,7 +1530,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
} }
} }
table->field[4]->store(grantor,strlen(grantor)); table->field[4]->store(grantor,(uint) strlen(grantor));
table->field[6]->store((longlong) store_table_rights); table->field[6]->store((longlong) store_table_rights);
table->field[7]->store((longlong) store_col_rights); table->field[7]->store((longlong) store_col_rights);
rights=fix_rights_for_table(store_table_rights); rights=fix_rights_for_table(store_table_rights);
@ -2150,7 +2150,7 @@ bool check_grant_all_columns(THD *thd,uint want_access, TABLE *table)
for (ptr=table->field; (field= *ptr) ; ptr++) for (ptr=table->field; (field= *ptr) ; ptr++)
{ {
grant_column=column_hash_search(grant_table, field->field_name, grant_column=column_hash_search(grant_table, field->field_name,
strlen(field->field_name)); (uint) strlen(field->field_name));
if (!grant_column || (~grant_column->rights & want_access)) if (!grant_column || (~grant_column->rights & want_access))
goto err; goto err;
} }
@ -2253,7 +2253,7 @@ uint get_column_grant(THD *thd, TABLE_LIST *table, Field *field)
else else
{ {
grant_column=column_hash_search(grant_table, field->field_name, grant_column=column_hash_search(grant_table, field->field_name,
strlen(field->field_name)); (uint) strlen(field->field_name));
if (!grant_column) if (!grant_column)
priv=table->grant.privilege; priv=table->grant.privilege;
else else

View File

@ -352,14 +352,19 @@ void field_real::add()
if ((decs = decimals()) == NOT_FIXED_DEC) if ((decs = decimals()) == NOT_FIXED_DEC)
{ {
sprintf(buff, "%g", num); sprintf(buff, "%g", num);
length = strlen(buff); length = (uint) strlen(buff);
if (rint(num) != num) if (rint(num) != num)
max_notzero_dec_len = 1; max_notzero_dec_len = 1;
} }
else else
{ {
#ifdef HAVE_SNPRINTF
snprintf(buff, sizeof(buff), "%-.*f", (int) decs, num);
#else
sprintf(buff, "%-.*f", (int) decs, num); sprintf(buff, "%-.*f", (int) decs, num);
length = strlen(buff); #endif
length = (uint) strlen(buff);
// We never need to check further than this // We never need to check further than this
end = buff + length - 1 - decs + max_notzero_dec_len; end = buff + length - 1 - decs + max_notzero_dec_len;
@ -686,7 +691,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
sprintf(buff, "INT(%d)", num_info.integers); sprintf(buff, "INT(%d)", num_info.integers);
else else
sprintf(buff, "BIGINT(%d)", num_info.integers); sprintf(buff, "BIGINT(%d)", num_info.integers);
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
if (ev_num_info.llval >= 0 && ev_num_info.min_dval >= 0) if (ev_num_info.llval >= 0 && ev_num_info.min_dval >= 0)
answer->append(" UNSIGNED"); answer->append(" UNSIGNED");
if (num_info.zerofill) if (num_info.zerofill)
@ -704,12 +709,12 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
else if ((max_length * (total_rows - nulls)) < (sum + total_rows)) else if ((max_length * (total_rows - nulls)) < (sum + total_rows))
{ {
sprintf(buff, "CHAR(%d)", (int) max_length); sprintf(buff, "CHAR(%d)", (int) max_length);
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
} }
else else
{ {
sprintf(buff, "VARCHAR(%d)", (int) max_length); sprintf(buff, "VARCHAR(%d)", (int) max_length);
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
} }
} }
else if (max_length < (1L << 16)) else if (max_length < (1L << 16))
@ -756,7 +761,7 @@ void field_real::get_opt_type(String *answer,
sprintf(buff, "INT(%d)", (int) max_length - (item->decimals + 1)); sprintf(buff, "INT(%d)", (int) max_length - (item->decimals + 1));
else else
sprintf(buff, "BIGINT(%d)", (int) max_length - (item->decimals + 1)); sprintf(buff, "BIGINT(%d)", (int) max_length - (item->decimals + 1));
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
if (min_arg >= 0) if (min_arg >= 0)
answer->append(" UNSIGNED"); answer->append(" UNSIGNED");
} }
@ -768,7 +773,7 @@ void field_real::get_opt_type(String *answer,
else else
sprintf(buff, "DOUBLE(%d,%d)", (int) max_length - (item->decimals + 1), sprintf(buff, "DOUBLE(%d,%d)", (int) max_length - (item->decimals + 1),
max_notzero_dec_len); max_notzero_dec_len);
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
} }
// if item is FIELD_ITEM, it _must_be_ Field_num in this class // if item is FIELD_ITEM, it _must_be_ Field_num in this class
if (item->type() == Item::FIELD_ITEM && if (item->type() == Item::FIELD_ITEM &&
@ -797,7 +802,7 @@ void field_longlong::get_opt_type(String *answer,
sprintf(buff, "INT(%d)", (int) max_length); sprintf(buff, "INT(%d)", (int) max_length);
else else
sprintf(buff, "BIGINT(%d)", (int) max_length); sprintf(buff, "BIGINT(%d)", (int) max_length);
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
if (min_arg >= 0) if (min_arg >= 0)
answer->append(" UNSIGNED"); answer->append(" UNSIGNED");
@ -826,7 +831,7 @@ void field_ulonglong::get_opt_type(String *answer,
else else
sprintf(buff, "BIGINT(%d) UNSIGNED", (int) max_length); sprintf(buff, "BIGINT(%d) UNSIGNED", (int) max_length);
// if item is FIELD_ITEM, it _must_be_ Field_num in this class // if item is FIELD_ITEM, it _must_be_ Field_num in this class
answer->append(buff, strlen(buff)); answer->append(buff, (uint) strlen(buff));
if (item->type() == Item::FIELD_ITEM && if (item->type() == Item::FIELD_ITEM &&
// a single number shouldn't be zerofill // a single number shouldn't be zerofill
max_length != 1 && max_length != 1 &&

View File

@ -51,7 +51,7 @@ typedef struct st_tree_info
uint check_ulonglong(const char *str, uint length); uint check_ulonglong(const char *str, uint length);
bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num); bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num);
bool test_if_number(NUM_INFO *info, const char *str, uint strlen); bool test_if_number(NUM_INFO *info, const char *str, uint str_len);
int compare_double(const double *s, const double *t); int compare_double(const double *s, const double *t);
int compare_longlong(const longlong *s, const longlong *t); int compare_longlong(const longlong *s, const longlong *t);
int compare_ulonglong(const ulonglong *s, const ulonglong *t); int compare_ulonglong(const ulonglong *s, const ulonglong *t);

View File

@ -127,7 +127,7 @@ void table_cache_init(void)
void table_cache_free(void) void table_cache_free(void)
{ {
DBUG_ENTER("table_cache_free"); DBUG_ENTER("table_cache_free");
close_cached_tables(0); close_cached_tables((THD*) 0,0,(TABLE_LIST*) 0);
if (!open_cache.records) // Safety first if (!open_cache.records) // Safety first
hash_free(&open_cache); hash_free(&open_cache);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -373,7 +373,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
else else
p = log_file_name; p = log_file_name;
uint ident_len = strlen(p); uint ident_len = (uint) strlen(p);
ulong event_len = ident_len + sizeof(header); ulong event_len = ident_len + sizeof(header);
int4store(header + 5, event_len); int4store(header + 5, event_len);
packet->append(header, sizeof(header)); packet->append(header, sizeof(header));
@ -433,8 +433,10 @@ send_fields(THD *thd,List<Item> &list,uint flag)
if (convert) if (convert)
{ {
if (convert->store(packet,field.table_name,strlen(field.table_name)) || if (convert->store(packet,field.table_name,
convert->store(packet,field.col_name, strlen(field.col_name)) || (uint) strlen(field.table_name)) ||
convert->store(packet,field.col_name,
(uint) strlen(field.col_name)) ||
packet->realloc(packet->length()+10)) packet->realloc(packet->length()+10))
goto err; goto err;
} }
@ -531,35 +533,50 @@ void free_io_cache(TABLE *table)
/* Close all tables which aren't in use by any thread */ /* Close all tables which aren't in use by any thread */
bool close_cached_tables(bool if_wait_for_refresh) bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
TABLE_LIST *tables)
{ {
bool result=0; bool result=0;
DBUG_ENTER("close_cached_tables"); DBUG_ENTER("close_cached_tables");
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
while (unused_tables) if (!tables)
{ {
while (unused_tables)
{
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
if (hash_delete(&open_cache,(byte*) unused_tables)) if (hash_delete(&open_cache,(byte*) unused_tables))
printf("Warning: Couldn't delete open table from hash\n"); printf("Warning: Couldn't delete open table from hash\n");
#else #else
VOID(hash_delete(&open_cache,(byte*) unused_tables)); VOID(hash_delete(&open_cache,(byte*) unused_tables));
#endif #endif
}
if (!open_cache.records)
{
end_key_cache(); /* No tables in memory */
key_cache_used=0;
}
refresh_version++; // Force close of open tables
} }
if (!open_cache.records) else
{ {
end_key_cache(); /* No tables in memory */ bool found=0;
key_cache_used=0; for (TABLE_LIST *table=tables ; table ; table=table->next)
{
if (remove_table_from_cache(thd, table->db, table->name))
found=1;
}
if (!found)
if_wait_for_refresh=0; // Nothing to wait for
} }
refresh_version++; // Force close of open tables
if (if_wait_for_refresh) if (if_wait_for_refresh)
{ {
/* /*
If there is any table that has a lower refresh_version, wait until If there is any table that has a lower refresh_version, wait until
this is closed (or this thread is killed) before returning this is closed (or this thread is killed) before returning
*/ */
kill_delayed_threads(); if (!tables)
THD *thd=current_thd; kill_delayed_threads();
pthread_mutex_lock(&thd->mysys_var->mutex); pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= &LOCK_open; thd->mysys_var->current_mutex= &LOCK_open;
thd->mysys_var->current_cond= &COND_refresh; thd->mysys_var->current_cond= &COND_refresh;
@ -737,7 +754,8 @@ bool rename_temporary_table(TABLE *table, const char *db,
{ {
char *key; char *key;
if (!(key=(char*) alloc_root(&table->mem_root, if (!(key=(char*) alloc_root(&table->mem_root,
strlen(db)+ strlen(table_name)+2))) (uint) strlen(db)+
(uint) strlen(table_name)+2)))
return 1; /* purecov: inspected */ return 1; /* purecov: inspected */
table->key_length=(uint) table->key_length=(uint)
(strmov((table->real_name=strmov(table->table_cache_key=key, (strmov((table->real_name=strmov(table->table_cache_key=key,
@ -804,7 +822,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
/* /*
When we call the following function we must have a lock on When we call the following function we must have a lock on
LOCK_OPEN ; This lock will be freed on return LOCK_OPEN ; This lock will be unlocked on return.
*/ */
void wait_for_refresh(THD *thd) void wait_for_refresh(THD *thd)
@ -946,8 +964,8 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
// remember the name of the non-existent table // remember the name of the non-existent table
// so we can try to download it from the master // so we can try to download it from the master
{ {
int table_name_len = strlen(table_name); int table_name_len = (uint) strlen(table_name);
int db_len = strlen(db); int db_len = (uint) strlen(db);
thd->last_nx_db = alloc_root(glob_alloc,db_len + table_name_len + 2); thd->last_nx_db = alloc_root(glob_alloc,db_len + table_name_len + 2);
if(thd->last_nx_db) if(thd->last_nx_db)
{ {
@ -987,7 +1005,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
/* Fix alias if table name changes */ /* Fix alias if table name changes */
if (strcmp(table->table_name,alias)) if (strcmp(table->table_name,alias))
{ {
uint length=strlen(alias)+1; uint length=(uint) strlen(alias)+1;
table->table_name= (char*) my_realloc(table->table_name,length, table->table_name= (char*) my_realloc(table->table_name,length,
MYF(MY_WME)); MYF(MY_WME));
memcpy(table->table_name,alias,length); memcpy(table->table_name,alias,length);
@ -1509,8 +1527,8 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
{ {
TABLE *tmp_table; TABLE *tmp_table;
DBUG_ENTER("open_temporary_table"); DBUG_ENTER("open_temporary_table");
if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+strlen(db)+ if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+(uint) strlen(db)+
strlen(table_name)+2, (uint) strlen(table_name)+2,
MYF(MY_WME)))) MYF(MY_WME))))
DBUG_RETURN(0); /* purecov: inspected */ DBUG_RETURN(0); /* purecov: inspected */
@ -1611,7 +1629,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
const char *db=item->db_name; const char *db=item->db_name;
const char *table_name=item->table_name; const char *table_name=item->table_name;
const char *name=item->field_name; const char *name=item->field_name;
uint length=strlen(name); uint length=(uint) strlen(name);
if (table_name) if (table_name)
{ /* Qualified field */ { /* Qualified field */

View File

@ -266,7 +266,7 @@ select_export::prepare(List<Item> &list)
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS #ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
option|=1; // Force use of db directory option|=1; // Force use of db directory
#endif #endif
if (strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN) if ((uint) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN)
strmake(path,exchange->file_name,FN_REFLEN-1); strmake(path,exchange->file_name,FN_REFLEN-1);
(void) fn_format(path,exchange->file_name, thd->db ? thd->db : "", "", (void) fn_format(path,exchange->file_name, thd->db ? thd->db : "", "",
option); option);

View File

@ -45,7 +45,7 @@ typedef struct st_log_info
typedef struct st_master_info typedef struct st_master_info
{ {
char log_file_name[FN_REFLEN]; char log_file_name[FN_REFLEN];
ulong pos; ulonglong pos;
FILE* file; // we keep the file open, so we need to remember the file pointer FILE* file; // we keep the file open, so we need to remember the file pointer
// the variables below are needed because we can change masters on the fly // the variables below are needed because we can change masters on the fly
@ -58,7 +58,7 @@ typedef struct st_master_info
bool inited; bool inited;
st_master_info():inited(0) { host[0] = 0; user[0] = 0; password[0] = 0;} st_master_info():inited(0) { host[0] = 0; user[0] = 0; password[0] = 0;}
inline void inc_pos(ulong val) inline void inc_pos(ulonglong val)
{ {
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
pos += val; pos += val;
@ -66,7 +66,7 @@ typedef struct st_master_info
} }
// thread safe read of position - not needed if we are in the slave thread, // thread safe read of position - not needed if we are in the slave thread,
// but required otherwise // but required otherwise
inline void read_pos(ulong& var) inline void read_pos(ulonglong& var)
{ {
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
var = pos; var = pos;
@ -470,7 +470,7 @@ class Table_ident :public Sql_alloc {
} }
inline Table_ident(LEX_STRING table_arg) :table(table_arg) {db.str=0;} inline Table_ident(LEX_STRING table_arg) :table(table_arg) {db.str=0;}
inline void change_db(char *db_name) inline void change_db(char *db_name)
{ db.str= db_name; db.length=strlen(db_name); } { db.str= db_name; db.length=(uint) strlen(db_name); }
}; };
// this is needed for user_vars hash // this is needed for user_vars hash

View File

@ -458,7 +458,7 @@ int handle_bootstrap(THD *thd,FILE *file)
char *buff= (char*) thd->net.buff; char *buff= (char*) thd->net.buff;
while (fgets(buff, thd->net.max_packet, file)) while (fgets(buff, thd->net.max_packet, file))
{ {
uint length=strlen(buff); uint length=(uint) strlen(buff);
while (length && (isspace(buff[length-1]) || buff[length-1] == ';')) while (length && (isspace(buff[length-1]) || buff[length-1] == ';'))
length--; length--;
buff[length]=0; buff[length]=0;
@ -726,7 +726,7 @@ bool do_command(THD *thd)
if (check_access(thd,RELOAD_ACL,any_db)) if (check_access(thd,RELOAD_ACL,any_db))
break; break;
mysql_log.write(command,NullS); mysql_log.write(command,NullS);
if (reload_acl_and_cache(options)) if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0))
send_error(net,0); send_error(net,0);
else else
send_eof(net); send_eof(net);
@ -765,7 +765,7 @@ bool do_command(THD *thd)
sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK", sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK",
(lCurMemory+1023L)/1024L,(lMaxMemory+1023L)/1024L); (lCurMemory+1023L)/1024L,(lMaxMemory+1023L)/1024L);
#endif #endif
VOID(my_net_write(net, buff,strlen(buff))); VOID(my_net_write(net, buff,(uint) strlen(buff)));
VOID(net_flush(net)); VOID(net_flush(net));
break; break;
} }
@ -1131,15 +1131,32 @@ mysql_execute_command(void)
} }
#endif #endif
case SQLCOM_RENAME_TABLE: case SQLCOM_RENAME_TABLE:
if (check_db_used(thd,tables) || {
check_table_access(thd,ALTER_ACL,tables)) TABLE_LIST *table;
if (check_db_used(thd,tables))
goto error; goto error;
for (table=tables ; table ; table=table->next->next)
{
if (check_access(thd, ALTER_ACL, table->db, &table->grant.privilege) ||
check_access(thd, INSERT_ACL | CREATE_ACL, table->next->db,
&table->next->grant.privilege))
goto error;
if (grant_option)
{
if (check_grant(thd,ALTER_ACL,table) ||
(!test_all_bits(table->next->grant.privilege,
INSERT_ACL | CREATE_ACL) &&
check_grant(thd,INSERT_ACL | CREATE_ACL, table->next)))
goto error;
}
}
if (mysql_rename_tables(thd,tables)) if (mysql_rename_tables(thd,tables))
res= -1; res= -1;
break; break;
}
case SQLCOM_SHOW_CREATE: case SQLCOM_SHOW_CREATE:
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */ send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
#else #else
{ {
@ -1623,9 +1640,9 @@ mysql_execute_command(void)
break; break;
} }
case SQLCOM_FLUSH: case SQLCOM_FLUSH:
if (check_access(thd,RELOAD_ACL,any_db)) if (check_access(thd,RELOAD_ACL,any_db) || check_db_used(thd, tables))
goto error; goto error;
if (reload_acl_and_cache(lex->type)) if (reload_acl_and_cache(thd, lex->type, tables))
send_error(&thd->net,0); send_error(&thd->net,0);
else else
send_ok(&thd->net); send_ok(&thd->net);
@ -2099,7 +2116,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->interval=interval; new_field->interval=interval;
new_field->length=0; new_field->length=0;
for (const char **pos=interval->type_names; *pos ; pos++) for (const char **pos=interval->type_names; *pos ; pos++)
new_field->length+=strlen(*pos)+1; new_field->length+=(uint) strlen(*pos)+1;
new_field->length--; new_field->length--;
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
if (default_value) if (default_value)
@ -2120,10 +2137,10 @@ bool add_field_to_list(char *field_name, enum_field_types type,
{ {
new_field->interval=interval; new_field->interval=interval;
new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe new_field->pack_length=interval->count < 256 ? 1 : 2; // Should be safe
new_field->length=strlen(interval->type_names[0]); new_field->length=(uint) strlen(interval->type_names[0]);
for (const char **pos=interval->type_names+1; *pos ; pos++) for (const char **pos=interval->type_names+1; *pos ; pos++)
{ {
uint length=strlen(*pos); uint length=(uint) strlen(*pos);
set_if_bigger(new_field->length,length); set_if_bigger(new_field->length,length);
} }
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1); set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
@ -2196,7 +2213,7 @@ static void remove_escape(char *name)
{ {
char *to; char *to;
#ifdef USE_MB #ifdef USE_MB
char *strend=name+strlen(name); char *strend=name+(uint) strlen(name);
#endif #endif
for (to=name; *name ; name++) for (to=name; *name ; name++)
{ {
@ -2329,7 +2346,7 @@ static bool check_dup(THD *thd,const char *db,const char *name,
return 0; return 0;
} }
bool reload_acl_and_cache(uint options) bool reload_acl_and_cache(THD *thd, uint options, TABLE_LIST *tables)
{ {
bool result=0; bool result=0;
@ -2351,12 +2368,12 @@ bool reload_acl_and_cache(uint options)
} }
if (options & (REFRESH_TABLES | REFRESH_READ_LOCK)) if (options & (REFRESH_TABLES | REFRESH_READ_LOCK))
{ {
if ((options & REFRESH_READ_LOCK) && ! current_thd->global_read_lock) if ((options & REFRESH_READ_LOCK) && thd && ! thd->global_read_lock)
{ {
current_thd->global_read_lock=1; thd->global_read_lock=1;
thread_safe_increment(global_read_lock,&LOCK_open); thread_safe_increment(global_read_lock,&LOCK_open);
} }
result=close_cached_tables((options & REFRESH_FAST) ? 0 : 1); result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables);
} }
if (options & REFRESH_HOSTS) if (options & REFRESH_HOSTS)
hostname_cache_refresh(); hostname_cache_refresh();

View File

@ -21,8 +21,8 @@
#include "mysql_priv.h" #include "mysql_priv.h"
static TABLE_LIST *mysql_rename_tables(THD *thd, TABLE_LIST *table_list, static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool skip_error); bool skip_error);
/* /*
Every second entry in the table_list is the original name and every Every second entry in the table_list is the original name and every
@ -58,7 +58,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list)
if (!got_all_locks && wait_for_locked_table_names(thd,table_list)) if (!got_all_locks && wait_for_locked_table_names(thd,table_list))
goto end; goto end;
if (!(ren_table=mysql_rename_tables(thd,table_list,0))) if (!(ren_table=rename_tables(thd,table_list,0)))
error=0; error=0;
end: end:
@ -66,25 +66,24 @@ end:
{ {
/* Rename didn't succeed; rename back the tables in reverse order */ /* Rename didn't succeed; rename back the tables in reverse order */
TABLE_LIST *prev=0,*table; TABLE_LIST *prev=0,*table;
/* /* Reverse the table list */
Reverse the table list ; Note that we need to handle the case that
every second entry must stay in place in respect to the previous
*/
while (table_list) while (table_list)
{ {
TABLE_LIST *next=table_list->next->next; TABLE_LIST *next=table_list->next;
table_list->next->next=prev; table_list->next=prev;
prev=table_list; prev=table_list;
table_list=next; table_list=next;
} }
table_list=prev; table_list=prev;
/* Find the last renamed table */ /* Find the last renamed table */
for (table=table_list ; table->next != ren_table ; for (table=table_list ;
table->next != ren_table ;
table=table->next->next) ; table=table->next->next) ;
table=table->next->next; // Skipp error table table=table->next->next; // Skipp error table
/* Revert to old names */ /* Revert to old names */
mysql_rename_tables(thd, table, 1); rename_tables(thd, table, 1);
/* Note that lock_table == 0 here, so the unlock loop will work */ /* Note that lock_table == 0 here, so the unlock loop will work */
} }
if (!error) if (!error)
@ -92,6 +91,7 @@ end:
mysql_update_log.write(thd->query,thd->query_length); mysql_update_log.write(thd->query,thd->query_length);
Query_log_event qinfo(thd, thd->query); Query_log_event qinfo(thd, thd->query);
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
send_ok(&thd->net);
} }
for (TABLE_LIST *table=table_list ; table != lock_table ; table=table->next) for (TABLE_LIST *table=table_list ; table != lock_table ; table=table->next)
unlock_table_name(thd,table); unlock_table_name(thd,table);
@ -103,30 +103,45 @@ end:
/* /*
Rename all tables in list; Return pointer to wrong entry if something goes Rename all tables in list; Return pointer to wrong entry if something goes
wrong. wrong. Note that the table_list may be empty!
*/ */
static TABLE_LIST * static TABLE_LIST *
mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error) rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
{ {
TABLE_LIST *ren_table; TABLE_LIST *ren_table,*new_table;
for (ren_table=table_list ; ren_table ; ren_table=ren_table->next) DBUG_ENTER("rename_tables");
for (ren_table=table_list ; ren_table ; ren_table=new_table->next)
{ {
db_type table_type; db_type table_type;
char name[FN_REFLEN]; char name[FN_REFLEN];
TABLE_LIST *new_table=ren_table->next; new_table=ren_table->next;
sprintf(name,"%s/%s/%s%s",mysql_data_home,
new_table->db,new_table->name,
reg_ext);
if (!access(name,F_OK))
{
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),name);
return ren_table; // This can't be skipped
}
sprintf(name,"%s/%s/%s%s",mysql_data_home, sprintf(name,"%s/%s/%s%s",mysql_data_home,
ren_table->db,ren_table->name, ren_table->db,ren_table->name,
reg_ext); reg_ext);
if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN || if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN)
mysql_rename_table(table_type, {
ren_table->db, ren_table->name, my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
new_table->db, new_table->name)) if (!skip_error)
return ren_table;
}
else if (mysql_rename_table(table_type,
ren_table->db, ren_table->name,
new_table->db, new_table->name))
{ {
if (!skip_error) if (!skip_error)
return ren_table; return ren_table;
} }
} }
return 0; DBUG_RETURN(0);
} }

View File

@ -55,7 +55,7 @@ mysqld_show_dbs(THD *thd,const char *wild)
char *file_name; char *file_name;
DBUG_ENTER("mysqld_show_dbs"); DBUG_ENTER("mysqld_show_dbs");
field->name=(char*) thd->alloc(20+ (wild ? strlen(wild)+4: 0)); field->name=(char*) thd->alloc(20+ (wild ? (uint) strlen(wild)+4: 0));
field->max_length=NAME_LEN; field->max_length=NAME_LEN;
end=strmov(field->name,"Database"); end=strmov(field->name,"Database");
if (wild && wild[0]) if (wild && wild[0])
@ -92,7 +92,7 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
char *file_name; char *file_name;
DBUG_ENTER("mysqld_show_tables"); DBUG_ENTER("mysqld_show_tables");
field->name=(char*) thd->alloc(20+strlen(db)+(wild ? strlen(wild)+4:0)); field->name=(char*) thd->alloc(20+(uint) strlen(db)+(wild ? (uint) strlen(wild)+4:0));
end=strxmov(field->name,"Tables_in_",db,NullS); end=strxmov(field->name,"Tables_in_",db,NullS);
if (wild && wild[0]) if (wild && wild[0])
strxmov(end," (",wild,")",NullS); strxmov(end," (",wild,")",NullS);
@ -405,7 +405,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
#ifdef NOT_USED #ifdef NOT_USED
if (thd->col_access & TABLE_ACLS || if (thd->col_access & TABLE_ACLS ||
! check_grant_column(thd,table,field->field_name, ! check_grant_column(thd,table,field->field_name,
strlen(field->field_name),1)) (uint) strlen(field->field_name),1))
#endif #endif
{ {
byte *pos; byte *pos;
@ -899,7 +899,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->query=0; thd_info->query=0;
if (tmp->query) if (tmp->query)
{ {
uint length=strlen(tmp->query); uint length=(uint) strlen(tmp->query);
if (length > max_query_length) if (length > max_query_length)
length=max_query_length; length=max_query_length;
thd_info->query=(char*) thd->memdup(tmp->query,length+1); thd_info->query=(char*) thd->memdup(tmp->query,length+1);

View File

@ -126,7 +126,7 @@ bool String::set(double num,uint decimals)
if (decimals >= NOT_FIXED_DEC) if (decimals >= NOT_FIXED_DEC)
{ {
sprintf(buff,"%.14g",num); // Enough for a DATETIME sprintf(buff,"%.14g",num); // Enough for a DATETIME
return copy(buff,strlen(buff)); return copy(buff,(uint) strlen(buff));
} }
#ifdef HAVE_FCONVERT #ifdef HAVE_FCONVERT
int decpt,sign; int decpt,sign;
@ -141,7 +141,7 @@ bool String::set(double num,uint decimals)
buff[0]='-'; buff[0]='-';
pos=buff; pos=buff;
} }
return copy(pos,strlen(pos)); return copy(pos,(uint) strlen(pos));
} }
if (alloc((uint32) ((uint32) decpt+3+decimals))) if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE; return TRUE;
@ -185,12 +185,12 @@ end:
str_length=(uint32) (to-Ptr); str_length=(uint32) (to-Ptr);
return FALSE; return FALSE;
#else #else
#ifdef HAVE_SNPRINTF_ #ifdef HAVE_SNPRINTF
snprintf(buff,sizeof(buff), "%.*f",(int) decimals,num); snprintf(buff,sizeof(buff), "%.*f",(int) decimals,num);
#else #else
sprintf(buff,"%.*f",(int) decimals,num); sprintf(buff,"%.*f",(int) decimals,num);
#endif #endif
return copy(buff,strlen(buff)); return copy(buff,(uint) strlen(buff));
#endif #endif
} }
@ -259,7 +259,7 @@ bool String::append(const String &s)
bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s,uint32 arg_length)
{ {
if (!arg_length) // Default argument if (!arg_length) // Default argument
arg_length=strlen(s); arg_length=(uint) strlen(s);
if (realloc(str_length+arg_length)) if (realloc(str_length+arg_length))
return TRUE; return TRUE;
memcpy(Ptr+str_length,s,arg_length); memcpy(Ptr+str_length,s,arg_length);

View File

@ -35,7 +35,7 @@ public:
String(uint32 length_arg) String(uint32 length_arg)
{ alloced=0; Alloced_length=0; (void) real_alloc(length_arg); } { alloced=0; Alloced_length=0; (void) real_alloc(length_arg); }
String(const char *str) String(const char *str)
{ Ptr=(char*) str; str_length=strlen(str); Alloced_length=0; alloced=0;} { Ptr=(char*) str; str_length=(uint) strlen(str); Alloced_length=0; alloced=0;}
String(const char *str,uint32 len) String(const char *str,uint32 len)
{ Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0;} { Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0;}
String(char *str,uint32 len) String(char *str,uint32 len)

View File

@ -653,25 +653,25 @@ mysql_rename_table(enum db_type base,
{ {
char from[FN_REFLEN],to[FN_REFLEN]; char from[FN_REFLEN],to[FN_REFLEN];
handler *file=get_new_handler((TABLE*) 0, base); handler *file=get_new_handler((TABLE*) 0, base);
bool error=0; int error=0;
DBUG_ENTER("mysql_rename_table"); DBUG_ENTER("mysql_rename_table");
(void) sprintf(from,"%s/%s/%s",mysql_data_home,old_db,old_name); (void) sprintf(from,"%s/%s/%s",mysql_data_home,old_db,old_name);
(void) sprintf(to,"%s/%s/%s",mysql_data_home,new_db,new_name); (void) sprintf(to,"%s/%s/%s",mysql_data_home,new_db,new_name);
fn_format(from,from,"","",4); fn_format(from,from,"","",4);
fn_format(to,to, "","",4); fn_format(to,to, "","",4);
if (file->rename_table((const char*) from,(const char *) to)) if (!(error=file->rename_table((const char*) from,(const char *) to)))
error=1;
else
{ {
if (rename_file_ext(from,to,reg_ext)) if (rename_file_ext(from,to,reg_ext))
{ {
error=1; error=my_errno;
/* Restore old file name */ /* Restore old file name */
file->rename_table((const char*) to,(const char *) from); file->rename_table((const char*) to,(const char *) from);
} }
} }
delete file; delete file;
DBUG_RETURN(error); if (error)
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
DBUG_RETURN(error != 0);
} }
/* /*

View File

@ -263,7 +263,7 @@ udf_func *find_udf(const char *name,uint length,bool mark_used)
/* TODO: This should be changed to reader locks someday! */ /* TODO: This should be changed to reader locks someday! */
pthread_mutex_lock(&THR_LOCK_udf); pthread_mutex_lock(&THR_LOCK_udf);
udf=(udf_func*) hash_search(&udf_hash,name, udf=(udf_func*) hash_search(&udf_hash,name,
length ? length : strlen(name)); length ? length : (uint) strlen(name));
if (mark_used) if (mark_used)
udf->usage_count++; udf->usage_count++;
pthread_mutex_unlock(&THR_LOCK_udf); pthread_mutex_unlock(&THR_LOCK_udf);
@ -299,7 +299,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl,
return 0; return 0;
bzero((char*) tmp,sizeof(*tmp)); bzero((char*) tmp,sizeof(*tmp));
tmp->name = name; tmp->name = name;
tmp->name_length=strlen(tmp->name); tmp->name_length=(uint) strlen(tmp->name);
tmp->dl = dl; tmp->dl = dl;
tmp->returns = ret; tmp->returns = ret;
tmp->type = type; tmp->type = type;
@ -395,7 +395,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
restore_record(table,2); // Get default values for fields restore_record(table,2); // Get default values for fields
table->field[0]->store(u_d->name, u_d->name_length); table->field[0]->store(u_d->name, u_d->name_length);
table->field[1]->store((longlong) u_d->returns); table->field[1]->store((longlong) u_d->returns);
table->field[2]->store(u_d->dl,strlen(u_d->dl)); table->field[2]->store(u_d->dl,(uint) strlen(u_d->dl));
if (table->fields >= 4) // If not old func format if (table->fields >= 4) // If not old func format
table->field[3]->store((longlong) u_d->type); table->field[3]->store((longlong) u_d->type);
error = table->file->write_row(table->record[0]); error = table->file->write_row(table->record[0]);
@ -430,7 +430,7 @@ int mysql_drop_function(THD *thd,const char *udf_name)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
pthread_mutex_lock(&THR_LOCK_udf); pthread_mutex_lock(&THR_LOCK_udf);
if (!(udf=(udf_func*) hash_search(&udf_hash,udf_name, strlen(udf_name)))) if (!(udf=(udf_func*) hash_search(&udf_hash,udf_name, (uint) strlen(udf_name))))
{ {
net_printf(&thd->net, ER_FUNCTION_NOT_DEFINED, udf_name); net_printf(&thd->net, ER_FUNCTION_NOT_DEFINED, udf_name);
goto err; goto err;
@ -445,7 +445,7 @@ int mysql_drop_function(THD *thd,const char *udf_name)
if (!(table = open_ltable(thd,&tables,TL_WRITE))) if (!(table = open_ltable(thd,&tables,TL_WRITE)))
goto err; goto err;
if (!table->file->index_read_idx(table->record[0],0,(byte*) udf_name, if (!table->file->index_read_idx(table->record[0],0,(byte*) udf_name,
strlen(udf_name), (uint) strlen(udf_name),
HA_READ_KEY_EXACT)) HA_READ_KEY_EXACT))
{ {
int error; int error;

View File

@ -505,7 +505,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
flush_options flush_option insert_lock_option replace_lock_option flush_options flush_option insert_lock_option replace_lock_option
equal optional_braces opt_key_definition key_usage_list2 equal optional_braces opt_key_definition key_usage_list2
opt_mi_check_type opt_to mi_check_types normal_join opt_mi_check_type opt_to mi_check_types normal_join
table_to_table_list table_to_table table_to_table_list table_to_table opt_table_list
END_OF_INPUT END_OF_INPUT
%type <NONE> %type <NONE>
@ -590,7 +590,7 @@ master_def:
Lex->mi.log_file_name = $3.str; Lex->mi.log_file_name = $3.str;
} }
| |
MASTER_PORT_SYM EQ ULONGLONG_NUM MASTER_PORT_SYM EQ ULONG_NUM
{ {
Lex->mi.port = $3; Lex->mi.port = $3;
} }
@ -600,7 +600,7 @@ master_def:
Lex->mi.pos = $3; Lex->mi.pos = $3;
} }
| |
MASTER_CONNECT_RETRY_SYM EQ ULONGLONG_NUM MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
{ {
Lex->mi.connect_retry = $3; Lex->mi.connect_retry = $3;
} }
@ -1151,8 +1151,8 @@ table_to_table_list:
table_to_table: table_to_table:
table_ident TO_SYM table_ident table_ident TO_SYM table_ident
{ if (add_table_to_list($1,NULL,TL_IGNORE) || { if (!add_table_to_list($1,NULL,TL_IGNORE) ||
add_table_to_list($3,NULL,TL_IGNORE)) !add_table_to_list($3,NULL,TL_IGNORE))
YYABORT; YYABORT;
} }
@ -2160,7 +2160,7 @@ flush_options:
| flush_option | flush_option
flush_option: flush_option:
TABLES { Lex->type|= REFRESH_TABLES; } TABLES { Lex->type|= REFRESH_TABLES; } opt_table_list
| TABLES WITH READ_SYM LOCK_SYM { Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK; } | TABLES WITH READ_SYM LOCK_SYM { Lex->type|= REFRESH_TABLES | REFRESH_READ_LOCK; }
| HOSTS_SYM { Lex->type|= REFRESH_HOSTS; } | HOSTS_SYM { Lex->type|= REFRESH_HOSTS; }
| PRIVILEGES { Lex->type|= REFRESH_GRANT; } | PRIVILEGES { Lex->type|= REFRESH_GRANT; }
@ -2169,6 +2169,10 @@ flush_option:
| SLAVE { Lex->type|= REFRESH_SLAVE; } | SLAVE { Lex->type|= REFRESH_SLAVE; }
| MASTER_SYM { Lex->type|= REFRESH_MASTER; } | MASTER_SYM { Lex->type|= REFRESH_MASTER; }
opt_table_list:
/* empty */ {}
| table_list {}
/* kill threads */ /* kill threads */
kill: kill:

View File

@ -33,7 +33,7 @@ static uint find_field(TABLE *form,uint start,uint length);
static byte* get_field_name(Field *buff,uint *length, static byte* get_field_name(Field *buff,uint *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
*length= strlen(buff->field_name); *length= (uint) strlen(buff->field_name);
return (byte*) buff->field_name; return (byte*) buff->field_name;
} }
@ -670,7 +670,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
uchar *pos; uchar *pos;
DBUG_ENTER("make_new_entry"); DBUG_ENTER("make_new_entry");
length=strlen(newname)+1; length=(uint) strlen(newname)+1;
n_length=uint2korr(fileinfo+4); n_length=uint2korr(fileinfo+4);
maxlength=uint2korr(fileinfo+6); maxlength=uint2korr(fileinfo+6);
names=uint2korr(fileinfo+8); names=uint2korr(fileinfo+8);
@ -680,7 +680,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
{ /* Expand file */ { /* Expand file */
newpos+=IO_SIZE; newpos+=IO_SIZE;
int4store(fileinfo+10,newpos); int4store(fileinfo+10,newpos);
endpos=(ulong) my_seek(file,0L,MY_SEEK_END,MYF(0)); /* Copy from file-end */ endpos=(ulong) my_seek(file,0L,MY_SEEK_END,MYF(0));/* Copy from file-end */
bufflength= (uint) (endpos & (IO_SIZE-1)); /* IO_SIZE is a power of 2 */ bufflength= (uint) (endpos & (IO_SIZE-1)); /* IO_SIZE is a power of 2 */
while (endpos > maxlength) while (endpos > maxlength)

View File

@ -53,7 +53,7 @@ gptr sql_calloc(uint size)
char *sql_strdup(const char *str) char *sql_strdup(const char *str)
{ {
uint len=strlen(str)+1; uint len=(uint) strlen(str)+1;
char *pos; char *pos;
if ((pos= (char*) sql_alloc(len))) if ((pos= (char*) sql_alloc(len)))
memcpy(pos,str,len); memcpy(pos,str,len);

View File

@ -267,7 +267,7 @@ void find_date(string pos,uint *vek,uint flag)
bzero((char*) vek,sizeof(int)*4); bzero((char*) vek,sizeof(int)*4);
while (*pos && !isdigit(*pos)) while (*pos && !isdigit(*pos))
pos++; pos++;
length=strlen(pos); length=(uint) strlen(pos);
for (uint i=0 ; i< 3; i++) for (uint i=0 ; i< 3; i++)
{ {
start=pos; value=0; start=pos; value=0;

View File

@ -186,7 +186,7 @@ static uchar * pack_screens(List<create_field> &create_fields,
create_field *field; create_field *field;
while ((field=it++)) while ((field=it++))
length+=strlen(field->field_name)+1+TE_INFO_LENGTH+cols/2; length+=(uint) strlen(field->field_name)+1+TE_INFO_LENGTH+cols/2;
if (!(info=(uchar*) my_malloc(length,MYF(MY_WME)))) if (!(info=(uchar*) my_malloc(length,MYF(MY_WME))))
DBUG_RETURN(0); DBUG_RETURN(0);
@ -216,7 +216,7 @@ static uchar * pack_screens(List<create_field> &create_fields,
strfill((my_string) pos+3,(uint) (cols >> 1),' '); strfill((my_string) pos+3,(uint) (cols >> 1),' ');
pos+=(cols >> 1)+4; pos+=(cols >> 1)+4;
} }
length=strlen(cfield->field_name); length=(uint) strlen(cfield->field_name);
if (length > cols-3) if (length > cols-3)
length=cols-3; length=cols-3;
@ -352,7 +352,7 @@ static bool pack_header(uchar *forminfo, enum db_type table_type,
if (old_int_count != int_count) if (old_int_count != int_count)
{ {
for (const char **pos=field->interval->type_names ; *pos ; pos++) for (const char **pos=field->interval->type_names ; *pos ; pos++)
int_length+=strlen(*pos)+1; // field + suffix prefix int_length+=(uint) strlen(*pos)+1; // field + suffix prefix
int_parts+=field->interval->count+1; int_parts+=field->interval->count+1;
} }
} }
@ -567,9 +567,9 @@ static bool make_empty_rec(File file,enum db_type table_type,
regfield->store((longlong) 1); regfield->store((longlong) 1);
} }
else if (type == Field::YES) // Old unireg type else if (type == Field::YES) // Old unireg type
regfield->store(ER(ER_YES),strlen(ER(ER_YES))); regfield->store(ER(ER_YES),(uint) strlen(ER(ER_YES)));
else if (type == Field::NO) // Old unireg type else if (type == Field::NO) // Old unireg type
regfield->store(ER(ER_NO),strlen(ER(ER_NO))); regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)));
else else
regfield->reset(); regfield->reset();
delete regfield; delete regfield;