Commit d49166f8 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-prepared-4.1
parents 2d5338ce 9aae5917
......@@ -361,6 +361,7 @@ libmysqld/item_func.cc
libmysqld/item_geofunc.cc
libmysqld/item_row.cc
libmysqld/item_strfunc.cc
libmysqld/item_subselect.cc
libmysqld/item_sum.cc
libmysqld/item_timefunc.cc
libmysqld/item_uniq.cc
......@@ -396,6 +397,7 @@ libmysqld/sql_command
libmysqld/sql_crypt.cc
libmysqld/sql_db.cc
libmysqld/sql_delete.cc
libmysqld/sql_derived.cc
libmysqld/sql_do.cc
libmysqld/sql_handler.cc
libmysqld/sql_help.cc
......
......@@ -1824,29 +1824,32 @@ AC_TYPE_SIGNAL
MYSQL_TYPE_QSORT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bmove \
chsize ftruncate rint finite isnan fpsetmask fpresetsticky\
cuserid fcntl fconvert poll \
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
perror pread realpath readlink rename \
socket strnlen madvise mallinfo mkstemp \
strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency \
gethostbyaddr_r gethostbyname_r getpwnam \
bfill bzero bcmp strstr strpbrk strerror \
tell isinf memcpy memmove \
setupterm strcasecmp sighold vidattr lrand48 localtime_r gmtime_r \
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_attr_getstacksize pthread_key_delete \
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
fsync fdatasync fchmod getpass getpassphrase initgroups mlockall)
AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
mkstemp mlockall perror poll pread pthread_attr_create \
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
realpath rename rint rwlock_init setupterm sighold sigset sigthreadmask \
snprintf socket stpcpy strcasecmp strerror strnlen strpbrk strstr strtol \
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr)
# isinf() could be a function or a macro (HPUX)
AC_MSG_CHECKING(for isinf with <math.h>)
AC_TRY_LINK([#include <math.h>], [float f = 0.0; isinf(f)],
AC_MSG_RESULT(yes) AC_DEFINE(HAVE_ISINF,,[isinf() macro or function]),
AC_MSG_RESULT(no))
CFLAGS="$ORG_CFLAGS"
# Sanity check: We chould not have any fseeko symbol unless
# large_file_support=yes
AC_CHECK_FUNCS(fseeko,
AC_CHECK_FUNC(fseeko,
[if test "$large_file_support" = no -a "$IS_LINUX" = "true";
then
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!");
......
......@@ -52,7 +52,7 @@ extern const char *ft_precompiled_stopwords[];
extern ulong ft_min_word_len;
extern ulong ft_max_word_len;
extern ulong ft_query_expansion_limit;
extern const char *ft_boolean_syntax;
extern char ft_boolean_syntax[15];
int ft_init_stopwords(void);
void ft_free_stopwords(void);
......@@ -63,6 +63,7 @@ void ft_free_stopwords(void);
#define FT_EXPAND 4 /* query expansion */
FT_INFO *ft_init_search(uint,void *, uint, byte *, uint, byte *);
my_bool ft_boolean_check_syntax_string(const byte *);
#ifdef __cplusplus
}
......
......@@ -384,8 +384,8 @@ typedef unsigned short ushort;
#define sgn(a) (((a) < 0) ? -1 : ((a) > 0) ? 1 : 0)
#define swap(t,a,b) { register t dummy; dummy = a; a = b; b = dummy; }
#define test(a) ((a) ? 1 : 0)
#define set_if_bigger(a,b) { if ((a) < (b)) (a)=(b); }
#define set_if_smaller(a,b) { if ((a) > (b)) (a)=(b); }
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
......
......@@ -2877,6 +2877,9 @@ DLLTOOL="$DLLTOOL"
# Used on cygwin: object dumper.
OBJDUMP="$OBJDUMP"
# compatibility with ancient libtool :)
SED=sed
# Used on cygwin: assembler.
AS="$AS"
......
......@@ -132,7 +132,7 @@ win32_libid () {
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
win32_nmres=`eval $NM -f posix -A $1 | \
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
$SED -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
if test "X$win32_nmres" = "Ximport" ; then
win32_libid_type="x86 archive import"
else
......
......@@ -174,7 +174,7 @@ static int walk_and_push(FT_SUPERDOC *from,
{
DBUG_ENTER("walk_and_copy");
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
set_if_smaller(best->elements, ft_query_expansion_limit-1)
set_if_smaller(best->elements, ft_query_expansion_limit-1);
queue_insert(best, (byte *)& from->doc);
DBUG_RETURN(0);
}
......
......@@ -73,6 +73,26 @@ FT_WORD * ft_linearize(TREE *wtree)
DBUG_RETURN(wlist);
}
my_bool ft_boolean_check_syntax_string(const byte *str)
{
uint i, j;
if (!str ||
(strlen(str)+1 != sizeof(ft_boolean_syntax)) ||
(str[0] != ' ' && str[1] != ' '))
return 1;
for (i=0; i<sizeof(ft_boolean_syntax); i++)
{
/* limiting to 7-bit ascii only */
if ((unsigned char)(str[i]) > 127 || my_isalnum(default_charset_info, str[i]))
return 1;
for (j=0; j<i; j++)
if (str[i] == str[j] && (i != 11 || j != 10))
return 1;
}
return 0;
}
/* returns:
* 0 - eof
* 1 - word found
......
......@@ -21,7 +21,7 @@
ulong ft_min_word_len=4;
ulong ft_max_word_len=HA_FT_MAXCHARLEN;
ulong ft_query_expansion_limit=5;
const char *ft_boolean_syntax="+ -><()~*:\"\"&|";
char ft_boolean_syntax[]="+ -><()~*:\"\"&|";
const HA_KEYSEG ft_keysegs[FT_SEGS]={
{
......
......@@ -168,4 +168,4 @@ hex(s1)
41
drop table t1;
create table t1 (a char(160) character set utf8, primary key(a));
ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
ERROR 42000: Specified key was too long; max key length is 255 bytes
drop table if exists t1;
show variables like "ft\_%";
Variable_name Value
ft_boolean_syntax + -><()~*:""&|
......@@ -5,3 +6,33 @@ ft_min_word_len 4
ft_max_word_len 84
ft_query_expansion_limit 20
ft_stopword_file (built-in)
create table t1 (b text not null);
insert t1 values ('aaaaaa bbbbbb cccccc');
insert t1 values ('bbbbbb cccccc');
insert t1 values ('aaaaaa cccccc');
select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
b
aaaaaa bbbbbb cccccc
aaaaaa cccccc
set ft_boolean_syntax=' +-><()~*:""&|';
ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
set global ft_boolean_syntax=' +-><()~*:""&|';
select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
b
aaaaaa bbbbbb cccccc
bbbbbb cccccc
set global ft_boolean_syntax='@ -><()~*:""&|';
select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
b
aaaaaa bbbbbb cccccc
bbbbbb cccccc
aaaaaa cccccc
select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
b
aaaaaa bbbbbb cccccc
bbbbbb cccccc
set global ft_boolean_syntax='@ -><()~*:""@|';
ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '@ -><()~*:""@|'
set global ft_boolean_syntax='+ -><()~*:""@!|';
ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '+ -><()~*:""@!|'
drop table t1;
......@@ -323,10 +323,10 @@ Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
ERROR 42000: Specified key was too long. Max key length is 500
ERROR 42000: Specified key was too long; max key length is 500 bytes
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
ALTER TABLE t1 ADD INDEX t1 (a, b, c);
ERROR 42000: Specified key was too long. Max key length is 500
ERROR 42000: Specified key was too long; max key length is 500 bytes
DROP TABLE t1;
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
......
......@@ -3,7 +3,6 @@ DROP DATABASE IF EXISTS test_$1;
create database test_$1;
create table test_$1.r1 (i int) raid_type=1;
create table test_$1.r2 (i int) raid_type=1 raid_chunks=32;
DROP TABLE IF EXISTS t1,t2;
drop database test_$1;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
......
......@@ -346,9 +346,17 @@ HELLO MY 1
a 1
hello 1
drop table t1;
create table t1 (a text, unique (a(300)));
ERROR 42000: Specified key was too long; max key length is 255 bytes
create table t1 (a text, key (a(300)));
ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
create table t1 (a text, key (a(255)));
Warnings:
Warning 1071 Specified key was too long; max key length is 255 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text,
KEY `a` (`a`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 (
t1_id bigint(21) NOT NULL auto_increment,
......
......@@ -103,5 +103,5 @@ drop table t1;
# Bug 2699
# UTF8 breaks primary keys for cols > 85 characters
#
--error 1089
--error 1071
create table t1 (a char(160) character set utf8, primary key(a));
#
# Fulltext configurable parameters
#
--disable_warnings
drop table if exists t1;
--enable_warnings
show variables like "ft\_%";
create table t1 (b text not null);
insert t1 values ('aaaaaa bbbbbb cccccc');
insert t1 values ('bbbbbb cccccc');
insert t1 values ('aaaaaa cccccc');
select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
-- error 1229
set ft_boolean_syntax=' +-><()~*:""&|';
set global ft_boolean_syntax=' +-><()~*:""&|';
select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
set global ft_boolean_syntax='@ -><()~*:""&|';
select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
-- error 1231
set global ft_boolean_syntax='@ -><()~*:""@|';
-- error 1231
set global ft_boolean_syntax='+ -><()~*:""@!|';
drop table t1;
......@@ -121,8 +121,10 @@ select c,count(*) from t1 group by c;
select d,count(*) from t1 group by d;
drop table t1;
!$1089 create table t1 (a text, key (a(300))); # should give an error
create table t1 (a text, key (a(255)));
-- error 1071
create table t1 (a text, unique (a(300))); # should give an error
create table t1 (a text, key (a(300))); # key is auto-truncated
show create table t1;
drop table t1;
#
......
......@@ -1961,7 +1961,7 @@ int key_cache_write(KEY_CACHE *keycache,
else if (! (block->status & BLOCK_CHANGED))
link_to_changed_list(keycache, block);
set_if_smaller(block->offset, offset)
set_if_smaller(block->offset, offset);
set_if_bigger(block->length, read_length+offset);
if (! (block->status & BLOCK_ERROR))
......
......@@ -779,7 +779,8 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
extern time_t start_time;
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[];
mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[],
opt_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
extern MY_TMPDIR mysql_tmpdir_list;
extern const char *command_name[];
......
......@@ -318,7 +318,8 @@ char* log_error_file_ptr= log_error_file;
char mysql_real_data_home[FN_REFLEN],
language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file,
*opt_init_connect, *opt_init_slave;
*opt_init_connect, *opt_init_slave,
opt_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
const char *opt_date_time_formats[3];
......@@ -3603,7 +3604,7 @@ enum options_mysqld
OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE,
OPT_CONNECT_TIMEOUT, OPT_DELAYED_INSERT_TIMEOUT,
OPT_DELAYED_INSERT_LIMIT, OPT_DELAYED_QUEUE_SIZE,
OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN,
OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, OPT_FT_BOOLEAN_SYNTAX,
OPT_FT_MAX_WORD_LEN, OPT_FT_QUERY_EXPANSION_LIMIT, OPT_FT_STOPWORD_FILE,
OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
......@@ -3926,7 +3927,8 @@ Disable with --skip-bdb (will save memory).",
0, 0, 0, 0},
{"master-password", OPT_MASTER_PASSWORD,
"The password the slave thread will authenticate with when connecting to the master. If not set, an empty password is assumed.The value in master.info will take precedence if it can be read.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(gptr*)&master_password, (gptr*)&master_password, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-port", OPT_MASTER_PORT,
"The port the master is listening on. If not set, the compiled setting of MYSQL_PORT is assumed. If you have not tinkered with configure options, this should be 3306. The value in master.info will take precedence if it can be read.",
(gptr*) &master_port, (gptr*) &master_port, 0, GET_UINT, REQUIRED_ARG,
......@@ -4257,6 +4259,10 @@ replicating a LOAD DATA INFILE command.",
"A dedicated thread is created to flush all tables at the given interval.",
(gptr*) &flush_time, (gptr*) &flush_time, 0, GET_ULONG, REQUIRED_ARG,
FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0},
{ "ft_boolean_syntax", OPT_FT_BOOLEAN_SYNTAX,
"List of operators for MATCH ... AGAINST ( ... IN BOOLEAN MODE)",
0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "ft_min_word_len", OPT_FT_MIN_WORD_LEN,
"The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable.",
(gptr*) &ft_min_word_len, (gptr*) &ft_min_word_len, 0, GET_ULONG,
......@@ -5435,8 +5441,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_STORAGE_ENGINE:
{
if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN)
{
fprintf(stderr,"Unknown table type: %s\n",argument);
exit(1);
......@@ -5608,8 +5614,13 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
global_system_variables.sql_mode= fix_sql_mode(global_system_variables.
sql_mode);
}
case OPT_MASTER_PASSWORD:
master_password=argument;
case OPT_FT_BOOLEAN_SYNTAX:
if (ft_boolean_check_syntax_string(argument))
{
fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument);
exit(1);
}
strnmov(opt_ft_boolean_syntax, argument, sizeof(ft_boolean_syntax));
break;
case OPT_SKIP_SAFEMALLOC:
#ifdef SAFEMALLOC
......@@ -5658,6 +5669,7 @@ static void get_options(int argc,char **argv)
int ho_error;
my_getopt_register_get_addr(mysql_getopt_value);
strnmov(opt_ft_boolean_syntax, ft_boolean_syntax, sizeof(ft_boolean_syntax));
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
if (argc > 0)
......@@ -5713,6 +5725,8 @@ static void get_options(int argc,char **argv)
table_alias_charset= (lower_case_table_names ?
files_charset_info :
&my_charset_bin);
strnmov(ft_boolean_syntax, opt_ft_boolean_syntax, sizeof(ft_boolean_syntax));
if (opt_short_log_format)
opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
if (opt_log_queries_not_using_indexes)
......
......@@ -19,18 +19,18 @@
To add a new variable, one has to do the following:
- If the variable is thread specific, add it to 'system_variables' struct.
If not, add it to mysqld.cc and an declaration in 'mysql_priv.h'
- Don't forget to initialize new fields in global_system_variables and
max_system_variables!
- Use one of the 'sys_var... classes from set_var.h or write a specific
one for the variable type.
- Define it in the 'variable definition list' in this file.
- If the variable should be changeable or one should be able to access it
with @@variable_name, it should be added to the 'list of all variables'
list in this file.
list (sys_variables) in this file.
- If the variable is thread specific, add it to 'system_variables' struct.
If not, add it to mysqld.cc and an declaration in 'mysql_priv.h'
- If the variable should be changed from the command line, add a definition
of it in the my_option structure list in mysqld.dcc
- Don't forget to initialize new fields in global_system_variables and
max_system_variables!
- If the variable should show up in 'show variables' add it to the
init_vars[] struct in this file
......@@ -73,9 +73,12 @@ TYPELIB delay_key_write_typelib=
array_elements(delay_key_write_type_names)-1, "", delay_key_write_type_names
};
static bool sys_check_charset(THD *thd, set_var *var);
static int sys_check_charset(THD *thd, set_var *var);
static bool sys_update_charset(THD *thd, set_var *var);
static void sys_set_default_charset(THD *thd, enum_var_type type);
static int sys_check_ftb_syntax(THD *thd, set_var *var);
static bool sys_update_ftb_syntax(THD *thd, set_var * var);
static void sys_default_ftb_syntax(THD *thd, enum_var_type type);
static bool sys_update_init_connect(THD*, set_var*);
static void sys_default_init_connect(THD*, enum_var_type type);
static bool sys_update_init_slave(THD*, set_var*);
......@@ -119,12 +122,6 @@ sys_var_str sys_charset_system("character_set_system",
sys_check_charset,
sys_update_charset,
sys_set_default_charset);
sys_var_str sys_init_connect("init_connect", 0,
sys_update_init_connect,
sys_default_init_connect);
sys_var_str sys_init_slave("init_slave", 0,
sys_update_init_slave,
sys_default_init_slave);
sys_var_character_set_database sys_character_set_database("character_set_database");
sys_var_character_set_client sys_character_set_client("character_set_client");
sys_var_character_set_connection sys_character_set_connection("character_set_connection");
......@@ -150,6 +147,16 @@ sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
&expire_logs_days);
sys_var_bool_ptr sys_flush("flush", &myisam_flush);
sys_var_long_ptr sys_flush_time("flush_time", &flush_time);
sys_var_str sys_ft_boolean_syntax("ft_boolean_syntax",
sys_check_ftb_syntax,
sys_update_ftb_syntax,
sys_default_ftb_syntax);
sys_var_str sys_init_connect("init_connect", 0,
sys_update_init_connect,
sys_default_init_connect);
sys_var_str sys_init_slave("init_slave", 0,
sys_update_init_slave,
sys_default_init_slave);
sys_var_thd_ulong sys_interactive_timeout("interactive_timeout",
&SV::net_interactive_timeout);
sys_var_thd_ulong sys_join_buffer_size("join_buffer_size",
......@@ -318,7 +325,7 @@ sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
#ifdef HAVE_INNOBASE_DB
sys_var_long_ptr sys_innodb_max_dirty_pages_pct("innodb_max_dirty_pages_pct",
&srv_max_buf_pool_modified_pct);
#endif
#endif
/* Time/date/datetime formats */
......@@ -450,6 +457,7 @@ sys_var *sys_variables[]=
&sys_expire_logs_days,
&sys_flush,
&sys_flush_time,
&sys_ft_boolean_syntax,
&sys_foreign_key_checks,
&sys_group_concat_max_len,
&sys_identity,
......@@ -593,7 +601,7 @@ struct show_var_st init_vars[]= {
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
{sys_flush.name, (char*) &sys_flush, SHOW_SYS},
{sys_flush_time.name, (char*) &sys_flush_time, SHOW_SYS},
{"ft_boolean_syntax", (char*) ft_boolean_syntax, SHOW_CHAR},
{sys_ft_boolean_syntax.name,(char*) &ft_boolean_syntax, SHOW_CHAR},
{"ft_min_word_len", (char*) &ft_min_word_len, SHOW_LONG},
{"ft_max_word_len", (char*) &ft_max_word_len, SHOW_LONG},
{"ft_query_expansion_limit",(char*) &ft_query_expansion_limit, SHOW_LONG},
......@@ -775,6 +783,18 @@ bool sys_var::check(THD *thd, set_var *var)
return 0;
}
bool sys_var_str::check(THD *thd, set_var *var)
{
int res;
if (!check_func)
return 0;
if ((res=(*check_func)(thd, var)) < 0)
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name,
var->value->str_value.ptr());
return res;
}
/*
Functions to check and update variables
*/
......@@ -837,13 +857,35 @@ static void sys_default_init_slave(THD* thd, enum_var_type type)
update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, 0);
}
static int sys_check_ftb_syntax(THD *thd, set_var *var)
{
if (thd->master_access & SUPER_ACL)
return ft_boolean_check_syntax_string(var->value->str_value.ptr()) ?
-1 : 0;
else
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
return 1;
}
}
static bool sys_update_ftb_syntax(THD *thd, set_var * var)
{
strnmov(ft_boolean_syntax, var->value->str_value.ptr(), sizeof(ft_boolean_syntax));
return 0;
}
static void sys_default_ftb_syntax(THD *thd, enum_var_type type)
{
strnmov(ft_boolean_syntax, opt_ft_boolean_syntax, sizeof(ft_boolean_syntax));
}
/*
The following 3 functions need to be changed in 4.1 when we allow
one to change character sets
*/
static bool sys_check_charset(THD *thd, set_var *var)
static int sys_check_charset(THD *thd, set_var *var)
{
return 0;
}
......@@ -1898,7 +1940,7 @@ byte *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
key_cache= &zero_key_cache;
return (byte*) key_cache + offset ;
}
bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
{
......@@ -1993,14 +2035,14 @@ bool sys_var_key_cache_long::update(THD *thd, set_var *var)
pthread_mutex_lock(&LOCK_global_system_variables);
KEY_CACHE *key_cache= get_key_cache(base_name);
if (!key_cache && !(key_cache= create_key_cache(base_name->str,
base_name->length)))
{
error= 1;
goto end;
}
/*
Abort if some other thread is changing the key cache
TODO: This should be changed so that we wait until the previous
......
......@@ -35,7 +35,7 @@ enum enum_var_type
OPT_DEFAULT, OPT_SESSION, OPT_GLOBAL
};
typedef bool (*sys_check_func)(THD *, set_var *);
typedef int (*sys_check_func)(THD *, set_var *);
typedef bool (*sys_update_func)(THD *, set_var *);
typedef void (*sys_after_update_func)(THD *,enum_var_type);
typedef void (*sys_set_default_func)(THD *, enum_var_type);
......@@ -143,10 +143,7 @@ public:
:sys_var(name_arg), check_func(check_func_arg),
update_func(update_func_arg),set_default_func(set_default_func_arg)
{}
bool check(THD *thd, set_var *var)
{
return check_func ? (*check_func)(thd, var) : 0;
}
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var)
{
return (*update_func)(thd, var);
......
......@@ -72,9 +72,9 @@ character-set=latin1
"Not unique table/alias: '%-.64s'",
"Invalid default value for '%-.64s'",
"Multiple primary key defined",
"Too many keys specified. Max %d keys allowed",
"Too many keys specified; max %d keys allowed",
"Too many key parts specified. Max %d parts allowed",
"Specified key was too long. Max key length is %d",
"Specified key was too long; max key length is %d bytes",
"Key column '%-.64s' doesn't exist in table",
"BLOB column '%-.64s' can't be used in key specification with the used table type",
"Too big column length for column '%-.64s' (max = %d). Use BLOB instead",
......
......@@ -76,7 +76,7 @@ character-set=koi8r
" ",
" . %d ",
" . %d ",
" . %d",
" . %d ",
" '%-.64s' ",
" BLOB '%-.64s' ",
" '%-.64s' ( = %d). BLOB ",
......
......@@ -79,7 +79,7 @@ character-set=koi8u
" ",
" ަ . ¦ %d ަ",
" . ¦ %d ",
" . ¦ %d",
" . ¦ %d Ԧ",
" '%-.64s' դ æ",
"BLOB '%-.64s' Φ Ц æ",
" '%-.64s' (max = %d). BLOB",
......
......@@ -853,26 +853,35 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
if ((length=column->length) > file->max_key_length() ||
length > file->max_key_part_length())
{
my_error(ER_WRONG_SUB_KEY,MYF(0));
DBUG_RETURN(-1);
}
}
/* TODO HF What's this for??? */
else if (f_is_geom(sql_field->pack_flag))
{
}
else if (column->length > length ||
((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
(key_info->flags & HA_NOSAME))) &&
column->length != length))
{
my_error(ER_WRONG_SUB_KEY,MYF(0));
DBUG_RETURN(-1);
{
length=min(file->max_key_length(), file->max_key_part_length());
if (key->type == Key::MULTIPLE)
{
/* not a critical problem */
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff,ER(ER_TOO_LONG_KEY),length);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_KEY, warn_buff);
}
else
{
my_error(ER_TOO_LONG_KEY,MYF(0),length);
DBUG_RETURN(-1);
}
}
}
if (!(file->table_flags() & HA_NO_PREFIX_CHAR_KEYS))
length=column->length;
else if (!f_is_geom(sql_field->pack_flag) &&
(column->length > length ||
((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
(key_info->flags & HA_NOSAME))) &&
column->length != length)))
{
my_error(ER_WRONG_SUB_KEY,MYF(0));
DBUG_RETURN(-1);
}
else if (!(file->table_flags() & HA_NO_PREFIX_CHAR_KEYS))
length=column->length;
}
else if (length == 0)
{
......@@ -882,8 +891,20 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
if (length > file->max_key_part_length())
{
my_error(ER_WRONG_SUB_KEY,MYF(0));
DBUG_RETURN(-1);
length=file->max_key_part_length();
if (key->type == Key::MULTIPLE)
{
/* not a critical problem */
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff,ER(ER_TOO_LONG_KEY),length);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_LONG_KEY, warn_buff);
}
else
{
my_error(ER_TOO_LONG_KEY,MYF(0),length);
DBUG_RETURN(-1);
}
}
key_part_info->length=(uint16) length;
/* Use packed keys for long strings on the first column */
......
......@@ -36,7 +36,7 @@ static double scaler1[] = {
1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9
};
// let's use a static array for not to accumulate the error
/* let's use a static array for not to accumulate the error */
static double pastpoint[] = {
1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8, 1e-9,
1e-10, 1e-11, 1e-12, 1e-13, 1e-14, 1e-15, 1e-16, 1e-17, 1e-18, 1e-19,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment