Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb
This commit is contained in:
joreland@mysql.com 2004-08-27 14:11:50 +02:00
commit af7c3008db
95 changed files with 991 additions and 305 deletions

View file

@ -80,6 +80,7 @@ jcole@mugatu.jcole.us
jcole@mugatu.spaceapes.com
jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com
joerg@mysql.com
joreland@mysql.com
jorge@linux.jorge.mysql.com
jplindst@t41.(none)

View file

@ -376,7 +376,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
log_timestamp();
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
safe_cd("${test_dir}/mysql-test");
check_system("./mysql-test-run $flags --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
check_system("./mysql-test-run $flags --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
}
#

8
VC++Files/sql/message.mc Normal file
View file

@ -0,0 +1,8 @@
MessageId = 100
Severity = Error
Facility = Application
SymbolicName = MSG_DEFAULT
Language = English
%1For more information, see Help and Support Center at http://www.mysql.com.

View file

@ -920,6 +920,89 @@ SOURCE=.\log_event.cpp
# End Source File
# Begin Source File
SOURCE=.\message.mc
!IF "$(CFG)" == "mysqld - Win32 Release"
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
!ELSEIF "$(CFG)" == "mysqld - Win32 classic"
!ELSEIF "$(CFG)" == "mysqld - Win32 pro"
!ELSEIF "$(CFG)" == "mysqld - Win32 classic nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "mysqld - Win32 pro nt"
# Begin Custom Build - Compiling messages
InputDir=.
InputPath=.\message.mc
InputName=message
BuildCmds= \
mc.exe "$(InputDir)\$(InputName).mc"
"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\message.rc
# End Source File
# Begin Source File
SOURCE=.\mf_iocache.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"

View file

@ -44,7 +44,7 @@
#include <locale.h>
#endif
const char *VER= "14.5";
const char *VER= "14.6";
/* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024
@ -792,6 +792,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
while (*argument) *argument++= 'x'; // Destroy argument
if (*start)
start[1]=0 ;
tty_password= 0;
}
else
tty_password= 1;
@ -858,7 +859,7 @@ static int get_options(int argc, char **argv)
opt_max_allowed_packet= *mysql_params->p_max_allowed_packet;
opt_net_buffer_length= *mysql_params->p_net_buffer_length;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;

View file

@ -276,7 +276,7 @@ int main(int argc,char *argv[])
mysql_init(&mysql);
load_defaults("my",load_default_groups,&argc,&argv);
save_argv = argv; /* Save for free_defaults */
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
{
free_defaults(save_argv);
exit(ho_error);

View file

@ -666,7 +666,7 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
return 0;

View file

@ -295,7 +295,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my", load_default_groups, argc, argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
exit(ho_error);
if (!what_to_do)

View file

@ -604,7 +604,7 @@ static int get_options(int *argc, char ***argv)
md_result_file= stdout;
load_defaults("my",load_default_groups,argc,argv);
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet;

View file

@ -228,7 +228,7 @@ static int get_options(int *argc, char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
exit(ho_error);
if (enclosed && opt_enclosed)

View file

@ -95,7 +95,7 @@ int parse_args(int argc, char** argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
return 0;

View file

@ -133,7 +133,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
return 0;

View file

@ -297,7 +297,7 @@ get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0)))
exit(ho_error);
if (tty_password)

View file

@ -2100,7 +2100,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv);
default_argv= argv;
if ((handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
exit(1);
if (argc > 1)

View file

@ -99,7 +99,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
if (*argc < 1)

View file

@ -20,6 +20,7 @@
#include <my_global.h>
#include <m_string.h>
#include <my_sys.h>
#include <my_getopt.h>
#include <signal.h>
#include <errno.h>
@ -66,7 +67,7 @@ int main(int argc, char *argv[])
progname= argv[0];
if (handle_options(&argc, &argv, my_long_options, get_one_option))
if (handle_options(&argc, &argv, my_long_options, get_one_option, NULL))
exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0)

View file

@ -157,7 +157,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
if (!*argc && !print_all_codes)

View file

@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
/*

View file

@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
if (*argc == 0)

View file

@ -246,12 +246,12 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
uint length= ((uchar*)key) - pos;
uint char_length= length / cs->mbmaxlen;
if (length > char_length)
uint char_length= (uint) ((uchar*) key - pos);
if (cs->mbmaxlen > 1)
{
char_length= my_charpos(cs, pos, pos + length, char_length);
set_if_smaller(char_length, length);
uint length= char_length;
char_length= my_charpos(cs, pos, pos + length, length/cs->mbmaxlen);
set_if_smaller(char_length, length); /* QQ: ok to remove? */
}
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
}
@ -289,11 +289,12 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
uint char_length= seg->length / cs->mbmaxlen;
if (seg->length > char_length)
uint char_length= seg->length;
if (cs->mbmaxlen > 1)
{
char_length= my_charpos(cs, pos, pos + seg->length, char_length);
set_if_smaller(char_length, seg->length);
char_length= my_charpos(cs, pos, pos + char_length,
char_length / cs->mbmaxlen);
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
}
cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2);
}
@ -417,17 +418,17 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
uint char_length= seg->length / cs->mbmaxlen;
uint char_length1;
uint char_length2;
uchar *pos1= (uchar*)rec1 + seg->start;
uchar *pos2= (uchar*)rec2 + seg->start;
if (seg->length > char_length)
if (cs->mbmaxlen > 1)
{
uint char_length= seg->length / cs->mbmaxlen;
char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length);
set_if_smaller(char_length1, seg->length);
set_if_smaller(char_length1, seg->length); /* QQ: ok to remove? */
char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length);
set_if_smaller(char_length2, seg->length);
set_if_smaller(char_length2, seg->length); /* QQ: ok to remove? */
}
else
{
@ -468,12 +469,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
uint char_length= seg->length / cs->mbmaxlen;
uint char_length_key;
uint char_length_rec;
uchar *pos= (uchar*) rec + seg->start;
if (seg->length > char_length)
if (cs->mbmaxlen > 1)
{
uint char_length= seg->length / cs->mbmaxlen;
char_length_key= my_charpos(cs, key, key + seg->length, char_length);
set_if_smaller(char_length_key, seg->length);
char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length);
@ -509,21 +510,22 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec)
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
CHARSET_INFO *cs= seg->charset;
uint char_length= (cs && cs->mbmaxlen > 1) ? seg->length / cs->mbmaxlen :
seg->length;
uint char_length= seg->length;
uchar *pos= (uchar*) rec + seg->start;
if (seg->null_bit)
*key++= test(rec[seg->null_pos] & seg->null_bit);
if (seg->length > char_length)
if (cs->mbmaxlen > 1)
{
char_length= my_charpos(cs, pos, pos + seg->length, char_length);
set_if_smaller(char_length, seg->length);
char_length= my_charpos(cs, pos, pos + seg->length,
char_length / cs->mbmaxlen);
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
}
memcpy(key,rec+seg->start,(size_t) char_length);
key+= char_length;
}
}
uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
const byte *rec, byte *recpos)
{
@ -575,13 +577,13 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
}
continue;
}
char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1);
if (seg->length > char_length)
char_length= seg->length;
if (seg->charset->mbmaxlen > 1)
{
char_length= my_charpos(seg->charset,
rec + seg->start, rec + seg->start + seg->length,
char_length);
set_if_smaller(char_length, seg->length);
rec + seg->start, rec + seg->start + char_length,
char_length / seg->charset->mbmaxlen);
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
if (char_length < seg->length)
seg->charset->cset->fill(seg->charset, key + char_length,
seg->length - char_length, ' ');
@ -593,7 +595,9 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
return key - start_key;
}
uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
uint k_len)
{
HA_KEYSEG *seg, *endseg;
uchar *start_key= key;
@ -623,11 +627,12 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
}
continue;
}
char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1);
if (seg->length > char_length)
char_length= seg->length;
if (seg->charset->mbmaxlen > 1)
{
char_length= my_charpos(seg->charset, old, old+seg->length, char_length);
set_if_smaller(char_length, seg->length);
char_length= my_charpos(seg->charset, old, old+char_length,
char_length / seg->charset->mbmaxlen);
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
if (char_length < seg->length)
seg->charset->cset->fill(seg->charset, key + char_length,
seg->length - char_length, ' ');
@ -639,12 +644,14 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len)
return key - start_key;
}
uint hp_rb_key_length(HP_KEYDEF *keydef,
const byte *key __attribute__((unused)))
{
return keydef->length;
}
uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
{
const byte *start_key= key;

View file

@ -238,6 +238,9 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error);
#ifndef HAVE_STRTOULL
#define HAVE_STRTOULL
#endif
#ifndef HAVE_STRTOLL
#define HAVE_STRTOLL
#endif
#else
#ifdef HAVE_LONG_LONG
extern char *longlong2str(longlong val,char *dst,int radix);

View file

@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _my_getopt_h
#define _my_getopt_h
C_MODE_START
#define GET_NO_ARG 1
@ -54,11 +57,12 @@ struct my_option
extern char *disabled_my_option;
extern my_bool my_getopt_print_errors;
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts,
my_bool (*get_one_option)(int,
const struct my_option *,
char *));
const struct my_option *longopts, my_get_one_option,
my_error_reporter );
extern void my_print_help(const struct my_option *options);
extern void my_print_variables(const struct my_option *options);
extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
@ -66,4 +70,8 @@ extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp);
my_bool getopt_compare_strings(const char *s, const char *t, uint length);
C_MODE_END
#endif /* _my_getopt_h */

View file

@ -244,6 +244,12 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */
my_string *wild; /* Pointer to wildcards */
} WF_PACK;
enum loglevel {
ERROR_LEVEL,
WARNING_LEVEL,
INFORMATION_LEVEL
};
enum cache_type
{
READ_CACHE,WRITE_CACHE,

View file

@ -99,7 +99,7 @@ typedef struct st_mysql_field {
unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */
unsigned int charsetnr; /* Character set */
enum enum_field_types type; /* Type of field. Se mysql_com.h for types */
enum enum_field_types type; /* Type of field. See mysql_com.h for types */
} MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */
@ -175,7 +175,7 @@ struct st_mysql_options {
*/
my_bool rpl_parse;
/*
If set, never read from a master,only from slave, when doing
If set, never read from a master, only from slave, when doing
a read that is replication-aware
*/
my_bool no_master_reads;
@ -538,7 +538,7 @@ enum enum_mysql_stmt_state
typedef struct st_mysql_bind
{
unsigned long *length; /* output length pointer */
my_bool *is_null; /* Pointer to null indicators */
my_bool *is_null; /* Pointer to null indicator */
void *buffer; /* buffer to get/put data */
enum enum_field_types buffer_type; /* buffer type */
unsigned long buffer_length; /* buffer length, must be set for str/binary */
@ -581,7 +581,7 @@ typedef struct st_mysql_stmt
unsigned char **row);
unsigned long stmt_id; /* Id for prepared statement */
unsigned int last_errno; /* error code */
unsigned int param_count; /* inpute parameters count */
unsigned int param_count; /* input parameter count */
unsigned int field_count; /* number of columns in result set */
enum enum_mysql_stmt_state state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */

View file

@ -629,6 +629,8 @@ buf_read_ibuf_merge_pages(
}
}
os_aio_simulated_wake_handler_threads();
/* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin();

View file

@ -671,7 +671,7 @@ static void get_options(register int *argc, register char ***argv)
if (isatty(fileno(stdout)))
testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
if (*argc == 0)

View file

@ -337,7 +337,7 @@ static void get_options(int *argc, char ***argv)
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
my_progname= argv[0][0];

View file

@ -3339,6 +3339,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
}
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
{
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
str_to_datetime(value, length, tm, 0, &err);
@ -3393,7 +3394,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
longlong value)
{
char *buffer= (char *)param->buffer;
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
uint field_is_unsigned= field->flags & UNSIGNED_FLAG;
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */
@ -3429,7 +3430,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
char buff[22]; /* Enough for longlong */
char *end= longlong10_to_str(value, buff, field_is_unsigned ? 10: -10);
/* Resort to string conversion which supports all typecodes */
fetch_string_with_conversion(param, buff, end - buff);
fetch_string_with_conversion(param, buff, (uint) (end - buff));
break;
}
}
@ -3505,7 +3506,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
sprintf(buff, "%.*f", (int) field->decimals, value);
end= strend(buff);
}
fetch_string_with_conversion(param, buff, end - buff);
fetch_string_with_conversion(param, buff, (uint) (end - buff));
break;
}
}
@ -3590,14 +3591,14 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
{
ulong length;
enum enum_field_types field_type= field->type;
uint field_is_unsigned= field->flags & UNSIGNED_FLAG;
switch (field_type) {
case MYSQL_TYPE_TINY:
{
char value= (char) **row;
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
longlong data= (field_is_unsigned) ? (longlong) (unsigned char) value:
(longlong) value;
longlong data= field_is_unsigned ? (longlong) (unsigned char) value :
(longlong) value;
fetch_long_with_conversion(param, field, data);
length= 1;
break;
@ -3606,19 +3607,18 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_YEAR:
{
short value= sint2korr(*row);
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
longlong data= ((field_is_unsigned) ? (longlong) (unsigned short) value:
(longlong) value);
longlong data= field_is_unsigned ? (longlong) (unsigned short) value :
(longlong) value;
fetch_long_with_conversion(param, field, data);
length= 2;
break;
}
case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */
case MYSQL_TYPE_LONG:
{
long value= sint4korr(*row);
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG);
longlong data= ((field_is_unsigned) ? (longlong) (unsigned long) value:
(longlong) value);
longlong data= field_is_unsigned ? (longlong) (unsigned long) value :
(longlong) value;
fetch_long_with_conversion(param, field, data);
length= 4;
break;

125
libmysqld/libmysqld.rc Executable file
View file

@ -0,0 +1,125 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,20,0
PRODUCTVERSION 4,0,20,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x9L
#else
FILEFLAGS 0x8L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
#ifdef _DEBUG
VALUE "Comments", "Embedded Server\0"
VALUE "CompanyName", "MySQL AB\0"
VALUE "FileDescription", "Embedded Server\0"
VALUE "FileVersion", "4.0.20\0"
VALUE "InternalName", "Embedded Server\0"
VALUE "LegalCopyright", "Copyright © 2004\0"
VALUE "LegalTrademarks", "MySQL and MySQL AB\0"
VALUE "OriginalFilename", "libmysqld.dll debug\0"
VALUE "PrivateBuild", "libmysqld.dll debug \0"
VALUE "ProductName", "libmysqld.dll debug\0"
VALUE "ProductVersion", "4.0.20\0"
VALUE "SpecialBuild", "\0"
#else
VALUE "Comments", "Embedded Server\0"
VALUE "CompanyName", "MySQL AB\0"
VALUE "FileDescription", "Embedded Server\0"
VALUE "FileVersion", "4.0.20\0"
VALUE "InternalName", "Embedded Server\0"
VALUE "LegalCopyright", "Copyright © 2004\0"
VALUE "LegalTrademarks", "MySQL and MySQL AB\0"
VALUE "OriginalFilename", "libmysqld.dll release\0"
VALUE "PrivateBuild", "libmysqld.dll release \0"
VALUE "ProductName", "libmysqld.dll release\0"
VALUE "ProductVersion", "4.0.20\0"
VALUE "SpecialBuild", "\0"
#endif
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

15
libmysqld/resource.h Executable file
View file

@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by libmysqld.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -23,9 +23,9 @@
#include <ieeefp.h>
#endif
#define CHECK_KEYS
#define CHECK_KEYS /* Enable safety checks */
#define FIX_LENGTH \
#define FIX_LENGTH(cs, pos, length, char_length) \
do { \
if (length > char_length) \
char_length= my_charpos(cs, pos, pos+length, char_length); \
@ -48,7 +48,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
DBUG_ENTER("_mi_make_key");
if(info->s->keyinfo[keynr].flag & HA_SPATIAL)
if (info->s->keyinfo[keynr].flag & HA_SPATIAL)
{
/*
TODO: nulls processing
@ -78,7 +78,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
*key++=1; /* Not NULL */
}
char_length= (!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length;
char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen :
length);
pos= (byte*) record+keyseg->start;
if (keyseg->flag & HA_SPACE_PACK)
@ -95,7 +96,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
pos++;
}
length=(uint) (end-pos);
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+=char_length;
@ -106,7 +107,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
uint tmp_length=uint2korr(pos);
pos+=2; /* Skip VARCHAR length */
set_if_smaller(length,tmp_length);
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+= char_length;
@ -117,7 +118,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
set_if_smaller(length,tmp_length);
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+= char_length;
@ -157,7 +158,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
continue;
}
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
memcpy((byte*) key, pos, char_length);
if (length > char_length)
cs->cset->fill(cs, key+char_length, length-char_length, ' ');
@ -237,7 +238,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
}
k_length-=length;
length=(uint) (end-pos);
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
memcpy((byte*) key,pos,(size_t) char_length);
key+= char_length;
@ -250,7 +251,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
k_length-= 2+length;
pos+=2;
set_if_smaller(length,tmp_length); /* Safety */
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
old+=2; /* Skip length */
memcpy((byte*) key, pos,(size_t) char_length);
@ -267,7 +268,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
}
continue;
}
FIX_LENGTH;
FIX_LENGTH(cs, pos, length, char_length);
memcpy((byte*) key, pos, char_length);
if (length > char_length)
cs->cset->fill(cs,key+char_length, length-char_length, ' ');

View file

@ -644,7 +644,7 @@ static void get_options(int argc, char *argv[])
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
return;

View file

@ -68,7 +68,7 @@ int main(int argc,char *argv[])
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
MY_INIT(argv[0]);
if ((error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
exit(error);
if (count || dump)
verbose=0;

View file

@ -696,7 +696,7 @@ static void get_options(register int *argc,register char ***argv)
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */

View file

@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv)
if (isatty(fileno(stdout)))
write_loop=1;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
if (!*argc)

View file

@ -111,10 +111,10 @@ a b
aaa bbb
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
charset(a) charset(b) charset(binary 'ccc')
latin1 binary latin1
latin1 binary binary
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc')
latin1_bin binary latin1_bin
latin1_bin binary binary
drop table t1;
create table t1( firstname char(20), lastname char(20));
insert into t1 values ("john","doe"),("John","Doe");

View file

@ -40,6 +40,7 @@ show tables;
Tables_in_test
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
set password="";
set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3');

View file

@ -1,19 +1,19 @@
drop table if exists t1, t2;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 1
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist

View file

@ -49,8 +49,8 @@ a b
aaa bbb
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
charset(a) charset(b) charset(binary 'ccc')
cp1251 binary cp1251
cp1251 binary binary
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc')
cp1251_bin binary cp1251_bin
cp1251_bin binary binary
drop table t1;

View file

@ -1,5 +1,4 @@
drop table if exists t1;
drop table if exists t2;
drop table if exists t1,t2;
set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1);
left(_utf8 0xD0B0D0B1D0B2,1)

View file

@ -19,7 +19,7 @@ select 'a a' > 'a', 'a \0' < 'a';
1 1
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
1 0 0
1 1 1
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1;
@ -52,13 +52,13 @@ select * from t1 ignore key (key1) where text1='teststring' or text1 like 'tests
text1
teststring
teststring
select * from t1 where text1='teststring' or text1 like 'teststring_%';
text1
teststring
teststring
select * from t1 where text1='teststring' or text1 > 'teststring\t';
text1
teststring
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
concat('|', text1, '|')
|teststring |
|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
concat('|', text1, '|')
|teststring|
select text1, length(text1) from t1 order by text1;
text1 length(text1)
nothing 7
@ -77,7 +77,28 @@ concat('|', text1, '|')
|teststring|
|teststring |
|teststring |
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
concat('|', text1, '|')
|teststring|
|teststring |
select concat('|', text1, '|') from t1 where text1='teststring';
concat('|', text1, '|')
|teststring|
select concat('|', text1, '|') from t1 where text1='teststring ';
concat('|', text1, '|')
|teststring |
alter table t1 modify text1 text not null, pack_keys=1;
select concat('|', text1, '|') from t1 where text1='teststring';
concat('|', text1, '|')
|teststring|
|teststring |
select concat('|', text1, '|') from t1 where text1='teststring ';
concat('|', text1, '|')
|teststring|
|teststring |
explain select concat('|', text1, '|') from t1 where text1='teststring ';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range key1 key1 22 NULL 2 Using where
select * from t1 where text1 like 'teststring_%';
text1
teststring
@ -87,10 +108,10 @@ text1
teststring
teststring
teststring
select * from t1 where text1='teststring' or text1 > 'teststring\t';
text1
teststring
teststring
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
concat('|', text1, '|')
|teststring|
|teststring |
select concat('|', text1, '|') from t1 order by text1;
concat('|', text1, '|')
|nothing|

View file

@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
Warnings:
Note 1003 select if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY'))
Note 1003 select if((test.t1.u = 1),test.t1.st,cast(test.t1.st as char charset binary)) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,cast(test.t1.st as char charset binary))
select nullif(u=0, 'test') from t1;
nullif(u=0, 'test')
NULL

View file

@ -638,7 +638,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#")
12345

View file

@ -466,3 +466,22 @@ insert IGNORE into t1 values ('Garbage');
ERROR HY000: Unknown error
alter table t1 add spatial index(a);
drop table t1;
create table t1(a geometry not null, spatial index(a));
insert into t1 values
(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
or
MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
AsText(a)
POINT(1 1)
POINT(3 3)
POINT(4 4)
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
and
MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
AsText(a)
POINT(1 1)
drop table t1;

View file

@ -127,3 +127,4 @@ having (a.description is not null) and (c=0);
id description c
1 test 0
2 test2 0
drop table t1,t2,t3;

View file

@ -58,3 +58,10 @@ ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2;
show tables;
Tables_in_test
create table t1 (a int);
select TEST.t1.* from TEST.t1;
a
alter table t1 rename to T1;
select TEST.t1.* from TEST.t1;
a
drop table t1;

View file

@ -412,7 +412,6 @@ aaa.
aaa .
select concat(a,'.') from t1 where binary a='aaa';
concat(a,'.')
aaa .
aaa.
update t1 set a='bbb' where a='aaa';
select concat(a,'.') from t1;

View file

@ -205,4 +205,10 @@ a b c
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
a b c
19 4 0
select count(*) from t1 where b = 0;
count(*)
0
select count(*) from t1 where b = 1;
count(*)
1
drop table t1;

View file

@ -593,9 +593,12 @@ create table t1 (id integer primary key auto_increment, txt text, unique index t
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
select * from t1 where txt='Chevy' or txt is NULL;
id txt
3 NULL
1 Chevy
2 Chevy
3 NULL
explain select * from t1 where txt='Chevy' or txt is NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range txt_index txt_index 23 NULL 2 Using where
select * from t1 where txt='Chevy ';
id txt
1 Chevy
@ -663,6 +666,21 @@ id txt
1 Chevy
2 Chevy
4 Ford
alter table t1 modify column txt blob;
explain select * from t1 where txt='Chevy' or txt is NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where
select * from t1 where txt='Chevy' or txt is NULL;
id txt
1 Chevy
3 NULL
explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort
select * from t1 where txt='Chevy' or txt is NULL order by txt;
id txt
3 NULL
1 Chevy
drop table t1;
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');

View file

@ -272,7 +272,7 @@ auto bigint(17) unsigned NULL PRI 0 select,insert,update,references
t1 bigint(1) NULL 0 select,insert,update,references
t2 char(1) latin1_swedish_ci select,insert,update,references
t3 longtext latin1_swedish_ci select,insert,update,references
t4 longtext latin1_bin select,insert,update,references
t4 longblob NULL select,insert,update,references
select * from t2;
auto t1 t2 t3 t4
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

View file

@ -365,3 +365,15 @@ select * from t1;
t1 i
2004-04-01 00:00:00 10
drop table t1;
create table t1 (ts timestamp(19));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1
set TIMESTAMP=1000000000;
insert into t1 values ();
select * from t1;
ts
2001-09-09 04:46:40
drop table t1;

View file

@ -48,6 +48,7 @@ flush privileges;
#connect (con1,localhost,test,gambling2,"");
#show tables;
connect (con1,localhost,test,gambling2,mysql);
set password="";
--error 1105
set password='gambling3';
set password=old_password('gambling3');

View file

@ -12,18 +12,18 @@ drop table if exists t1, t2;
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error 1062;
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146;
select * from t2;
--error 1062;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1;
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146;
select * from t2;

View file

@ -3,8 +3,7 @@
#
--disable_warnings
drop table if exists t1;
drop table if exists t2;
drop table if exists t1,t2;
--enable_warnings
set names utf8;

View file

@ -31,19 +31,25 @@ explain select * from t1 order by text1;
alter table t1 modify text1 char(32) binary not null;
check table t1;
select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select text1, length(text1) from t1 order by text1;
select text1, length(text1) from t1 order by binary text1;
alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
insert into t1 values ('teststring ');
select concat('|', text1, '|') from t1 order by text1;
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 where text1='teststring';
select concat('|', text1, '|') from t1 where text1='teststring ';
alter table t1 modify text1 text not null, pack_keys=1;
select concat('|', text1, '|') from t1 where text1='teststring';
select concat('|', text1, '|') from t1 where text1='teststring ';
explain select concat('|', text1, '|') from t1 where text1='teststring ';
select * from t1 where text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
select concat('|', text1, '|') from t1 order by text1;
drop table t1;

View file

@ -172,3 +172,21 @@ insert IGNORE into t1 values ('Garbage');
alter table t1 add spatial index(a);
drop table t1;
#
# Bug #5219: problem with range optimizer
#
create table t1(a geometry not null, spatial index(a));
insert into t1 values
(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
or
MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
and
MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
drop table t1;

View file

@ -121,3 +121,4 @@ select
from t1 a left join t3 b on a.id=b.order_id
group by a.id, a.description
having (a.description is not null) and (c=0);
drop table t1,t2,t3;

View file

@ -54,3 +54,13 @@ select C.a, c.a from t1 c, t2 C;
drop table t1, t2;
show tables;
#
# Test all caps database name
#
create table t1 (a int);
select TEST.t1.* from TEST.t1;
alter table t1 rename to T1;
select TEST.t1.* from TEST.t1;
drop table t1;

View file

@ -113,6 +113,9 @@ select * from t1 where b<=5 and c=0;
select * from t1 where b=4 and c<=5 order by a;
select * from t1 where b<=4 and c<=5 order by a;
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
select count(*) from t1 where b = 0;
select count(*) from t1 where b = 1;
drop table t1;
#

View file

@ -340,6 +340,7 @@ drop table t1;
create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20)));
insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
select * from t1 where txt='Chevy' or txt is NULL;
explain select * from t1 where txt='Chevy' or txt is NULL;
select * from t1 where txt='Chevy ';
select * from t1 where txt='Chevy ' or txt='Chevy';
select * from t1 where txt='Chevy' or txt='Chevy ';
@ -358,7 +359,13 @@ select * from t1 where txt < 'Chevy ' or txt is NULL;
select * from t1 where txt <= 'Chevy';
select * from t1 where txt > 'Chevy';
select * from t1 where txt >= 'Chevy';
alter table t1 modify column txt blob;
explain select * from t1 where txt='Chevy' or txt is NULL;
select * from t1 where txt='Chevy' or txt is NULL;
explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
select * from t1 where txt='Chevy' or txt is NULL order by txt;
drop table t1;
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';

View file

@ -234,3 +234,13 @@ alter table t1 add i int default 10;
select * from t1;
drop table t1;
# Test for bug #4491, TIMESTAMP(19) should be possible to create and not
# only read in 4.0
#
create table t1 (ts timestamp(19));
show create table t1;
set TIMESTAMP=1000000000;
insert into t1 values ();
select * from t1;
drop table t1;

View file

@ -17,9 +17,9 @@
#include <my_global.h>
#include <m_string.h>
#include <stdlib.h>
#include <my_getopt.h>
#include <my_sys.h>
#include <mysys_err.h>
#include <my_getopt.h>
static int findopt(char *optpat, uint length,
const struct my_option **opt_res,
@ -56,6 +56,13 @@ char *disabled_my_option= (char*) "0";
my_bool my_getopt_print_errors= 1;
void default_reporter(enum loglevel level, const char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
}
/*
function: handle_options
@ -76,10 +83,8 @@ void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint,
}
int handle_options(int *argc, char ***argv,
const struct my_option *longopts,
my_bool (*get_one_option)(int,
const struct my_option *,
char *))
const struct my_option *longopts, my_get_one_option get_one_option,
my_error_reporter reporter)
{
uint opt_found, argvpos= 0, length, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value,
@ -95,6 +100,8 @@ int handle_options(int *argc, char ***argv,
(*argv)++; /* --- || ---- */
init_variables(longopts);
if (! reporter) reporter = &default_reporter;
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{
char *cur_arg= *pos;
@ -118,8 +125,8 @@ int handle_options(int *argc, char ***argv,
if (!*++pos)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: Option '-O' requires an argument\n",
my_progname);
reporter(ERROR_LEVEL, "%s: Option '-O' requires an argument\n",
my_progname);
return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
@ -135,9 +142,8 @@ int handle_options(int *argc, char ***argv,
if (!*cur_arg)
{
if (my_getopt_print_errors)
fprintf(stderr,
"%s: Option '--set-variable' requires an argument\n",
my_progname);
reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
my_progname);
return EXIT_ARGUMENT_REQUIRED;
}
}
@ -149,9 +155,8 @@ int handle_options(int *argc, char ***argv,
if (!*++pos)
{
if (my_getopt_print_errors)
fprintf(stderr,
"%s: Option '--set-variable' requires an argument\n",
my_progname);
reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
my_progname);
return EXIT_ARGUMENT_REQUIRED;
}
cur_arg= *pos;
@ -210,7 +215,7 @@ int handle_options(int *argc, char ***argv,
if (opt_found > 1)
{
if (my_getopt_print_errors)
fprintf(stderr,
reporter(ERROR_LEVEL,
"%s: ambiguous option '--%s-%s' (--%s-%s)\n",
my_progname, special_opt_prefix[i], opt_str,
special_opt_prefix[i], prev_found);
@ -245,18 +250,16 @@ int handle_options(int *argc, char ***argv,
if (must_be_var)
{
if (my_getopt_print_errors)
fprintf(stderr,
"%s: %s: unknown variable '%s'\n", my_progname,
option_is_loose ? "WARNING" : "ERROR", opt_str);
reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
"%s: unknown variable '%s'\n", my_progname, cur_arg);
if (!option_is_loose)
return EXIT_UNKNOWN_VARIABLE;
}
else
{
if (my_getopt_print_errors)
fprintf(stderr,
"%s: %s: unknown option '--%s'\n", my_progname,
option_is_loose ? "WARNING" : "ERROR", opt_str);
reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
"%s: unknown option '--%s'\n", my_progname, cur_arg);
if (!option_is_loose)
return EXIT_UNKNOWN_OPTION;
}
@ -272,14 +275,14 @@ int handle_options(int *argc, char ***argv,
if (must_be_var)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: variable prefix '%s' is not unique\n",
reporter(ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n",
my_progname, opt_str);
return EXIT_VAR_PREFIX_NOT_UNIQUE;
}
else
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n",
reporter(ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n",
my_progname, opt_str, prev_found, optp->name);
return EXIT_AMBIGUOUS_OPTION;
}
@ -300,7 +303,7 @@ int handle_options(int *argc, char ***argv,
if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '%s' cannot take an argument\n",
reporter(ERROR_LEVEL, "%s: option '%s' cannot take an argument\n",
my_progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED;
}
@ -312,7 +315,7 @@ int handle_options(int *argc, char ***argv,
if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' cannot take an argument\n",
reporter(ERROR_LEVEL, "%s: option '--%s' cannot take an argument\n",
my_progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED;
}
@ -351,7 +354,7 @@ int handle_options(int *argc, char ***argv,
if (!*++pos)
{
if (my_getopt_print_errors)
fprintf(stderr, "%s: option '--%s' requires an argument\n",
reporter(ERROR_LEVEL, "%s: option '--%s' requires an argument\n",
my_progname, optp->name);
return EXIT_ARGUMENT_REQUIRED;
}
@ -410,7 +413,7 @@ int handle_options(int *argc, char ***argv,
if (!pos[1])
{
if (my_getopt_print_errors)
fprintf(stderr,
reporter(ERROR_LEVEL,
"%s: option '-%c' requires an argument\n",
my_progname, optp->id);
return EXIT_ARGUMENT_REQUIRED;
@ -423,7 +426,7 @@ int handle_options(int *argc, char ***argv,
if ((error= setval(optp, optp->value, argument,
set_maximum_value)))
{
fprintf(stderr,
reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name);
return error;
@ -435,7 +438,7 @@ int handle_options(int *argc, char ***argv,
if (!opt_found)
{
if (my_getopt_print_errors)
fprintf(stderr,
reporter(ERROR_LEVEL,
"%s: unknown option '-%c'\n", my_progname, *optend);
return EXIT_UNKNOWN_OPTION;
}
@ -445,7 +448,7 @@ int handle_options(int *argc, char ***argv,
}
if ((error= setval(optp, value, argument, set_maximum_value)))
{
fprintf(stderr,
reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name);
return error;

View file

@ -93,6 +93,14 @@ extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
#ifdef SCO
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#endif /* SCO */
#ifdef __cplusplus
}
#endif

View file

@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <FileLogHandler.hpp>
#include <File.hpp>
//
@ -146,7 +146,7 @@ FileLogHandler::createNewFile()
{
bool rc = true;
int fileNo = 1;
char newName[MAXPATHLEN];
char newName[PATH_MAX];
do
{

View file

@ -1188,13 +1188,11 @@ NdbIndexScanOperation::fix_get_values(){
for(Uint32 i = 0; i<cnt; i++){
Uint32 val = theTupleKeyDefined[i][0];
switch(val){
case FAKE_PTR:{
NdbColumnImpl * key = idx->m_columns[i];
NdbColumnImpl * col = tab->getColumn(key->m_keyInfoPos);
curr->setup(col, 0);
}
break;
case FAKE_PTR:
curr->setup(curr->m_column, 0);
case API_PTR:
curr = curr->next();
break;
case SETBOUND_EQ:
break;
#ifdef VM_TRACE
@ -1202,7 +1200,6 @@ NdbIndexScanOperation::fix_get_values(){
abort();
#endif
}
curr = curr->next();
}
}

View file

@ -1753,7 +1753,7 @@ void Field_medium::sql_type(String &res) const
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
{
long tmp;
int error= 0, cuted_fields= 0;
int error= 0;
char *end;
tmp= cs->cset->scan(cs, from, from+len, MY_SEQ_SPACES);
@ -1781,7 +1781,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
#if SIZEOF_LONG > 4
if (unsigned_flag)
{
if (tmp > UINT_MAX32)
if ((ulong) tmp > UINT_MAX32)
{
tmp= UINT_MAX32;
error= 1;
@ -4277,27 +4277,17 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
int Field_str::store(double nr)
{
bool use_scientific_notation=TRUE;
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
uint length;
if (field_length < 32 && nr > 1) // TODO: negative numbers
{
if (ceiling == 0)
{
static double e[]= {1e1, 1e2, 1e4, 1e8, 1e16 };
double p= 1;
for (int i= sizeof(e)/sizeof(e[0]), j= 1<<i ; j; i--, j>>= 1 )
{
if (field_length & j)
p*= e[i];
}
ceiling= p-1;
}
use_scientific_notation= (ceiling < nr);
}
length= (uint)sprintf(buff, "%-.*g",
use_scientific_notation ? max(0,(int)field_length-5) : field_length,
nr);
bool use_scientific_notation= TRUE;
use_scientific_notation= TRUE;
if (field_length < 32 && fabs(nr) < log_10[field_length]-1)
use_scientific_notation= FALSE;
length= (uint) my_sprintf(buff, (buff, "%-.*g",
(use_scientific_notation ?
max(0, (int)field_length-5) :
field_length),
nr));
/*
+1 below is because "precision" in %g above means the
max. number of significant digits, not the output width.
@ -4310,6 +4300,7 @@ int Field_str::store(double nr)
return store((const char *)buff, min(length, field_length), charset());
}
int Field_string::store(longlong nr)
{
char buff[64];
@ -4403,9 +4394,8 @@ char *Field_string::pack(char *to, const char *from, uint max_length)
char *Field_string::pack_key(char *to, const char *from, uint max_length)
{
int length=min(field_length,max_length);
uint char_length= (field_charset->mbmaxlen > 1) ?
max_length/field_charset->mbmaxlen : max_length;
uint length= min(field_length,max_length);
uint char_length= max_length/field_charset->mbmaxlen;
if (length > char_length)
char_length= my_charpos(field_charset, from, from+length, char_length);
set_if_smaller(length, char_length);

View file

@ -336,14 +336,13 @@ public:
class Field_str :public Field {
protected:
CHARSET_INFO *field_charset;
double ceiling; // for ::store(double nr)
public:
Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg,
struct st_table *table_arg,CHARSET_INFO *charset)
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg), ceiling(0.0)
unireg_check_arg, field_name_arg, table_arg)
{
field_charset=charset;
if (charset->state & MY_CS_BINSORT)

View file

@ -362,7 +362,7 @@ static int get_options(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0)))
exit(ho_error);
if (argc >= 1)

View file

@ -1732,8 +1732,8 @@ bool Item_func_in::nulls_in_row()
static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y)
{
return cs->coll->strnncollsp(cs,
(unsigned char *) x->ptr(),x->length(),
(unsigned char *) y->ptr(),y->length());
(uchar *) x->ptr(),x->length(),
(uchar *) y->ptr(),y->length());
}

View file

@ -66,7 +66,8 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
// we can't assign 'item' before, because fix_fields() can change arg
Item *item= *arg;
used_tables_cache |= item->used_tables();
if (const_item_cache&= item->const_item() && !with_null)
const_item_cache&= item->const_item() && !with_null;
if (const_item_cache)
{
if (item->cols() > 1)
with_null|= item->null_inside();

View file

@ -39,7 +39,8 @@ C_MODE_END
String my_empty_string("",default_charset_info);
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname)
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0),
c1.collation->name,c1.derivation_name(),
@ -62,8 +63,9 @@ double Item_str_func::val()
{
DBUG_ASSERT(fixed == 1);
int err;
String *res;
res=val_str(&str_value);
char buff[64];
String *res, tmp(buff,sizeof(buff), &my_charset_bin);
res= val_str(&tmp);
return res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(),
NULL, &err) : 0.0;
}
@ -72,8 +74,9 @@ longlong Item_str_func::val_int()
{
DBUG_ASSERT(fixed == 1);
int err;
String *res;
res=val_str(&str_value);
char buff[22];
String *res, tmp(buff,sizeof(buff), &my_charset_bin);
res= val_str(&tmp);
return (res ?
my_strntoll(res->charset(), res->ptr(), res->length(), 10, NULL,
&err) :
@ -986,10 +989,7 @@ String *Item_func_left::val_str(String *str)
if (res->length() <= (uint) length ||
res->length() <= (char_pos= res->charpos(length)))
return res;
if (&str_value == res)
str_value.length(char_pos);
else
str_value.set(*res, 0, char_pos);
str_value.set(*res, 0, char_pos);
return &str_value;
}
@ -2200,7 +2200,8 @@ String *Item_func_conv_charset::val_str(String *str)
null_value=1;
return 0;
}
null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),conv_charset);
null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),
conv_charset);
return null_value ? 0 : &str_value;
}

View file

@ -1945,13 +1945,12 @@ void Item_func_group_concat::reset_field()
bool
Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
uint i; /* for loop variable */
DBUG_ASSERT(fixed == 0);
if (save_args_for_prepared_statement(thd))
return 1;
uint i; /* for loop variable */
if (!thd->allow_sum_func)
{
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
@ -1971,7 +1970,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1;
if (i < arg_count_field)
maybe_null |= args[i]->maybe_null;
maybe_null|= args[i]->maybe_null;
}
result_field= 0;
@ -2048,7 +2047,8 @@ bool Item_func_group_concat::setup(THD *thd)
of a record instead of a pointer of one.
*/
if (!(table=create_tmp_table(thd, tmp_table_param, all_fields,
(ORDER*) 0, 0, TRUE,select_lex->options | thd->options,
(ORDER*) 0, 0, TRUE,
select_lex->options | thd->options,
HA_POS_ERROR,(char *) "")))
DBUG_RETURN(1);
table->file->extra(HA_EXTRA_NO_ROWS);

View file

@ -1,15 +1,15 @@
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
@ -31,12 +31,51 @@
#include <stdarg.h>
#include <m_ctype.h> // For test_if_number
#ifdef __NT__
#include "message.h"
#endif
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
ulong sync_binlog_counter= 0;
static bool test_if_number(const char *str,
long *res, bool allow_wildcards);
#ifdef __NT__
static int eventSource = 0;
void setupWindowsEventSource()
{
if (eventSource) return;
eventSource = 1;
HKEY hRegKey = NULL;
DWORD dwError = 0;
TCHAR szPath[ MAX_PATH ];
// Create the event source registry key
dwError = RegCreateKey(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL",
&hRegKey);
// Name of the PE module that contains the message resource
GetModuleFileName(NULL, szPath, MAX_PATH);
// Register EventMessageFile
dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ,
(PBYTE) szPath, strlen(szPath)+1);
// Register supported event types
DWORD dwTypes = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
dwError = RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD,
(LPBYTE) &dwTypes, sizeof dwTypes);
RegCloseKey(hRegKey);
}
#endif
/****************************************************************************
** Find a uniq filename for 'filename.#'.
** Set # to a number as low as possible
@ -230,7 +269,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
"started with:\nTcp port: %d Unix socket: %s\n",
my_progname,server_version,mysqld_port,mysqld_unix_port
#endif
);
);
end=strnmov(buff+len,"Time Id Command Argument\n",
sizeof(buff)-len);
if (my_b_write(&log_file, (byte*) buff,(uint) (end-buff)) ||
@ -1940,41 +1979,33 @@ static bool test_if_number(register const char *str,
} /* test_if_number */
void sql_print_error(const char *format,...)
void print_buffer_to_file(enum loglevel level, const char *buffer)
{
va_list args;
time_t skr;
struct tm tm_tmp;
struct tm *start;
va_start(args,format);
DBUG_ENTER("sql_print_error");
DBUG_ENTER("print_buffer_to_log");
VOID(pthread_mutex_lock(&LOCK_error_log));
#ifndef DBUG_OFF
{
char buff[1024];
my_vsnprintf(buff,sizeof(buff)-1,format,args);
DBUG_PRINT("error",("%s",buff));
va_end(args);
va_start(args,format);
}
#endif
skr=time(NULL);
localtime_r(&skr,&tm_tmp);
localtime_r(&skr, &tm_tmp);
start=&tm_tmp;
fprintf(stderr,"%02d%02d%02d %2d:%02d:%02d ",
start->tm_year % 100,
start->tm_mon+1,
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
start->tm_year % 100,
start->tm_mon+1,
start->tm_mday,
start->tm_hour,
start->tm_min,
start->tm_sec);
(void) vfprintf(stderr,format,args);
(void) fputc('\n',stderr);
start->tm_sec,
level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "WARNING" : "INFORMATION",
buffer);
fflush(stderr);
va_end(args);
VOID(pthread_mutex_unlock(&LOCK_error_log));
DBUG_VOID_RETURN;
}
@ -2171,3 +2202,122 @@ void MYSQL_LOG::report_pos_in_innodb()
#endif
DBUG_VOID_RETURN;
}
#ifdef __NT__
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, int buffLen)
{
HANDLE event;
char *buffptr;
LPCSTR *buffmsgptr;
DBUG_ENTER("print_buffer_to_nt_eventlog");
buffptr = buff;
if (strlen(buff) > (uint)(buffLen-4))
{
char *newBuff = new char[ strlen(buff) + 4 ];
strcpy(newBuff, buff);
buffptr = newBuff;
}
strcat(buffptr, "\r\n\r\n");
buffmsgptr = (LPCSTR*)&buffptr;
setupWindowsEventSource();
if (event = RegisterEventSource(NULL,"MySQL"))
{
switch (level){
case ERROR_LEVEL:
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
break;
case WARNING_LEVEL:
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
break;
case INFORMATION_LEVEL:
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL);
break;
}
DeregisterEventSource(event);
}
// if we created a string buffer, then delete it
if (buffptr != buff)
delete[] buffptr;
DBUG_VOID_RETURN;
}
#endif
/*
Prints a printf style message to the error log and, under NT, to the Windows event log.
SYNOPSIS
vprint_msg_to_log()
event_type Type of event to write (Error, Warning, or Info)
format Printf style format of message
args va_list list of arguments for the message
NOTE
IMPLEMENTATION
This function prints the message into a buffer and then sends that buffer to other
functions to write that message to other logging sources.
RETURN VALUES
void
*/
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
{
char buff[1024];
DBUG_ENTER("vprint_msg_to_log");
my_vsnprintf(buff, sizeof(buff)-5, format, args);
print_buffer_to_file(level, buff);
#ifndef DBUG_OFF
DBUG_PRINT("error",("%s",buff));
#endif
#ifdef __NT__
print_buffer_to_nt_eventlog(level, buff, sizeof(buff));
#endif
DBUG_VOID_RETURN;
}
void sql_print_error(const char *format, ...)
{
DBUG_ENTER("sql_print_error");
va_list args;
va_start(args, format);
vprint_msg_to_log(ERROR_LEVEL, format, args);
va_end(args);
DBUG_VOID_RETURN;
}
void sql_print_warning(const char *format, ...)
{
DBUG_ENTER("sql_print_warning");
va_list args;
va_start(args, format);
vprint_msg_to_log(WARNING_LEVEL, format, args);
va_end(args);
DBUG_VOID_RETURN;
}
void sql_print_information(const char *format, ...)
{
DBUG_ENTER("sql_print_information");
va_list args;
va_start(args, format);
vprint_msg_to_log(INFORMATION_LEVEL, format, args);
va_end(args);
DBUG_VOID_RETURN;
}

View file

@ -576,7 +576,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
int mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
ha_rows rows, ulong options);
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok=0);
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
TABLE *open_table(THD *thd,const char *db,const char *table,const char *alias,
bool *refresh);
@ -782,8 +782,14 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
bool init_errmessage(void);
void sql_perror(const char *message);
void sql_print_error(const char *format,...)
__attribute__ ((format (printf, 1, 2)));
void vprint_msg_to_log( enum loglevel level, const char *format, va_list args );
void sql_print_error( const char *format, ... );
void sql_print_warning( const char *format, ...);
void sql_print_information( const char *format, ...);
bool fn_format_relative_to_data_home(my_string to, const char *name,
const char *dir, const char *extension);
bool open_log(MYSQL_LOG *log, const char *hostname,

View file

@ -6078,7 +6078,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
return 0;
}
/* Initiates DEBUG - but no debugging here ! */
extern "C" gptr *
mysql_getopt_value(const char *keyname, uint key_length,
@ -6108,6 +6108,13 @@ mysql_getopt_value(const char *keyname, uint key_length,
return option->value;
}
void option_error_reporter( enum loglevel level, const char *format, ... )
{
va_list args;
va_start( args, format );
vprint_msg_to_log( level, format, args );
va_end( args );
}
static void get_options(int argc,char **argv)
{
@ -6116,7 +6123,7 @@ static void get_options(int argc,char **argv)
my_getopt_register_get_addr(mysql_getopt_value);
strmake(def_ft_boolean_syntax, ft_boolean_syntax,
sizeof(ft_boolean_syntax)-1);
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)) != 0)
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, option_error_reporter)))
exit(ho_error);
if (argc > 0)
{

View file

@ -1302,14 +1302,14 @@ tree_and(PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2)
if (*key2 && !(*key2)->simple_key())
flag|=CLONE_KEY2_MAYBE;
*key1=key_and(*key1,*key2,flag);
if ((*key1)->type == SEL_ARG::IMPOSSIBLE)
if (*key1 && (*key1)->type == SEL_ARG::IMPOSSIBLE)
{
tree1->type= SEL_TREE::IMPOSSIBLE;
#ifdef EXTRA_DEBUG
(*key1)->test_use_count(*key1);
#endif
break;
}
#ifdef EXTRA_DEBUG
(*key1)->test_use_count(*key1);
#endif
}
}
DBUG_RETURN(tree1);
@ -1456,6 +1456,13 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
return key1;
}
if ((key1->min_flag | key2->min_flag) & GEOM_FLAG)
{
key1->free_tree();
key2->free_tree();
return 0; // Can't optimize this
}
key1->use_count--;
key2->use_count--;
SEL_ARG *e1=key1->first(), *e2=key2->first(), *new_tree=0;
@ -1538,7 +1545,8 @@ key_or(SEL_ARG *key1,SEL_ARG *key2)
key1->use_count--;
key2->use_count--;
if (key1->part != key2->part)
if (key1->part != key2->part ||
(key1->min_flag | key2->min_flag) & GEOM_FLAG)
{
key1->free_tree();
key2->free_tree();

View file

@ -200,7 +200,7 @@ net_printf(THD *thd, uint errcode, ...)
2+SQLSTATE_LENGTH+1 : 2) : 0);
#ifndef EMBEDDED_LIBRARY
text_pos=(char*) net->buff + head_length + offset + 1;
length=(char*)net->buff_end-text_pos;
length= (uint) ((char*)net->buff_end - text_pos);
#else
length=sizeof(text_pos)-1;
#endif

View file

@ -551,21 +551,19 @@ static ulong get_sort(uint count,...)
uint chars= 0;
uint wild_pos= 0; /* first wildcard position */
if (start= str)
if ((start= str))
{
for (; *str ; str++)
{
if (*str == wild_many || *str == wild_one || *str == wild_prefix)
{
wild_pos= str - start + 1;
wild_pos= (uint) (str - start) + 1;
break;
}
else
chars++;
chars= 128; // Marker that chars existed
}
}
sort= (sort << 8) + (wild_pos ? (wild_pos > 127 ? 127 : wild_pos) :
(chars ? 128 : 0));
sort= (sort << 8) + (wild_pos ? min(wild_pos, 127) : chars);
}
va_end(args);
return sort;

View file

@ -2441,9 +2441,20 @@ bool
insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
const char *table_name, List_iterator<Item> *it)
{
char name_buff[NAME_LEN+1];
uint found;
DBUG_ENTER("insert_fields");
if (db_name && lower_case_table_names)
{
/* convert database to lower case for comparison */
strmake(name_buff, db_name, sizeof(name_buff)-1);
my_casedn_str(system_charset_info,name_buff);
db_name = name_buff;
}
found=0;
for (; tables ; tables=tables->next)
{

View file

@ -2740,7 +2740,7 @@ unsent_create_error:
send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION,NullS);
goto error;
}
res=mysql_truncate(thd,tables);
res=mysql_truncate(thd, tables, 0);
break;
case SQLCOM_DELETE:
{

View file

@ -833,7 +833,8 @@ JOIN::optimize()
((group_list && const_tables != tables &&
(!simple_group ||
!test_if_skip_sort_order(&join_tab[const_tables], group_list,
unit->select_limit_cnt, 0))) || select_distinct) &&
unit->select_limit_cnt, 0))) ||
select_distinct) &&
tmp_table_param.quick_group && !procedure)
{
need_tmp=1; simple_order=simple_group=0; // Force tmp table without sort
@ -2163,22 +2164,32 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond,
number. cmp_type() is checked to allow compare of dates to numbers.
eq_func is NEVER true when num_values > 1
*/
if (!eq_func ||
field->result_type() == STRING_RESULT &&
(*value)->result_type() != STRING_RESULT &&
field->cmp_type() != (*value)->result_type())
return;
/*
We can't use indexes if the effective collation
of the operation differ from the field collation.
*/
if (field->result_type() == STRING_RESULT &&
(*value)->result_type() == STRING_RESULT &&
field->cmp_type() == STRING_RESULT &&
((Field_str*)field)->charset() != cond->compare_collation())
return;
if (!eq_func)
return;
if (field->result_type() == STRING_RESULT)
{
if ((*value)->result_type() != STRING_RESULT)
{
if (field->cmp_type() != (*value)->result_type())
return;
}
else
{
/*
We can't use indexes if the effective collation
of the operation differ from the field collation.
We can also not used index on a text column, as the column may
contain 'x' 'x\t' 'x ' and 'read_next_same' will stop after
'x' when searching for WHERE col='x '
*/
if (field->cmp_type() == STRING_RESULT &&
(((Field_str*)field)->charset() != cond->compare_collation() ||
((*value)->type() != Item::NULL_ITEM &&
(field->flags & BLOB_FLAG) && !field->binary())))
return;
}
}
}
}
DBUG_ASSERT(num_values == 1);
@ -5564,9 +5575,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
table->file->info(HA_STATUS_VARIABLE); /* update table->file->records */
new_table.file->start_bulk_insert(table->file->records);
#else
/*
HA_EXTRA_WRITE_CACHE can stay until close, no need to disable it explicitly.
*/
/* HA_EXTRA_WRITE_CACHE can stay until close, no need to disable it */
new_table.file->extra(HA_EXTRA_WRITE_CACHE);
#endif
@ -7234,9 +7243,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
keys.merge(table->used_keys);
/*
We are adding here also the index speified in FORCE INDEX clause,
We are adding here also the index specified in FORCE INDEX clause,
if any.
This is to allow users to use index in ORDER BY.
This is to allow users to use index in ORDER BY.
*/
if (table->force_index)
keys.merge(table->keys_in_use_for_query);

View file

@ -2745,8 +2745,7 @@ simple_expr:
| ASCII_SYM '(' expr ')' { $$= new Item_func_ascii($3); }
| BINARY expr %prec NEG
{
$$= new Item_func_set_collation($2,new Item_string(binary_keyword,
6, &my_charset_latin1));
$$= create_func_cast($2, ITEM_CAST_CHAR, -1, &my_charset_bin);
}
| CAST_SYM '(' expr AS cast_type ')'
{

View file

@ -2158,20 +2158,21 @@ my_tz_find(const String * name, TABLE_LIST *tz_tables)
if (!(result_tz= new (&tz_storage) Time_zone_offset(offset)) ||
my_hash_insert(&offset_tzs, (const byte *) result_tz))
{
result_tz= 0;
sql_print_error("Fatal error: Out of memory "
"while setting new time zone");
result_tz= 0;
}
}
} else {
}
else
{
result_tz= 0;
if ((tmp_tzname= (TZ_NAMES_ENTRY *)hash_search(&tz_names,
(const byte *)name->ptr(),
name->length())))
result_tz= tmp_tzname->tz;
else if(time_zone_tables_exist)
else if (time_zone_tables_exist)
result_tz= tz_load_from_open_tables(name, tz_tables);
else
result_tz= 0;
}
VOID(pthread_mutex_unlock(&tz_LOCK));

View file

@ -93,7 +93,7 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
NOTE
This function is used for real binary strings, i.e. for
BLOB, BINARY(N) and VARBINARY(N).
It does not ignore trailing spaces.
It compares trailing spaces as spaces.
RETURN
< 0 s < t
@ -133,7 +133,8 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
NOTE
This function is used for character strings with binary collations.
It ignores trailing spaces.
The shorter string is extended with end space to be as long as the longer
one.
RETURN
< 0 s < t

View file

@ -701,7 +701,7 @@ CHARSET_INFO my_charset_latin1_german2_ci=
ctype_latin1,
to_lower_latin1,
to_upper_latin1,
NULL,
sort_order_latin1_de,
NULL, /* contractions */
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */

View file

@ -237,7 +237,8 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
if (str++ == str_end) return (-1);
}
{
int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,
w_many);
if (tmp <= 0)
return (tmp);
}
@ -248,41 +249,46 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)),
const char *b, const char *e)
const char *pos, const char *end)
{
register uint32 n=0,mblen;
while (b < e)
register uint32 count=0;
while (pos < end)
{
b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
++n;
uint mblen;
pos+= (mblen= my_ismbchar(cs,pos,end)) ? mblen : 1;
count++;
}
return n;
return count;
}
uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
const char *b, const char *e, uint pos)
const char *pos, const char *end, uint length)
{
uint mblen;
const char *b0=b;
const char *start= pos;
while (pos && b<e)
while (length && pos < end)
{
b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
pos--;
uint mblen;
pos+= (mblen= my_ismbchar(cs, pos, end)) ? mblen : 1;
length--;
}
return pos ? e+2-b0 : b-b0;
return length ? end+2-start : pos-start;
}
uint my_well_formed_len_mb(CHARSET_INFO *cs,
const char *b, const char *e, uint pos)
{
my_wc_t wc;
int mblen;
const char *b_start= b;
while (pos)
{
my_wc_t wc;
int mblen;
if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <0)
break;
b+= mblen;
@ -374,7 +380,8 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
NOTE
This function is used for character strings with binary collations.
It ignores trailing spaces.
The shorter string is extended with end space to be as long as the longer
one.
RETURN
A negative number if s < t

View file

@ -35,8 +35,12 @@
it can be compiled with the UNSIGNED and/or LONGLONG flag set
*/
#include <my_global.h>
#include "m_string.h"
#if !defined(_global_h) || !defined(_m_string_h)
# error Calling file must include 'my_global.h' and 'm_string.h'
/* see 'strtoll.c' and 'strtoull.c' for the reasons */
#endif
#include "m_ctype.h"
#include "my_sys.h" /* defines errno */
#include <errno.h>

View file

@ -14,9 +14,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This defines strtol() if neaded */
/* This implements strtol() if needed */
/*
These includes are mandatory because they check for type sizes and
functions, especially they handle tricks for Tru64 where 'long' is
64 bit already and our 'longlong' is just a 'long'.
*/
#include <my_global.h>
#include <m_string.h>
#if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__)
#include "strto.c"
#endif

View file

@ -14,11 +14,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This is defines strtoll() if neaded */
/* This implements strtoll() if needed */
#define strtoll glob_strtoll /* Fix for True64 */
/*
These includes are mandatory because they check for type sizes and
functions, especially they handle tricks for Tru64 where 'long' is
64 bit already and our 'longlong' is just a 'long'.
This solves a problem on Tru64 where the C99 compiler has a prototype
for 'strtoll()' but no implementation, see "6.1 New C99 library functions"
in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
*/
#include <my_global.h>
#include <m_string.h>
#if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG)
#define USE_LONGLONG
#include "strto.c"

View file

@ -14,9 +14,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This is defines strtoul() if neaded */
/* This implements strtol() if needed */
/*
These includes are mandatory because they check for type sizes and
functions, especially they handle tricks for Tru64 where 'long' is
64 bit already and our 'longlong' is just a 'long'.
*/
#include <my_global.h>
#include <m_string.h>
#if !defined(MSDOS) && !defined(HAVE_STRTOUL)
#define USE_UNSIGNED
#include "strto.c"

View file

@ -14,9 +14,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This is defines strtoull() */
/* This implements strtoull() if needed */
/*
These includes are mandatory because they check for type sizes and
functions, especially they handle tricks for Tru64 where 'long' is
64 bit already and our 'longlong' is just a 'long'.
This solves a problem on Tru64 where the C99 compiler has a prototype
for 'strtoull()' but no implementation, see "6.1 New C99 library functions"
in file '/usr/share/doclib/cc.dtk/release_notes.txt'.
*/
#include <my_global.h>
#include <m_string.h>
#if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG)
#define USE_UNSIGNED
#define USE_LONGLONG

View file

@ -22,7 +22,7 @@ EXTRA_DIST = mysql.spec.sh \
my-medium.cnf.sh \
my-large.cnf.sh \
my-huge.cnf.sh \
my-innodb-heavy-4G \
my-innodb-heavy-4G.cnf.sh \
mysql-log-rotate.sh \
mysql.server.sh \
binary-configure.sh \

View file

@ -156,7 +156,7 @@ Summary: MySQL - server with Berkeley DB, RAID and UDF support
Group: Applications/Databases
Provides: mysql-Max
Obsoletes: mysql-Max
Requires: MySQL >= 4.0
Requires: MySQL-server >= 4.0
%description Max
Optional MySQL server binary that supports additional features like
@ -594,8 +594,13 @@ fi
%attr(644, root, root) %{_libdir}/mysql/libmysqld.a
# The spec file changelog only includes changes made to the spec file
# itself
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Thu Aug 26 2004 Lenz Grimmer <lenz@mysql.com>
- MySQL-Max now requires MySQL-server instead of MySQL (BUG 3860)
* Fri Aug 20 2004 Lenz Grimmer <lenz@mysql.com>
- do not link statically on IA64/AMD64 as these systems do not have

View file

@ -10044,6 +10044,53 @@ static void test_bug4030()
}
static void test_bug5126()
{
MYSQL_STMT *stmt;
MYSQL_BIND bind[2];
long c1, c2;
const char *stmt_text;
int rc;
myheader("test_bug5126");
stmt_text= "DROP TABLE IF EXISTS t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a mediumint, b int)";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "INSERT INTO t1 VALUES (8386608, 1)";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "SELECT a, b FROM t1";
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
/* Bind output buffers */
bzero(bind, sizeof(bind));
bind[0].buffer_type= MYSQL_TYPE_LONG;
bind[0].buffer= &c1;
bind[1].buffer_type= MYSQL_TYPE_LONG;
bind[1].buffer= &c2;
mysql_stmt_bind_result(stmt, bind);
rc= mysql_stmt_fetch(stmt);
assert(rc == 0);
assert(c1 == 8386608 && c2 == 1);
printf("%ld, %ld\n", c1, c2);
mysql_stmt_close(stmt);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@ -10142,7 +10189,7 @@ static void get_options(int argc, char **argv)
int ho_error;
if ((ho_error= handle_options(&argc, &argv, client_test_long_options,
get_one_option)))
get_one_option, 0)))
exit(ho_error);
if (tty_password)
@ -10341,6 +10388,7 @@ int main(int argc, char **argv)
test_bug4236(); /* init -> execute */
test_bug4030(); /* test conversion string -> time types in
libmysql */
test_bug5126(); /* support for mediumint type in libmysql */
/*
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.

View file

@ -1335,7 +1335,7 @@ static int parse_args(int argc, char **argv)
{
int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL)))
exit(ho_error);
return 0;