configure.in:
  Merged
Docs/manual.texi:
  Merged
This commit is contained in:
unknown 2000-08-22 12:33:46 +04:00
commit 69bb38752c
59 changed files with 551 additions and 442 deletions

View file

@ -3,6 +3,6 @@ make -k clean
aclocal; autoheader; aclocal; automake; autoconf
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --enable-thread-safe-client
make
strip sql/mysqld

View file

@ -275,7 +275,7 @@ Is there anything special to do when upgrading/downgrading MySQL?
How standards-compatible is MySQL?
* Extensions to ANSI:: @strong{MySQL} extensions to ANSI SQL92
* Ansi mode:: Runnning @strong{MySQL} in ANSI mode
* Ansi mode:: Running @strong{MySQL} in ANSI mode
* Differences from ANSI:: @strong{MySQL} differences compared to ANSI SQL92
* Missing functions:: Functionality missing from @strong{MySQL}
* Standards:: What standards does @strong{MySQL} follow?
@ -323,7 +323,7 @@ MySQL language reference
* DROP DATABASE:: @code{DROP DATABASE} syntax
* CREATE TABLE:: @code{CREATE TABLE} syntax
* ALTER TABLE:: @code{ALTER TABLE} syntax
* RENAME TABLE::
* RENAME TABLE:: @code{RENAME TABLE} syntax
* DROP TABLE:: @code{DROP TABLE} syntax
* OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax
* CHECK TABLE:: @code{CHECK TABLE} syntax
@ -337,7 +337,7 @@ MySQL language reference
* LOAD DATA:: @code{LOAD DATA INFILE} syntax
* UPDATE:: @code{UPDATE} syntax
* USE:: @code{USE} syntax
* FLUSH:: @code{Flush} syntax (clearing caches)
* FLUSH:: @code{FLUSH} syntax (clearing caches)
* KILL:: @code{KILL} syntax
* SHOW:: @code{SHOW} syntax (Get information about tables, columns, ...)
* EXPLAIN:: @code{EXPLAIN} syntax (Get information about a @code{SELECT})
@ -609,7 +609,7 @@ Using @code{MySQL} with some common programs
Problems and common errors
* What is crashing:: How to determinate what is causing problems
* What is crashing:: How to determine what is causing problems
* Crashing:: What to do if @strong{MySQL} keeps crashing
* Link errors:: Problems when linking with the @strong{MySQL} client library
* Common errors:: Some common errors when using @strong{MySQL}
@ -648,7 +648,7 @@ Some common errors when using MySQL
Solving some common problems with MySQL
* Log Replication:: Database replication with update log
* Log Replication:: Database replication with update log
* Backup:: Database backups
* Update log:: The update log
* Multiple servers:: Running multiple @strong{MySQL} servers on the same machine
@ -754,8 +754,8 @@ MySQL internals
MySQL change history
* News-3.23.x:: Changes in release 3.23.x (Released as beta)
* News-3.22.x:: Changes in release 3.22.x (Recommended version)
* News-3.23.x:: Changes in release 3.23.x (Recommended; beta)
* News-3.22.x:: Changes in release 3.22.x (Still supported)
* News-3.21.x:: Changes in release 3.21.x
* News-3.20.x:: Changes in release 3.20.x
* News-3.19.x:: Changes in release 3.19.x
@ -11645,7 +11645,7 @@ to restart @code{mysqld} with @code{--skip-grant-tables} to be able to run
* DROP DATABASE:: @code{DROP DATABASE} syntax
* CREATE TABLE:: @code{CREATE TABLE} syntax
* ALTER TABLE:: @code{ALTER TABLE} syntax
* RENAME TABLE::
* RENAME TABLE:: @code{RENAME TABLE} syntax
* DROP TABLE:: @code{DROP TABLE} syntax
* OPTIMIZE TABLE:: @code{OPTIMIZE TABLE} syntax
* CHECK TABLE:: @code{CHECK TABLE} syntax
@ -15983,14 +15983,14 @@ mysql> select COUNT(*) from student;
@findex COUNT(DISTINCT)
@findex DISTINCT
@item COUNT(DISTINCT expr,[expr...])
Returns a count of the number of different not @code{NULL} values.
Returns a count of the number of different non-@code{NULL} values.
@example
mysql> select COUNT(DISTINCT results) from student;
@end example
In @strong{MySQL} you can get the number of distinct expressions
combinations that doesn't contain NULL by giving a list of expressions.
In @strong{MySQL} you can get the number of distinct expression
combinations that don't contain NULL by giving a list of expressions.
In ANSI SQL you would have to do a concatenation of all expressions
inside @code{CODE(DISTINCT ..)}.
@ -16792,23 +16792,23 @@ See also @xref{ALTER TABLE problems, , @code{ALTER TABLE} problems}.
@section @code{RENAME TABLE} syntax
@example
RENAME TABLE tbl_name as new_table_name[, tbl_name2 as new_table_name2,...]
RENAME TABLE tbl_name TO new_table_name[, tbl_name2 TO new_table_name2,...]
@end example
The rename is done atomic, which means that if no other thread can
The rename is done atomically, which means that if no other thread can
access any of the tables while the rename is running. This makes it
possible to replace a table with an empty one:
@example
CREATE TABLE new_table (...);
RENAME TABLE old_table TO backup_table, new_table as old_table;
RENAME TABLE old_table TO backup_table, new_table TO old_table;
@end example
The rename is done from left to right, which means that if you want to
swap two tables names, you have to do:
@example
RENAME TABLE old_table TO backup_table, new_table as old_table, backup_table as old_table;
RENAME TABLE old_table TO backup_table, new_table TO old_table, backup_table TO old_table;
@end example
Is long as two databases are on the same disk you can also do a rename
@ -16818,9 +16818,10 @@ from a database to another:
RENAME TABLE current_database.table_name TO other_database.table_name;
@end example
When you execute @code{RENAME}, you can't have any locked tables or active
transactions. You must also have the @code{ALTER TABLE} privilege on both
the old and the new table.
When you execute @code{RENAME}, you can't have any locked tables or
active transactions. You must also have the @code{ALTER 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
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
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}.
@ -28348,7 +28351,7 @@ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
@chapter Problems and common errors
@menu
* What is crashing:: How to determinate what is causing problems
* What is crashing:: How to determine what is causing problems
* Crashing:: What to do if @strong{MySQL} keeps crashing
* Link errors:: Problems when linking with the @strong{MySQL} client library
* Common errors:: Some common errors when using @strong{MySQL}
@ -28373,7 +28376,7 @@ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'
@end menu
@node What is crashing, Crashing, Problems, Problems
@section How to determinate what is causing problems
@section How to determine what is causing problems
When you run into problems, the first thing you should do is to find out
which program / piece of equipment is causing problems.
@ -29617,14 +29620,14 @@ SELECT id AS "Customer identity" FROM table_name;
Note that you ANSI SQL doesn't allow you to refer to an alias in a
@code{WHERE} clause. This is because when the @code{WHERE} code is
executed the column value may not yet be determinated. For example the
executed the column value may not yet be determined. For example the
following query is @strong{illegal}:
@example
SELECT id,COUNT(*) AS cnt FROM table_name WHERE cnt > 0 GROUP BY id;
@end example
The @code{WHERE} statement is executed to determinate which rows should
The @code{WHERE} statement is executed to determine which rows should
be included in the @code{GROUP BY} part while @code{HAVING} is used to
decide which rows from the result set should be used.
@ -35345,30 +35348,28 @@ find on the
this means that the version has not yet been released!
@menu
* News-3.23.x:: Changes in release 3.23.x (Released as beta)
* News-3.22.x:: Changes in release 3.22.x (Recommended version)
* News-3.23.x:: Changes in release 3.23.x (Recommended; beta)
* News-3.22.x:: Changes in release 3.22.x (Still supported)
* News-3.21.x:: Changes in release 3.21.x
* News-3.20.x:: Changes in release 3.20.x
* News-3.19.x:: Changes in release 3.19.x
@end menu
@node News-3.23.x, News-3.22.x, News, News
@appendixsec Changes in release 3.23.x (Released as beta)
@appendixsec Changes in release 3.23.x (Recommended; beta)
The major difference between release 3.23 and releases 3.22 and 3.21 is that
3.23 contains a new ISAM library (MyISAM), which is more tuned for SQL
than the old ISAM was.
The 3.23 release is under development, and things will be added at a
fast pace to it. For the moment we recommend this version only for
users that desperately need a new feature that is found only in this
release (like big file support and machine-independent tables). (Note
that all new functionality in @strong{MySQL} 3.23 is extensively tested, but as
this release involves much new code, it's difficult to test everything).
The 3.23 release has several major new features that are not
present in the 3.22 or 3.21 releases. We have added two new
table types: MyISAM, a new ISAM library which is tuned for SQL
and supports large files; and BerkeleyDB which uses the Berkeley
DB library from Sleepycat Software to implement transaction-safe
tables. The 3.23 release also includes support for database
replication between a master and many slaves.
We are not adding any more new features that are likely to break any
old code in @strong{MySQL} 3.23 so this version should stabilise pretty soon
and will soon be declared beta, gamma and release.
old code in @strong{MySQL} 3.23, so we recommend that you use this
version. The replication and BerkeleyDB code is still under development,
though, so 3.23 is not released as a stable version yet.
@menu
* News-3.23.23:: Changes in release 3.23.23
@ -35401,6 +35402,12 @@ and will soon be declared beta, gamma and release.
@appendixsubsec Changes in release 3.23.23
@itemize @bullet
@item
Changed behavior of @code{--enable-thread-safe-client} so
that both non-threaded (@code{-lmysqlclient}) and threaded
(@code{-lmysqlclient_r}) libraries are built. Users who linked
against a threaded @code{-lmysqlclient} will need to link against
@code{libmysqlclient_r} now.
@item
Added atomic @code{RENAME} command.
@item
Don't count entries with @code{NULL} in @code{COUNT(DISTINCT ..)}.
@ -39538,8 +39545,6 @@ Fail safe replication.
@item
Optimize, test and document transactions safe tables
@item
@code{RENAME table to table, table to table [,...]}
@item
Allow users to change startup options.
@item
Subqueries. @code{select id from t where grp in (select grp from g where u > 100)}

View file

@ -286,8 +286,8 @@ int main(int argc,char *argv[])
histfile=my_strdup(getenv("MYSQL_HISTFILE"),MYF(MY_WME));
else if (getenv("HOME"))
{
histfile=(char*) my_malloc(strlen(getenv("HOME"))
+ strlen("/.mysql_history")+2,
histfile=(char*) my_malloc((uint) strlen(getenv("HOME"))
+ (uint) strlen("/.mysql_history")+2,
MYF(MY_WME));
if (histfile)
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
}
else
len=strlen(name);
len=(uint) strlen(name);
}
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);
#endif
#ifdef USE_MB
char *strend=line+strlen(line);
char *strend=line+(uint) strlen(line);
#endif
for (pos=out=line ; (inchar= (uchar) *pos) ; pos++)
@ -926,14 +926,14 @@ static char *new_command_generator(char *text,int state)
static uint i;
if (!state) {
textlen=strlen(text);
textlen=(uint) strlen(text);
}
if (textlen>0) { /* lookup in the hash */
if (!state) {
uint len;
b = find_all_matches(&ht,text,strlen(text),&len);
b = find_all_matches(&ht,text,(uint) strlen(text),&len);
if (!b) {
return NullS;
}
@ -961,7 +961,7 @@ static char *new_command_generator(char *text,int state)
}
ptr= NullS;
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);
}
/* 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)))
{
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]);
}
}
@ -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]);
field_names[i][num_fields+j] = my_strdup(sql_field->name,MYF(0));
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]);
j++;
}
@ -1351,7 +1351,7 @@ print_table_data(MYSQL_RES *result)
separator.copy("+",1);
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)
length=max(length,field->length);
else
@ -1437,7 +1437,7 @@ print_table_data_vertically(MYSQL_RES *result)
while ((field = mysql_fetch_field(result)))
{
uint length=strlen(field->name);
uint length=(uint) strlen(field->name);
if (length > max_length)
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);
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;
else
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));
/* 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;
last_values[row] = tmp;
}

View file

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

View file

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

View file

@ -290,7 +290,7 @@ list_dbs(MYSQL *mysql,const char *wild)
printf("Wildcard: %s\n",wild);
header="Databases";
length=strlen(header);
length=(uint) strlen(header);
field=mysql_fetch_field(result);
if (length < field->max_length)
length=field->max_length;
@ -331,7 +331,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
putchar('\n');
header="Tables";
head_length=strlen(header);
head_length=(uint) strlen(header);
field=mysql_fetch_field(result);
if (head_length < field->max_length)
head_length=field->max_length;
@ -470,7 +470,7 @@ print_header(const char *header,uint head_length,...)
putchar('|');
for (;;)
{
str_length=strlen(field);
str_length=(uint) strlen(field);
if (str_length > length)
str_length=length+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(' ');
fputs(field,stdout);
field_length=strlen(field);
field_length=(uint) strlen(field);
for (i=field_length ; i <= length ; i++)
putchar(' ');
if (!(field=va_arg(args,my_string)))
@ -580,7 +580,7 @@ static void print_res_top(MYSQL_RES *result)
mysql_field_seek(result,0);
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;
else
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;
bzero((char*) buffer,sizeof(buffer[0]));
length=strlen(str);
length=(uint) strlen(str);
if (!(buffer->buffer=buffer->start_of_line=buffer->end_of_line=
(char*)my_malloc(length+2,MYF(MY_FAE))))
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_CANONICAL_SYSTEM
# 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)
PROTOCOL_VERSION=10

View file

@ -246,6 +246,11 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_ALLOCA
#define HAVE_COMPRESS
#ifdef NOT_USED
#define HAVE_SNPRINTF /* Gave link error */
#define _snprintf snprintf
#endif
#ifdef _MSC_VER
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
#define HAVE_ANSI_INCLUDE

View file

@ -70,7 +70,7 @@ typedef struct st_win_timer
#ifdef __WIN__
typedef struct st_win_timer
{
uint crono;
rf_SetTimer crono;
} thr_alarm_t;
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);
my_bool mi_check_status(void* param);
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 */
#ifdef __cplusplus

View file

@ -25,9 +25,6 @@
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,
uint key_len, enum ha_rkey_function search_flag)
{

View file

@ -16,6 +16,8 @@
MA 02111-1307, USA */
#include <global.h>
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
#include <errno.h>
#include <my_pthread.h>
#include <signal.h>
@ -24,8 +26,6 @@
#include <queues.h>
#include "thr_alarm.h"
#ifdef THREAD
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> /* AIX needs this for fd_set */
#endif
@ -38,7 +38,6 @@ static my_bool alarm_aborted=1;
my_bool thr_alarm_inited=0;
#if !defined(__WIN__) && !defined(__OS2__)
#ifndef DONT_USE_THR_ALARM /* thr_alarm disabled */
static pthread_mutex_t LOCK_alarm;
static sigset_t full_signal_set;
@ -455,10 +454,150 @@ static void *alarm_handler(void *arg __attribute__((unused)))
pthread_exit(0);
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
#if defined(THREAD) && !defined(DONT_USE_THR_ALARM)
static pthread_cond_t COND_thread_count;
static pthread_mutex_t LOCK_thread_count;
@ -468,7 +607,7 @@ static uint thread_count;
typedef int * fd_set_ptr;
#else
typedef fd_set * fd_set_ptr;
#endif
#endif /* HPUX */
static void *test_thread(void *arg)
{
@ -567,8 +706,7 @@ static sig_handler print_signal_warning(int sig)
if (sig == SIGALRM)
alarm(2); /* reschedule alarm */
}
#endif
#endif /* USE_ONE_SIGNAL_HAND */
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");
return 0;
}
#endif /* MAIN */
#else /* DONT_USE_THR_ALARM */
#else /* THREAD */
#ifdef MAIN
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");
#endif
exit(1);
}
#endif
#endif
/*****************************************************************************
** 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;
}
#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
#endif /* THREAD */
#endif /* MAIN */

View file

@ -76,13 +76,14 @@ multiple read locks.
#endif
#include "mysys_priv.h"
#ifdef THREAD
#include "thr_lock.h"
#include <m_string.h>
#include <errno.h>
my_bool thr_lock_inited=0;
#ifdef THREAD
/* The following constants are only for debug output */
#define MAX_THREADS 100
@ -1063,8 +1064,16 @@ void thr_print_locks(void)
pthread_mutex_unlock(&THR_LOCK_lock);
}
#endif /* THREAD */
/*****************************************************************************
** Test of thread locks
****************************************************************************/
#ifdef MAIN
#ifdef THREAD
struct st_test {
uint lock_nr;
enum thr_lock_type lock_type;
@ -1283,6 +1292,14 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
printf("Test succeeded\n");
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
#define pthread_mutex_init(a,b) my_pthread_mutex_init((a),(b))
#endif
#endif
#endif /* DO_NOT_REMOVE_THREAD_WRAPPERS */
int safe_mutex_init(safe_mutex_t *mp,
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);
}
#endif /* SAFE_MUTEX */
#endif /* THREAD && SAFE_MUTEX */

View file

@ -39,7 +39,7 @@
# "3-byte int" or "same as xxx".
$version="1.47";
$version="1.48";
use DBI;
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_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))") &&
$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 strings","min_str","min(b)","a",1],
["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=

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
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_null=yes # NULL constraint (SyBase style)
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_func=no # default value function for column
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_stddev=yes # Group function STDDEV
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_count_*=yes # Group function COUNT (*)
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_every=no # Group function EVERY
group_func_sql_max=yes # Group function MAX on numbers
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_str=yes # Group function MIN on strings
group_func_sql_some=no # Group function SOME
group_func_sql_sum=yes # Group function SUM
group_functions=yes # Group functions
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_table_update=no # Update with sub select
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
storage_of_float=round # Storage of float values
subqueries=no # subqueries

View file

@ -554,7 +554,7 @@ sub new
$limits{'max_index_parts'} = 16; # Is this true ?
$limits{'max_text_size'} = 7000; # 8000 crashes pg 6.3
$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 ...
$smds{'q1'} = 'b'; # with time

View file

@ -223,8 +223,8 @@ if ($limits->{'unique_index'})
{
$tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count);
$tmp=$tmpvar % ($total_rows);
$tmpquery = "$query ($tmp,1,2,'D')";
if (!$dbh->do($tmpquery))
$tmpquery = "$query ($tmp,$tmp,2,'D')";
if ($dbh->do($tmpquery))
{
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
{
res.length(strlen(res.ptr())); // Fix length
res.length((uint) strlen(res.ptr())); // Fix length
if (unsigned_flag)
res.append(" unsigned");
if (zerofill)
@ -355,7 +355,7 @@ void Field::store_time(TIME *ltime,timestamp_type type)
case TIMESTAMP_TIME:
sprintf(buff, "%02d:%02d:%02d",
ltime->hour,ltime->minute,ltime->second);
store(buff,strlen(buff));
store(buff,(uint) strlen(buff));
break;
}
}
@ -500,8 +500,13 @@ void Field_decimal::store(double nr)
char buff[320];
fyllchar = zerofill ? (char) '0' : (char) ' ';
#ifdef HAVE_SNPRINTF_
buff[sizeof(buff)-1]=0; // Safety
snprintf(buff,sizeof(buff)-1, "%.*f",(int) dec,nr);
#else
sprintf(buff,"%.*f",dec,nr);
length=strlen(buff);
#endif
length=(uint) strlen(buff);
if (length > field_length)
{
@ -1836,8 +1841,12 @@ String *Field_float::val_str(String *val_buffer,
}
while (tmp_dec--)
*to++= *pos++;
#else
#ifdef HAVE_SNPRINTF_
sprintf(to,val_buffer->length(),"%.*f",dec,nr);
#else
sprintf(to,"%.*f",dec,nr);
#endif
to=strend(to);
#endif
}
@ -2067,7 +2076,8 @@ String *Field_double::val_str(String *val_buffer,
*to++= *pos++;
#else
#ifdef HAVE_SNPRINTF
snprintf(to,to_length,"%.*f",dec,nr);
to[to_length-1]=0; // Safety
snprintf(to,to_length-1,"%.*f",dec,nr);
#else
sprintf(to,"%.*f",dec,nr);
#endif
@ -2471,7 +2481,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
void Field_timestamp::sql_type(String &res) const
{
sprintf((char*) res.ptr(),"timestamp(%d)",(int) field_length);
res.length(strlen(res.ptr()));
res.length((uint) strlen(res.ptr()));
}
@ -2597,7 +2607,7 @@ String *Field_time::val_str(String *val_buffer,
sprintf((char*) val_buffer->ptr(),"%s%02d:%02d:%02d",
sign,(int) (tmp/10000), (int) (tmp/100 % 100),
(int) (tmp % 100));
val_buffer->length(strlen(val_buffer->ptr()));
val_buffer->length((uint) strlen(val_buffer->ptr()));
return val_buffer;
}
@ -2722,7 +2732,7 @@ String *Field_year::val_str(String *val_buffer,
void Field_year::sql_type(String &res) const
{
sprintf((char*) res.ptr(),"year(%d)",(int) field_length);
res.length(strlen(res.ptr()));
res.length((uint) strlen(res.ptr()));
}
@ -3388,7 +3398,7 @@ void Field_string::sql_type(String &res) const
(table->db_options_in_use & HA_OPTION_PACK_RECORD) ?
"varchar" : "char",
(int) field_length);
res.length(strlen(res.ptr()));
res.length((uint) strlen(res.ptr()));
if (binary_flag)
res.append(" binary");
}
@ -3566,7 +3576,7 @@ void Field_varstring::sort_string(char *to,uint length)
void Field_varstring::sql_type(String &res) const
{
sprintf((char*) res.ptr(),"varchar(%d)",(int) field_length);
res.length(strlen(res.ptr()));
res.length((uint) strlen(res.ptr()));
if (binary_flag)
res.append(" binary");
}
@ -3980,7 +3990,7 @@ void Field_blob::sql_type(String &res) const
case 3: str="medium"; break;
case 4: str="long"; break;
}
res.set(str,strlen(str));
res.set(str,(uint) strlen(str));
res.append(binary_flag ? "blob" : "text");
}
@ -4191,7 +4201,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
val_ptr->length(0);
else
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;
}
@ -4309,7 +4319,7 @@ String *Field_set::val_str(String *val_buffer,
if (val_buffer->length())
val_buffer->append(field_separator);
String str(typelib->type_names[bitnr],
strlen(typelib->type_names[bitnr]));
(uint) strlen(typelib->type_names[bitnr]));
val_buffer->append(str);
}
tmp>>=1;

View file

@ -1383,7 +1383,7 @@ static BDB_SHARE *get_share(const char *table_name)
{
BDB_SHARE *share;
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 *) 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)
{
if (!file) return HA_CHECK_INTERNAL_ERROR;
int error ;
MI_CHECK 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)
{
int error=0;
char fixed_name[FN_REFLEN];
MI_CHECK param;
MYISAM_SHARE* share = file->s;
DBUG_ENTER("activate_all_index");

View file

@ -462,7 +462,7 @@ void handler::print_error(int error, myf errflag)
char key[MAX_KEY_LENGTH];
String str(key,sizeof(key));
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)
{
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;
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)))
{

View file

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

View file

@ -364,7 +364,7 @@ Item *create_func_ucase(Item* a)
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)

View file

@ -1047,7 +1047,7 @@ udf_handler::fix_fields(THD *thd,TABLE_LIST *tables,Item_result_field *func,
}
else
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)
{

View file

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

View file

@ -455,7 +455,7 @@ void Item_func_curtime::fix_length_and_dec()
(int) start->tm_hour,
(int) start->tm_min,
(int) start->tm_sec);
buff_length=strlen(buff);
buff_length=(uint) strlen(buff);
}
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_min,
(int) start->tm_sec);
buff_length=strlen(buff);
buff_length=(uint) strlen(buff);
/* For getdate */
ltime.year= start->tm_year+1900;
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);
sprintf(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600),
sec/60, sec % 60);
str->copy(buff,strlen(buff));
str->copy(buff,(uint) strlen(buff));
return str;
}

View file

@ -418,7 +418,11 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
return 0;
/* 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;
memcpy((table->table_cache_key= (char*) (table+1)), key, 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)
{
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)
@ -461,10 +465,7 @@ bool wait_for_locked_table_names(THD *thd, TABLE_LIST *table_list)
break;
}
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;
}

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;
int error = 0;
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);
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)
{
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)
{
buf[0] = 0;

View file

@ -101,7 +101,7 @@ public:
time(&end_time);
exec_time = end_time - thd->start_time;
valid_exec_time = 1;
db_len = (db) ? strlen(db) : 0;
db_len = (db) ? (uint) strlen(db) : 0;
}
#endif
@ -189,9 +189,9 @@ public:
time(&end_time);
exec_time = end_time - thd->start_time;
valid_exec_time = 1;
db_len = (db) ? strlen(db) : 0;
table_name_len = (table_name) ? strlen(table_name) : 0;
fname_len = (fname) ? strlen(fname) : 0;
db_len = (db) ? (uint) strlen(db) : 0;
table_name_len = (table_name) ? (uint) strlen(table_name) : 0;
fname_len = (fname) ? (uint) strlen(fname) : 0;
sql_ex.field_term = (*ex->field_term)[0];
sql_ex.enclosed = (*ex->enclosed)[0];
sql_ex.line_term = (*ex->line_term)[0];
@ -232,7 +232,7 @@ public:
while((item = li++))
{
num_fields++;
uchar len = (uchar)strlen(item->name);
uchar len = (uchar) strlen(item->name);
field_block_len += len + 1;
fields_buf.append(item->name, 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) :
Log_event(time(NULL)),
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)
{}

View file

@ -423,13 +423,13 @@ mc_simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg
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));
mc_end_server(mysql);
if (mc_mysql_reconnect(mysql) ||
net_write_command(net,(uchar) command,arg,
length ? length :strlen(arg)))
length ? length :(uint) strlen(arg)))
{
net->last_errno=CR_SERVER_GONE_ERROR;
strmov(net->last_error,ER(net->last_errno));

View file

@ -229,7 +229,7 @@ void flush_thread_cache();
void mysql_execute_command(void);
bool do_command(THD *thd);
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 table_cache_init(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 flush_tables();
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);
int fill_record(List<Item> &fields,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)
{
char buf[FN_REFLEN+1];
uint len = strlen(fname);
uint len = (uint) strlen(fname);
buf[0] = 0;
memcpy(buf + 1, fname, len + 1);
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 * p = buf;
uint table_len = strlen(table);
uint db_len = strlen(db);
uint table_len = (uint) strlen(table);
uint db_len = (uint) strlen(db);
if(table_len + db_len > sizeof(buf) - 2)
die("Buffer overrun");
@ -267,7 +267,7 @@ static void dump_remote_log_entries(const char* logname)
NET* net = &mysql->net;
int4store(buf, position);
int2store(buf + 4, binlog_flags);
len = strlen(logname);
len = (uint) strlen(logname);
memcpy(buf + 6, logname,len);
if(mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 6, 1))
die("Error sending the log dump command");

View file

@ -1138,7 +1138,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
}
break;
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
break;
#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];
else
{
if (test_if_int(optarg,strlen(optarg)))
if (test_if_int(optarg,(uint) strlen(optarg)))
berkeley_lock_scan_time=atoi(optarg);
else
{
@ -3344,7 +3344,7 @@ static char *get_relative_path(const char *path)
is_prefix(path,DEFAULT_MYSQL_HOME) &&
strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR))
{
path+=strlen(DEFAULT_MYSQL_HOME);
path+=(uint) strlen(DEFAULT_MYSQL_HOME);
while (*path == FN_LIBCHAR)
path++;
}
@ -3384,7 +3384,7 @@ static void fix_paths(void)
strmov(tmp,mysql_tmpdir);
mysql_tmpdir=tmp;
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));
}
}

View file

@ -64,7 +64,7 @@ void send_error(NET *net, uint sql_errno, const char *err)
}
else
{
length=strlen(err);
length=(uint) strlen(err);
set_if_smaller(length,MYSQL_ERRMSG_SIZE);
}
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;
text_pos=(char*) net->buff+head_length+offset+1;
(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))
length=sizeof(net->last_error)-1; /* purecov: inspected */
va_end(args);
@ -215,7 +215,7 @@ net_store_length(char *pkg, uint length)
char *
net_store_data(char *to,const char *from)
{
uint length=strlen(from);
uint length=(uint) strlen(from);
to=net_store_length(to,length);
memcpy(to,from,length);
return to+length;
@ -267,7 +267,7 @@ net_store_data(String *packet,const char *from,uint length)
bool
net_store_data(String *packet,const char *from)
{
uint length=strlen(from);
uint length=(uint) strlen(from);
uint packet_length=packet->length();
if (packet_length+5+length > packet->alloced_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(longlong nr)=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)
{
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 skrivning till master",
"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",

View file

@ -467,7 +467,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi)
char* logname = mi->log_file_name;
int4store(buf, mi->pos);
int2store(buf + 4, binlog_flags);
len = strlen(logname);
len = (uint) strlen(logname);
memcpy(buf + 6, logname,len);
if(mc_simple_command(mysql, COM_BINLOG_DUMP, buf, len + 6, 1))
// 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 * p = buf;
uint table_len = strlen(table);
uint db_len = strlen(db);
uint table_len = (uint) strlen(table);
uint db_len = (uint) strlen(db);
if(table_len + db_len > sizeof(buf) - 2)
{
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));
user.user=get_field(&mem, table,1);
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)
{
sql_print_error(
@ -217,7 +217,7 @@ int acl_init(bool dont_read_acl_tables)
get_salt_from_password(user.salt,user.password);
user.access=get_access(table,3);
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
if (table->fields <= 13)
{ // Without grant
@ -497,7 +497,7 @@ static void acl_insert_user(const char *user, const char *host,
acl_user.password=0;
acl_user.access=privileges;
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)
{
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);
}
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))
{ // End of memory
@ -737,8 +737,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0;
VOID(pthread_mutex_lock(&acl_cache->lock));
if (host && hash_search(&acl_check_hosts,(byte*) host,strlen(host)) ||
ip && hash_search(&acl_check_hosts,(byte*) ip,strlen(ip)))
if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) ||
ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip)))
{
VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host
@ -778,10 +778,10 @@ bool change_password(THD *thd, const char *host, const char *user,
if (!host)
host=thd->ip; /* purecov: tested */
/* 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;
if (strcmp(thd->user,user) ||
if (!thd || strcmp(thd->user,user) ||
my_strcasecmp(host,thd->host ? thd->host : thd->ip))
{
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->host.hostname ? acl_user->host.hostname : "",
new_password));
mysql_update_log.write(buff,strlen(buff));
mysql_update_log.write(buff,(uint) strlen(buff));
mysql_bin_log.write(&qinfo);
return 0;
}
@ -919,8 +919,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
tables.db=(char*) "mysql";
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
DBUG_RETURN(1); /* purecov: deadcode */
table->field[0]->store(host,strlen(host));
table->field[1]->store(user,strlen(user));
table->field[0]->store(host,(uint) strlen(host));
table->field[1]->store(user,(uint) strlen(user));
if (table->file->index_read_idx(table->record[0],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 */
}
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])))
{
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]
table->field[0]->store(combo.host.str,combo.host.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
{
ima = 1;
store_record(table,1); // Save copy for update
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
@ -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[1]->store(db,strlen(db));
table->field[1]->store(db,(uint) strlen(db));
table->field[2]->store(combo.user.str,combo.user.length);
table->file->index_init(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
restore_record(table,2); // cp empty row from record[2]
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);
}
else
@ -1166,7 +1166,7 @@ public:
db = strdup_root(&memex,d);
user = strdup_root(&memex,u);
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);
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,
@ -1187,7 +1187,7 @@ public:
privs = cols = 0; /* 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);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
privs = (uint) form->field[6]->val_int();
@ -1200,10 +1200,10 @@ public:
if (cols)
{
int key_len;
col_privs->field[0]->store(host,strlen(host));
col_privs->field[1]->store(db,strlen(db));
col_privs->field[2]->store(user,strlen(user));
col_privs->field[3]->store(tname,strlen(tname));
col_privs->field[0]->store(host,(uint) strlen(host));
col_privs->field[1]->store(db,(uint) strlen(db));
col_privs->field[2]->store(user,(uint) strlen(user));
col_privs->field[3]->store(tname,(uint) strlen(tname));
key_len=(col_privs->field[0]->pack_length()+
col_privs->field[1]->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");
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[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()+
table->field[2]->pack_length()+ table->field[3]->pack_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
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[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
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[7]->store((longlong) store_col_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++)
{
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))
goto err;
}
@ -2253,7 +2253,7 @@ uint get_column_grant(THD *thd, TABLE_LIST *table, Field *field)
else
{
grant_column=column_hash_search(grant_table, field->field_name,
strlen(field->field_name));
(uint) strlen(field->field_name));
if (!grant_column)
priv=table->grant.privilege;
else

View file

@ -352,14 +352,20 @@ void field_real::add()
if ((decs = decimals()) == NOT_FIXED_DEC)
{
sprintf(buff, "%g", num);
length = strlen(buff);
length = (uint) strlen(buff);
if (rint(num) != num)
max_notzero_dec_len = 1;
}
else
{
#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety
snprintf(buff, sizeof(buff)-1, "%-.*f", (int) decs, num);
#else
sprintf(buff, "%-.*f", (int) decs, num);
length = strlen(buff);
#endif
length = (uint) strlen(buff);
// We never need to check further than this
end = buff + length - 1 - decs + max_notzero_dec_len;
@ -686,7 +692,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
sprintf(buff, "INT(%d)", num_info.integers);
else
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)
answer->append(" UNSIGNED");
if (num_info.zerofill)
@ -704,12 +710,12 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
else if ((max_length * (total_rows - nulls)) < (sum + total_rows))
{
sprintf(buff, "CHAR(%d)", (int) max_length);
answer->append(buff, strlen(buff));
answer->append(buff, (uint) strlen(buff));
}
else
{
sprintf(buff, "VARCHAR(%d)", (int) max_length);
answer->append(buff, strlen(buff));
answer->append(buff, (uint) strlen(buff));
}
}
else if (max_length < (1L << 16))
@ -756,7 +762,7 @@ void field_real::get_opt_type(String *answer,
sprintf(buff, "INT(%d)", (int) max_length - (item->decimals + 1));
else
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)
answer->append(" UNSIGNED");
}
@ -768,7 +774,7 @@ void field_real::get_opt_type(String *answer,
else
sprintf(buff, "DOUBLE(%d,%d)", (int) max_length - (item->decimals + 1),
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->type() == Item::FIELD_ITEM &&
@ -797,7 +803,7 @@ void field_longlong::get_opt_type(String *answer,
sprintf(buff, "INT(%d)", (int) max_length);
else
sprintf(buff, "BIGINT(%d)", (int) max_length);
answer->append(buff, strlen(buff));
answer->append(buff, (uint) strlen(buff));
if (min_arg >= 0)
answer->append(" UNSIGNED");
@ -826,7 +832,7 @@ void field_ulonglong::get_opt_type(String *answer,
else
sprintf(buff, "BIGINT(%d) UNSIGNED", (int) max_length);
// 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 &&
// a single number shouldn't be zerofill
max_length != 1 &&

View file

@ -51,7 +51,7 @@ typedef struct st_tree_info
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 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_longlong(const longlong *s, const longlong *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)
{
DBUG_ENTER("table_cache_free");
close_cached_tables(0);
close_cached_tables((THD*) 0,0,(TABLE_LIST*) 0);
if (!open_cache.records) // Safety first
hash_free(&open_cache);
DBUG_VOID_RETURN;
@ -373,7 +373,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
else
p = log_file_name;
uint ident_len = strlen(p);
uint ident_len = (uint) strlen(p);
ulong event_len = ident_len + sizeof(header);
int4store(header + 5, event_len);
packet->append(header, sizeof(header));
@ -433,8 +433,10 @@ send_fields(THD *thd,List<Item> &list,uint flag)
if (convert)
{
if (convert->store(packet,field.table_name,strlen(field.table_name)) ||
convert->store(packet,field.col_name, strlen(field.col_name)) ||
if (convert->store(packet,field.table_name,
(uint) strlen(field.table_name)) ||
convert->store(packet,field.col_name,
(uint) strlen(field.col_name)) ||
packet->realloc(packet->length()+10))
goto err;
}
@ -531,35 +533,50 @@ void free_io_cache(TABLE *table)
/* 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;
DBUG_ENTER("close_cached_tables");
VOID(pthread_mutex_lock(&LOCK_open));
while (unused_tables)
if (!tables)
{
while (unused_tables)
{
#ifdef EXTRA_DEBUG
if (hash_delete(&open_cache,(byte*) unused_tables))
printf("Warning: Couldn't delete open table from hash\n");
if (hash_delete(&open_cache,(byte*) unused_tables))
printf("Warning: Couldn't delete open table from hash\n");
#else
VOID(hash_delete(&open_cache,(byte*) unused_tables));
VOID(hash_delete(&open_cache,(byte*) unused_tables));
#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 */
key_cache_used=0;
bool found=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 there is any table that has a lower refresh_version, wait until
this is closed (or this thread is killed) before returning
*/
kill_delayed_threads();
THD *thd=current_thd;
if (!tables)
kill_delayed_threads();
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= &LOCK_open;
thd->mysys_var->current_cond= &COND_refresh;
@ -737,7 +754,8 @@ bool rename_temporary_table(TABLE *table, const char *db,
{
char *key;
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 */
table->key_length=(uint)
(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
LOCK_OPEN ; This lock will be freed on return
LOCK_OPEN ; This lock will be unlocked on return.
*/
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
// so we can try to download it from the master
{
int table_name_len = strlen(table_name);
int db_len = strlen(db);
int table_name_len = (uint) strlen(table_name);
int db_len = (uint) strlen(db);
thd->last_nx_db = alloc_root(glob_alloc,db_len + table_name_len + 2);
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 */
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,
MYF(MY_WME));
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;
DBUG_ENTER("open_temporary_table");
if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+strlen(db)+
strlen(table_name)+2,
if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+(uint) strlen(db)+
(uint) strlen(table_name)+2,
MYF(MY_WME))))
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 *table_name=item->table_name;
const char *name=item->field_name;
uint length=strlen(name);
uint length=(uint) strlen(name);
if (table_name)
{ /* Qualified field */

View file

@ -266,7 +266,7 @@ select_export::prepare(List<Item> &list)
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
option|=1; // Force use of db directory
#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);
(void) fn_format(path,exchange->file_name, thd->db ? thd->db : "", "",
option);

View file

@ -45,7 +45,7 @@ typedef struct st_log_info
typedef struct st_master_info
{
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
// the variables below are needed because we can change masters on the fly
@ -58,7 +58,7 @@ typedef struct st_master_info
bool inited;
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);
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,
// but required otherwise
inline void read_pos(ulong& var)
inline void read_pos(ulonglong& var)
{
pthread_mutex_lock(&lock);
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 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

View file

@ -458,7 +458,7 @@ int handle_bootstrap(THD *thd,FILE *file)
char *buff= (char*) thd->net.buff;
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] == ';'))
length--;
buff[length]=0;
@ -726,7 +726,7 @@ bool do_command(THD *thd)
if (check_access(thd,RELOAD_ACL,any_db))
break;
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);
else
send_eof(net);
@ -765,7 +765,7 @@ bool do_command(THD *thd)
sprintf(strend(buff), " Memory in use: %ldK Max memory used: %ldK",
(lCurMemory+1023L)/1024L,(lMaxMemory+1023L)/1024L);
#endif
VOID(my_net_write(net, buff,strlen(buff)));
VOID(my_net_write(net, buff,(uint) strlen(buff)));
VOID(net_flush(net));
break;
}
@ -1131,15 +1131,32 @@ mysql_execute_command(void)
}
#endif
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;
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))
res= -1;
break;
case SQLCOM_SHOW_CREATE: /* SerG:show */
}
case SQLCOM_SHOW_CREATE:
#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;
#else
{
@ -1385,7 +1402,7 @@ mysql_execute_command(void)
break;
}
#endif
case SQLCOM_SHOW_FIELDS: /* SerG:show */
case SQLCOM_SHOW_FIELDS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
DBUG_VOID_RETURN;
@ -1411,7 +1428,7 @@ mysql_execute_command(void)
break;
}
#endif
case SQLCOM_SHOW_KEYS: /* SerG:show */
case SQLCOM_SHOW_KEYS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(&thd->net,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
DBUG_VOID_RETURN;
@ -1623,9 +1640,9 @@ mysql_execute_command(void)
break;
}
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;
if (reload_acl_and_cache(lex->type))
if (reload_acl_and_cache(thd, lex->type, tables))
send_error(&thd->net,0);
else
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->length=0;
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--;
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
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->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++)
{
uint length=strlen(*pos);
uint length=(uint) strlen(*pos);
set_if_bigger(new_field->length,length);
}
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
@ -2196,7 +2213,7 @@ static void remove_escape(char *name)
{
char *to;
#ifdef USE_MB
char *strend=name+strlen(name);
char *strend=name+(uint) strlen(name);
#endif
for (to=name; *name ; name++)
{
@ -2329,7 +2346,7 @@ static bool check_dup(THD *thd,const char *db,const char *name,
return 0;
}
bool reload_acl_and_cache(uint options)
bool reload_acl_and_cache(THD *thd, uint options, TABLE_LIST *tables)
{
bool result=0;
@ -2351,12 +2368,12 @@ bool reload_acl_and_cache(uint options)
}
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);
}
result=close_cached_tables((options & REFRESH_FAST) ? 0 : 1);
result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables);
}
if (options & REFRESH_HOSTS)
hostname_cache_refresh();

View file

@ -21,8 +21,8 @@
#include "mysql_priv.h"
static TABLE_LIST *mysql_rename_tables(THD *thd, TABLE_LIST *table_list,
bool skip_error);
static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool skip_error);
/*
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))
goto end;
if (!(ren_table=mysql_rename_tables(thd,table_list,0)))
if (!(ren_table=rename_tables(thd,table_list,0)))
error=0;
end:
@ -66,25 +66,24 @@ end:
{
/* Rename didn't succeed; rename back the tables in reverse order */
TABLE_LIST *prev=0,*table;
/*
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
*/
/* Reverse the table list */
while (table_list)
{
TABLE_LIST *next=table_list->next->next;
table_list->next->next=prev;
TABLE_LIST *next=table_list->next;
table_list->next=prev;
prev=table_list;
table_list=next;
}
table_list=prev;
/* 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; // Skipp error table
/* 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 */
}
if (!error)
@ -92,6 +91,7 @@ end:
mysql_update_log.write(thd->query,thd->query_length);
Query_log_event qinfo(thd, thd->query);
mysql_bin_log.write(&qinfo);
send_ok(&thd->net);
}
for (TABLE_LIST *table=table_list ; table != lock_table ; table=table->next)
unlock_table_name(thd,table);
@ -103,30 +103,45 @@ end:
/*
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 *
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;
for (ren_table=table_list ; ren_table ; ren_table=ren_table->next)
TABLE_LIST *ren_table,*new_table;
DBUG_ENTER("rename_tables");
for (ren_table=table_list ; ren_table ; ren_table=new_table->next)
{
db_type table_type;
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,
ren_table->db,ren_table->name,
reg_ext);
if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN ||
mysql_rename_table(table_type,
ren_table->db, ren_table->name,
new_table->db, new_table->name))
if ((table_type=get_table_type(name)) == DB_TYPE_UNKNOWN)
{
my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
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)
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;
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;
end=strmov(field->name,"Database");
if (wild && wild[0])
@ -92,7 +92,7 @@ int mysqld_show_tables(THD *thd,const char *db,const char *wild)
char *file_name;
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);
if (wild && wild[0])
strxmov(end," (",wild,")",NullS);
@ -405,7 +405,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild)
#ifdef NOT_USED
if (thd->col_access & TABLE_ACLS ||
! check_grant_column(thd,table,field->field_name,
strlen(field->field_name),1))
(uint) strlen(field->field_name),1))
#endif
{
byte *pos;
@ -899,7 +899,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->query=0;
if (tmp->query)
{
uint length=strlen(tmp->query);
uint length=(uint) strlen(tmp->query);
if (length > max_query_length)
length=max_query_length;
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)
{
sprintf(buff,"%.14g",num); // Enough for a DATETIME
return copy(buff,strlen(buff));
return copy(buff,(uint) strlen(buff));
}
#ifdef HAVE_FCONVERT
int decpt,sign;
@ -141,7 +141,7 @@ bool String::set(double num,uint decimals)
buff[0]='-';
pos=buff;
}
return copy(pos,strlen(pos));
return copy(pos,(uint) strlen(pos));
}
if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE;
@ -185,12 +185,13 @@ end:
str_length=(uint32) (to-Ptr);
return FALSE;
#else
#ifdef HAVE_SNPRINTF_
snprintf(buff,sizeof(buff), "%.*f",(int) decimals,num);
#ifdef HAVE_SNPRINTF
buff[sizeof(buff)-1]=0; // Safety
snprintf(buff,sizeof(buff)-1, "%.*f",(int) decimals,num);
#else
sprintf(buff,"%.*f",(int) decimals,num);
#endif
return copy(buff,strlen(buff));
return copy(buff,(uint) strlen(buff));
#endif
}
@ -259,7 +260,7 @@ bool String::append(const String &s)
bool String::append(const char *s,uint32 arg_length)
{
if (!arg_length) // Default argument
arg_length=strlen(s);
arg_length=(uint) strlen(s);
if (realloc(str_length+arg_length))
return TRUE;
memcpy(Ptr+str_length,s,arg_length);

View file

@ -35,7 +35,7 @@ public:
String(uint32 length_arg)
{ alloced=0; Alloced_length=0; (void) real_alloc(length_arg); }
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)
{ Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0;}
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];
handler *file=get_new_handler((TABLE*) 0, base);
bool error=0;
int error=0;
DBUG_ENTER("mysql_rename_table");
(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);
fn_format(from,from,"","",4);
fn_format(to,to, "","",4);
if (file->rename_table((const char*) from,(const char *) to))
error=1;
else
if (!(error=file->rename_table((const char*) from,(const char *) to)))
{
if (rename_file_ext(from,to,reg_ext))
{
error=1;
error=my_errno;
/* Restore old file name */
file->rename_table((const char*) to,(const char *) from);
}
}
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! */
pthread_mutex_lock(&THR_LOCK_udf);
udf=(udf_func*) hash_search(&udf_hash,name,
length ? length : strlen(name));
length ? length : (uint) strlen(name));
if (mark_used)
udf->usage_count++;
pthread_mutex_unlock(&THR_LOCK_udf);
@ -299,7 +299,7 @@ static udf_func *add_udf(char *name, Item_result ret, char *dl,
return 0;
bzero((char*) tmp,sizeof(*tmp));
tmp->name = name;
tmp->name_length=strlen(tmp->name);
tmp->name_length=(uint) strlen(tmp->name);
tmp->dl = dl;
tmp->returns = ret;
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
table->field[0]->store(u_d->name, u_d->name_length);
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
table->field[3]->store((longlong) u_d->type);
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);
}
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);
goto err;
@ -445,7 +445,7 @@ int mysql_drop_function(THD *thd,const char *udf_name)
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
goto err;
if (!table->file->index_read_idx(table->record[0],0,(byte*) udf_name,
strlen(udf_name),
(uint) strlen(udf_name),
HA_READ_KEY_EXACT))
{
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
equal optional_braces opt_key_definition key_usage_list2
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
%type <NONE>
@ -590,7 +590,7 @@ master_def:
Lex->mi.log_file_name = $3.str;
}
|
MASTER_PORT_SYM EQ ULONGLONG_NUM
MASTER_PORT_SYM EQ ULONG_NUM
{
Lex->mi.port = $3;
}
@ -600,7 +600,7 @@ master_def:
Lex->mi.pos = $3;
}
|
MASTER_CONNECT_RETRY_SYM EQ ULONGLONG_NUM
MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
{
Lex->mi.connect_retry = $3;
}
@ -1152,8 +1152,8 @@ table_to_table_list:
table_to_table:
table_ident TO_SYM table_ident
{ if (add_table_to_list($1,NULL,TL_IGNORE) ||
add_table_to_list($3,NULL,TL_IGNORE))
{ if (!add_table_to_list($1,NULL,TL_IGNORE) ||
!add_table_to_list($3,NULL,TL_IGNORE))
YYABORT;
}
@ -2161,7 +2161,7 @@ flush_options:
| 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; }
| HOSTS_SYM { Lex->type|= REFRESH_HOSTS; }
| PRIVILEGES { Lex->type|= REFRESH_GRANT; }
@ -2170,6 +2170,10 @@ flush_option:
| SLAVE { Lex->type|= REFRESH_SLAVE; }
| MASTER_SYM { Lex->type|= REFRESH_MASTER; }
opt_table_list:
/* empty */ {}
| table_list {}
/* kill threads */
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,
my_bool not_used __attribute__((unused)))
{
*length= strlen(buff->field_name);
*length= (uint) strlen(buff->field_name);
return (byte*) buff->field_name;
}
@ -670,7 +670,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
uchar *pos;
DBUG_ENTER("make_new_entry");
length=strlen(newname)+1;
length=(uint) strlen(newname)+1;
n_length=uint2korr(fileinfo+4);
maxlength=uint2korr(fileinfo+6);
names=uint2korr(fileinfo+8);
@ -680,7 +680,7 @@ ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
{ /* Expand file */
newpos+=IO_SIZE;
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 */
while (endpos > maxlength)

View file

@ -53,7 +53,7 @@ gptr sql_calloc(uint size)
char *sql_strdup(const char *str)
{
uint len=strlen(str)+1;
uint len=(uint) strlen(str)+1;
char *pos;
if ((pos= (char*) sql_alloc(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);
while (*pos && !isdigit(*pos))
pos++;
length=strlen(pos);
length=(uint) strlen(pos);
for (uint i=0 ; i< 3; i++)
{
start=pos; value=0;

View file

@ -186,7 +186,7 @@ static uchar * pack_screens(List<create_field> &create_fields,
create_field *field;
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))))
DBUG_RETURN(0);
@ -216,7 +216,7 @@ static uchar * pack_screens(List<create_field> &create_fields,
strfill((my_string) pos+3,(uint) (cols >> 1),' ');
pos+=(cols >> 1)+4;
}
length=strlen(cfield->field_name);
length=(uint) strlen(cfield->field_name);
if (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)
{
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;
}
}
@ -567,9 +567,9 @@ static bool make_empty_rec(File file,enum db_type table_type,
regfield->store((longlong) 1);
}
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
regfield->store(ER(ER_NO),strlen(ER(ER_NO)));
regfield->store(ER(ER_NO), (uint) strlen(ER(ER_NO)));
else
regfield->reset();
delete regfield;