Merged 4.1 -> 5.0

This commit is contained in:
pem@mysql.com 2003-12-09 19:00:34 +01:00
commit 24a2ae44a3
69 changed files with 727 additions and 246 deletions

View file

@ -160,10 +160,22 @@ SOURCE="..\strings\ctype-tis620.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ucs2.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ujis.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-utf8.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-win1250ch.c"
# End Source File
# Begin Source File
SOURCE=..\strings\ctype.c
# End Source File
# Begin Source File

View file

@ -179,10 +179,22 @@ SOURCE="..\strings\ctype-tis620.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ucs2.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-ujis.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-utf8.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-win1250ch.c"
# End Source File
# Begin Source File
SOURCE=..\strings\ctype.c
# End Source File
# Begin Source File

View file

@ -156,6 +156,10 @@ SOURCE=".\ctype-tis620.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-ucs2.c"
# End Source File
# Begin Source File
SOURCE=".\ctype-ujis.c"
# End Source File
# Begin Source File

View file

@ -89,7 +89,11 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*where=0,
*opt_compatible_mode_str= 0,
*err_ptr= 0;
#ifdef HAVE_CHARSET_utf8
static char *default_charset= (char*) "utf8";
#else
static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
#endif
static ulong opt_compatible_mode= 0;
static uint opt_mysql_port= 0, err_len= 0;
static my_string opt_mysql_unix_port=0;
@ -351,7 +355,7 @@ static void write_header(FILE *sql_file, char *db_name)
fprintf(sql_file, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
if (!opt_set_names)
fprintf(sql_file,"\n/*!40101 SET NAMES %s*/;\n",default_charset);
fprintf(sql_file,"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=%s */;\n",default_charset);
fprintf(md_result_file,"\
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n\
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\
@ -372,6 +376,7 @@ static void write_footer(FILE *sql_file)
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n\
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n\
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n\
");
}
fputs("\n", sql_file);

View file

@ -124,6 +124,8 @@ enum enum_server_command
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
#define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */
#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
#define SERVER_QUERY_NO_INDEX_USED 32
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */

View file

@ -45,7 +45,7 @@ C_MODE_START
static my_bool org_my_init_done;
my_bool server_inited;
static my_bool STDCALL
static my_bool
emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
const char *header, ulong header_length,
const char *arg, ulong arg_length, my_bool skip_check)
@ -103,7 +103,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
return result;
}
static MYSQL_DATA * STDCALL
static MYSQL_DATA *
emb_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)),
unsigned int fields __attribute__((unused)))
{
@ -126,12 +126,12 @@ emb_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields __attribute__((unused)),
return result;
}
static MYSQL_FIELD * STDCALL emb_list_fields(MYSQL *mysql)
static MYSQL_FIELD *emb_list_fields(MYSQL *mysql)
{
return mysql->fields;
}
static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
static my_bool emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{
THD *thd= (THD*)mysql->thd;
if (mysql->net.last_errno)
@ -159,7 +159,8 @@ static my_bool STDCALL emb_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
else the lengths are calculated from the offset between pointers.
**************************************************************************/
static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count)
static void emb_fetch_lengths(ulong *to, MYSQL_ROW column,
unsigned int field_count)
{
MYSQL_ROW end;
@ -167,7 +168,7 @@ static void STDCALL emb_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int
*to= *column ? *(uint *)((*column) - sizeof(uint)) : 0;
}
static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql)
static my_bool emb_mysql_read_query_result(MYSQL *mysql)
{
if (mysql->net.last_errno)
return -1;
@ -178,7 +179,7 @@ static my_bool STDCALL emb_mysql_read_query_result(MYSQL *mysql)
return 0;
}
static int STDCALL emb_stmt_execute(MYSQL_STMT *stmt)
static int emb_stmt_execute(MYSQL_STMT *stmt)
{
DBUG_ENTER("emb_stmt_execute");
THD *thd= (THD*)stmt->mysql->thd;
@ -205,7 +206,7 @@ MYSQL_DATA *emb_read_binary_rows(MYSQL_STMT *stmt)
return emb_read_rows(stmt->mysql, 0, 0);
}
int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row)
int emb_unbuffered_fetch(MYSQL *mysql, char **row)
{
MYSQL_DATA *data= ((THD*)mysql->thd)->data;
if (!data || !data->data)
@ -225,7 +226,7 @@ int STDCALL emb_unbuffered_fetch(MYSQL *mysql, char **row)
return 0;
}
static void STDCALL emb_free_embedded_thd(MYSQL *mysql)
static void emb_free_embedded_thd(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
if (thd->data)
@ -234,18 +235,25 @@ static void STDCALL emb_free_embedded_thd(MYSQL *mysql)
delete thd;
}
static const char * STDCALL emb_read_statistic(MYSQL *mysql)
static const char * emb_read_statistic(MYSQL *mysql)
{
THD *thd= (THD*)mysql->thd;
return thd->net.last_error;
}
static MYSQL_RES * emb_mysql_store_result(MYSQL *mysql)
{
return mysql_store_result(mysql);
}
MYSQL_METHODS embedded_methods=
{
emb_mysql_read_query_result,
emb_advanced_command,
emb_read_rows,
mysql_store_result,
emb_mysql_store_result,
emb_fetch_lengths,
emb_list_fields,
emb_read_prepare_result,

View file

@ -507,6 +507,36 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
DBUG_RETURN(result);
} /* chk_key */
static int chk_index_down(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
my_off_t page, uchar *buff, ha_rows *keys,
ha_checksum *key_checksum, uint level)
{
char llbuff[22],llbuff2[22];
if (page > info->state->key_file_length || (page & (info->s->blocksize -1)))
{
my_off_t max_length=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0));
mi_check_print_error(param,"Wrong pagepointer: %s at page: %s",
llstr(page,llbuff),llstr(page,llbuff2));
if (page+info->s->blocksize > max_length)
goto err;
info->state->key_file_length=(max_length &
~ (my_off_t) (info->s->blocksize-1));
}
if (!_mi_fetch_keypage(info,keyinfo,page, DFLT_INIT_HITS,buff,0))
{
mi_check_print_error(param,"Can't read key from filepos: %s",
llstr(page,llbuff));
goto err;
}
param->key_file_blocks+=keyinfo->block_length;
if (chk_index(param,info,keyinfo,page,buff,keys,key_checksum,level))
goto err;
return 0;
err:
return 1;
}
/* Check if index is ok */
@ -553,27 +583,8 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (nod_flag)
{
next_page=_mi_kpos(nod_flag,keypos);
if (next_page > info->state->key_file_length ||
(nod_flag && (next_page & (info->s->blocksize -1))))
{
my_off_t max_length=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0));
mi_check_print_error(param,"Wrong pagepointer: %s at page: %s",
llstr(next_page,llbuff),llstr(page,llbuff2));
if (next_page+info->s->blocksize > max_length)
goto err;
info->state->key_file_length=(max_length &
~ (my_off_t) (info->s->blocksize-1));
}
if (!_mi_fetch_keypage(info,keyinfo,next_page,
DFLT_INIT_HITS,temp_buff,0))
{
mi_check_print_error(param,"Can't read key from filepos: %s",llstr(next_page,llbuff));
goto err;
}
param->key_file_blocks+=keyinfo->block_length;
if (chk_index(param,info,keyinfo,next_page,temp_buff,keys,key_checksum,
level+1))
if (chk_index_down(param,info,keyinfo,next_page,
temp_buff,keys,key_checksum,level+1))
goto err;
}
old_keypos=keypos;
@ -615,6 +626,23 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
memcpy((char*) info->lastkey,(char*) key,key_length);
info->lastkey_length=key_length;
record= _mi_dpos(info,0,key+key_length);
if (keyinfo->flag & HA_FULLTEXT) /* special handling for ft2 */
{
uint off;
int subkeys;
get_key_full_length_rdonly(off, key);
subkeys=ft_sintXkorr(key+off);
if (subkeys < 0)
{
ha_rows tmp_keys=0;
if (chk_index_down(param,info,&info->s->ft2_keyinfo,record,
temp_buff,&tmp_keys,key_checksum,1))
goto err;
(*keys)+=tmp_keys-1;
continue;
}
/* fall through */
}
if (record >= info->state->data_file_length)
{
#ifndef DBUG_OFF

View file

@ -805,7 +805,7 @@ manager_launch()
ident=$1
shift
if [ $USE_MANAGER = 0 ] ; then
$@ >> $CUR_MYERR 2>&1 &
echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
sleep 2 #hack
return
fi

View file

@ -407,6 +407,22 @@ a b c d e f g h dd
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
drop table t1, t2;
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
insert into t1 values ('','',0,0.0);
describe t1;
Field Type Null Key Default Extra
str varchar(10) YES def
strnull varchar(10) YES NULL
intg int(11) YES 10
rel double YES 3.14
create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
describe t2;
Field Type Null Key Default Extra
str varchar(10) YES NULL
strnull varchar(10) YES NULL
intg int(11) YES NULL
rel double YES NULL
drop table t1, t2;
create database test_$1;
use test_$1;
select database();

View file

@ -0,0 +1,24 @@
select hex(@a);
hex(@a)
NULL
select hex(@a);
hex(@a)
610063
set global init_connect="set @a=2;set @b=3";
select @a, @b;
@a @b
2 3
set GLOBAL init_connect=DEFAULT;
select @a;
@a
NULL
set global init_connect="create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')";
select hex(a) from t1;
hex(a)
00
616263
set GLOBAL init_connect="adsfsdfsdfs";
select @a;
ERROR HY000: Lost connection to MySQL server during query
drop table t1;

View file

@ -62,3 +62,42 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
</database>
</mysqldump>
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET ucs2;
INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9');
-- MySQL dump 10.2
--
-- Host: localhost Database: test
-- ------------------------------------------------------
-- Server version 4.1.2-alpha-debug-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
--
-- Table structure for table `t1`
--
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a varchar(255) default NULL
) TYPE=MyISAM DEFAULT CHARSET=ucs2;
--
-- Dumping data for table `t1`
--
/*!40000 ALTER TABLE t1 DISABLE KEYS */;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES ('אולי');
UNLOCK TABLES;
/*!40000 ALTER TABLE t1 ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
DROP TABLE t1;

View file

@ -0,0 +1,24 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show variables like 'init_slave';
Variable_name Value
init_slave set global max_connections=500
show variables like 'max_connections';
Variable_name Value
max_connections 500
reset master;
show variables like 'init_slave';
Variable_name Value
init_slave
show variables like 'max_connections';
Variable_name Value
max_connections 100
set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
stop slave;

View file

@ -823,3 +823,41 @@ count(*)
13
drop table t1,t2;
set local tmp_table_size=default;
create table t1 (a int, index (a), b int);
insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
FLUSH STATUS;
show status like 'Slow_queries';
Variable_name Value
Slow_queries 0
select count(*) from t1 where a=7;
count(*)
26
show status like 'Slow_queries';
Variable_name Value
Slow_queries 0
select count(*) from t1 where b=13;
count(*)
10
show status like 'Slow_queries';
Variable_name Value
Slow_queries 1
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
count(*)
0
26
show status like 'Slow_queries';
Variable_name Value
Slow_queries 2
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
count(*)
26
10
show status like 'Slow_queries';
Variable_name Value
Slow_queries 3
drop table t1;

View file

@ -323,6 +323,13 @@ select * from t2;
drop table t1, t2;
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
insert into t1 values ('','',0,0.0);
describe t1;
create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
describe t2;
drop table t1, t2;
#
# Bug #1209
#

View file

@ -0,0 +1 @@
--set-variable=init_connect="set @a='a\0c'"

View file

@ -0,0 +1,34 @@
#
# Test of init_connect variable
#
connect (con0,localhost,root,,);
connection con0;
select hex(@a);
connect (con1,localhost,user_1,,);
connection con1;
select hex(@a);
connection con0;
set global init_connect="set @a=2;set @b=3";
connect (con2,localhost,user_1,,);
connection con2;
select @a, @b;
connection con0;
set GLOBAL init_connect=DEFAULT;
connect (con3,localhost,user_1,,);
connection con3;
select @a;
connection con0;
set global init_connect="create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')";
connect (con4,localhost,user_1,,);
connection con4;
select hex(a) from t1;
connection con0;
set GLOBAL init_connect="adsfsdfsdfs";
connect (con5,localhost,user_1,,);
connection con5;
--error 2013
select @a;
connection con0;
drop table t1;

View file

@ -22,3 +22,12 @@ CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
--exec $MYSQL_DUMP --skip-all -X test t1
DROP TABLE t1;
#
# Bug #1994
#
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET ucs2;
INSERT INTO t1 VALUES (_ucs2 x'05D005D505DC05D9');
--exec $MYSQL_DUMP test t1
DROP TABLE t1;

View file

@ -0,0 +1 @@
--init-slave="set global max_connections=500"

View file

@ -0,0 +1,26 @@
source include/master-slave.inc;
#
# Test of init_slave variable
#
save_master_pos;
connection slave;
sleep 1;
show variables like 'init_slave';
show variables like 'max_connections';
sync_with_master;
reset master;
connection master;
show variables like 'init_slave';
show variables like 'max_connections';
save_master_pos;
connection slave;
sync_with_master;
set global init_connect="set @c=1";
show variables like 'init_connect';
connection master;
save_master_pos;
connection slave;
sync_with_master;
stop slave;

View file

@ -0,0 +1 @@
--log-slow-queries --log-long-format --log-queries-not-using-indexes

View file

@ -416,9 +416,6 @@ create table t1 select _latin2"test" union select _latin2"testt" ;
show create table t1;
drop table t1;
#
# conversion memory->disk table
#
#
# conversion memory->disk table
#
@ -436,3 +433,26 @@ select count(*) from t1;
select count(*) from t2;
drop table t1,t2;
set local tmp_table_size=default;
#
# slow logging
#
create table t1 (a int, index (a), b int);
insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
insert t1 select a+1, a+b from t1;
FLUSH STATUS;
show status like 'Slow_queries';
select count(*) from t1 where a=7;
show status like 'Slow_queries';
select count(*) from t1 where b=13;
show status like 'Slow_queries';
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
show status like 'Slow_queries';
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
show status like 'Slow_queries';
drop table t1;

View file

@ -82,7 +82,7 @@ static void init_state_maps(CHARSET_INFO *cs)
else if (my_isdigit(cs,i))
state_map[i]=(uchar) MY_LEX_NUMBER_IDENT;
#if defined(USE_MB) && defined(USE_MB_IDENT)
else if (use_mb(cs) && (my_mbcharlen(cs, i)>1))
else if (my_mbcharlen(cs, i)>1)
state_map[i]=(uchar) MY_LEX_IDENT;
#endif
else if (!my_isgraph(cs,i))

View file

@ -178,18 +178,8 @@ rm -r -f "$BASE/share/Makefile"
rm -r -f "$BASE/share/Makefile.in"
rm -r -f "$BASE/share/Makefile.am"
#
# Clean up if we did this from a bk tree
#
if [ -d $BASE/SCCS ]
then
find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f
fi
mkdir $BASE/Docs $BASE/extra $BASE/include
#
# Copy directory files
#
@ -320,6 +310,15 @@ done
unix_to_dos $BASE/README
mv $BASE/README $BASE/README.txt
#
# Clean up if we did this from a bk tree
#
if [ -d $BASE/SSL/SCCS ]
then
find $BASE -type d -name SCCS | xargs rm -r -f
fi
#
# Initialize the initial data directory
#

View file

@ -119,11 +119,13 @@ fi
mdata=$ldata/mysql
mysqld=$execdir/mysqld
mysqld_opt=""
scriptdir=$bindir
if test "$windows" = 1
then
mysqld="./sql/mysqld"
mysqld_opt="--language=./sql/share/english"
scriptdir="./scripts"
fi
if test ! -x $mysqld
@ -199,7 +201,7 @@ then
echo "Installing all prepared tables"
fi
if (
$bindir/mysql_create_system_tables $create_option $mdata $hostname $windows
$scriptdir/mysql_create_system_tables $create_option $mdata $hostname $windows
if test -n "$fill_help_tables"
then
cat $fill_help_tables

View file

@ -177,50 +177,45 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define TEST_SIGINT 1024 /* Allow sigint on threads */
/* options for select set by the yacc parser (stored in lex->options) */
#define SELECT_DISTINCT 1
#define SELECT_STRAIGHT_JOIN 2
#define SELECT_DESCRIBE 4
#define SELECT_SMALL_RESULT 8
#define SELECT_BIG_RESULT 16
#define OPTION_FOUND_ROWS 32
#define OPTION_TO_QUERY_CACHE 64
#define SELECT_NO_JOIN_CACHE 256 /* Intern */
#define OPTION_BIG_TABLES 512 /* for SQL OPTION */
#define OPTION_BIG_SELECTS 1024 /* for SQL OPTION */
#define OPTION_LOG_OFF 2048
#define OPTION_UPDATE_LOG 4096 /* update log flag */
#define TMP_TABLE_ALL_COLUMNS 8192
#define OPTION_WARNINGS 16384
#define OPTION_AUTO_IS_NULL 32768
#define OPTION_FOUND_COMMENT 65536L
#define OPTION_SAFE_UPDATES OPTION_FOUND_COMMENT*2
#define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2
#define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2
#define OPTION_NOT_AUTOCOMMIT OPTION_BIN_LOG*2
#define OPTION_BEGIN OPTION_NOT_AUTOCOMMIT*2
#define OPTION_TABLE_LOCK OPTION_BEGIN*2
#define OPTION_QUICK OPTION_TABLE_LOCK*2
#define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2
#define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2
/* options for UNION set by the yacc parser (stored in unit->union_option) */
#define UNION_ALL 1
#define SELECT_DISTINCT (1L << 0)
#define SELECT_STRAIGHT_JOIN (1L << 1)
#define SELECT_DESCRIBE (1L << 2)
#define SELECT_SMALL_RESULT (1L << 3)
#define SELECT_BIG_RESULT (1L << 4)
#define OPTION_FOUND_ROWS (1L << 5)
#define OPTION_TO_QUERY_CACHE (1L << 6)
#define SELECT_NO_JOIN_CACHE (1L << 7) /* Intern */
#define OPTION_BIG_TABLES (1L << 8) /* for SQL OPTION */
#define OPTION_BIG_SELECTS (1L << 9) /* for SQL OPTION */
#define OPTION_LOG_OFF (1L << 10)
#define OPTION_UPDATE_LOG (1L << 11) /* update log flag */
#define TMP_TABLE_ALL_COLUMNS (1L << 12)
#define OPTION_WARNINGS (1L << 13)
#define OPTION_AUTO_IS_NULL (1L << 14)
#define OPTION_FOUND_COMMENT (1L << 15)
#define OPTION_SAFE_UPDATES (1L << 16)
#define OPTION_BUFFER_RESULT (1L << 17)
#define OPTION_BIN_LOG (1L << 18)
#define OPTION_NOT_AUTOCOMMIT (1L << 19)
#define OPTION_BEGIN (1L << 20)
#define OPTION_TABLE_LOCK (1L << 21)
#define OPTION_QUICK (1L << 22)
#define OPTION_QUOTE_SHOW_CREATE (1L << 23)
#define OPTION_INTERNAL_SUBTRANSACTIONS (1L << 24)
/* Set if we are updating a non-transaction safe table */
#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2
#define OPTION_STATUS_NO_TRANS_UPDATE (1L << 25)
/* The following is set when parsing the query */
#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2
#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2
/* The following can be set when importing tables in a 'wrong order'
to suppress foreign key checks */
#define OPTION_NO_FOREIGN_KEY_CHECKS QUERY_NO_GOOD_INDEX_USED*2
#define OPTION_NO_FOREIGN_KEY_CHECKS (1L << 26)
/* The following speeds up inserts to InnoDB tables by suppressing unique
key checks in some cases */
#define OPTION_RELAXED_UNIQUE_CHECKS OPTION_NO_FOREIGN_KEY_CHECKS*2
#define SELECT_NO_UNLOCK ((ulong) OPTION_RELAXED_UNIQUE_CHECKS*2)
/* NOTE: we have now used up all 32 bits of the OPTION flag! */
#define OPTION_RELAXED_UNIQUE_CHECKS (1L << 27)
#define SELECT_NO_UNLOCK (1L << 28)
/* options for UNION set by the yacc parser (stored in unit->union_option) */
#define UNION_ALL 1
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT 1
@ -559,6 +554,8 @@ bool wait_for_tables(THD *thd);
bool table_is_used(TABLE *table, bool wait_for_name_lock);
bool drop_locked_tables(THD *thd,const char *db, const char *table_name);
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
void execute_init_command(THD *thd, sys_var_str *init_command_var,
rw_lock_t *var_mutex);
extern const Field *not_found_field;
Field *find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
TABLE_LIST **where, bool report_error);
@ -851,7 +848,7 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
LOCK_global_system_variables, LOCK_user_conn;
extern rw_lock_t LOCK_grant;
extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
extern pthread_attr_t connection_attrib;
extern I_List<THD> threads;

View file

@ -319,7 +319,8 @@ char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
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;
max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file,
*opt_init_connect, *opt_init_slave;
const char *opt_date_time_formats[3];
@ -378,7 +379,7 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received,
LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi;
rw_lock_t LOCK_grant;
rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped,
COND_slave_start;
pthread_cond_t COND_thread_cache,COND_flush_thread_cache;
@ -926,6 +927,8 @@ void clean_up(bool print_message)
MYF(MY_ALLOW_ZERO_PTR));
if (defaults_argv)
free_defaults(defaults_argv);
my_free(sys_init_connect.value, MYF(MY_ALLOW_ZERO_PTR));
my_free(sys_init_slave.value, MYF(MY_ALLOW_ZERO_PTR));
free_tmpdir(&mysql_tmpdir_list);
#ifdef HAVE_REPLICATION
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
@ -997,6 +1000,8 @@ static void clean_up_mutexes()
(void) pthread_cond_destroy(&COND_rpl_status);
#endif
(void) pthread_mutex_destroy(&LOCK_active_mi);
(void) rwlock_destroy(&LOCK_sys_init_connect);
(void) rwlock_destroy(&LOCK_sys_init_slave);
(void) pthread_mutex_destroy(&LOCK_global_system_variables);
(void) pthread_cond_destroy(&COND_thread_count);
(void) pthread_cond_destroy(&COND_refresh);
@ -2179,7 +2184,16 @@ static int init_common_variables(const char *conf_file_name, int argc,
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
sys_init_connect.value_length= 0;
if ((sys_init_connect.value= opt_init_connect))
sys_init_connect.value_length= strlen(opt_init_connect);
sys_init_slave.value_length= 0;
if ((sys_init_slave.value= opt_init_slave))
sys_init_slave.value_length= strlen(opt_init_slave);
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
@ -2206,6 +2220,8 @@ static int init_thread_environment()
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
(void) my_rwlock_init(&LOCK_sys_init_connect, NULL);
(void) my_rwlock_init(&LOCK_sys_init_slave, NULL);
(void) my_rwlock_init(&LOCK_grant, NULL);
(void) pthread_cond_init(&COND_thread_count,NULL);
(void) pthread_cond_init(&COND_refresh,NULL);
@ -3380,7 +3396,6 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1;
my_bool error_allow;
char tmp[63];
char *suffix_pos;
char connect_number_char[22], *p;
@ -3693,6 +3708,8 @@ enum options_mysqld
OPT_EXPIRE_LOGS_DAYS,
OPT_GROUP_CONCAT_MAX_LEN,
OPT_DEFAULT_COLLATION,
OPT_INIT_CONNECT,
OPT_INIT_SLAVE,
OPT_SECURE_AUTH,
OPT_DATE_FORMAT,
OPT_TIME_FORMAT,
@ -3869,6 +3886,12 @@ Disable with --skip-bdb (will save memory).",
(gptr*) &innobase_file_per_table,
(gptr*) &innobase_file_per_table, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif /* End HAVE_INNOBASE_DB */
{"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection",
(gptr*) &opt_init_connect, (gptr*) &opt_init_connect, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master",
(gptr*) &opt_init_slave, (gptr*) &opt_init_slave, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.",
(gptr*) &opt_help, (gptr*) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},

View file

@ -76,6 +76,10 @@ TYPELIB delay_key_write_typelib=
static bool 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 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*);
static void sys_default_init_slave(THD*, enum_var_type type);
static bool set_option_bit(THD *thd, set_var *var);
static bool set_option_autocommit(THD *thd, set_var *var);
static bool set_log_update(THD *thd, set_var *var);
@ -114,6 +118,12 @@ 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");
@ -436,6 +446,8 @@ sys_var *sys_variables[]=
&sys_foreign_key_checks,
&sys_group_concat_max_len,
&sys_identity,
&sys_init_connect,
&sys_init_slave,
&sys_insert_id,
&sys_interactive_timeout,
&sys_join_buffer_size,
@ -588,6 +600,8 @@ struct show_var_st init_vars[]= {
{"have_openssl", (char*) &have_openssl, SHOW_HAVE},
{"have_query_cache", (char*) &have_query_cache, SHOW_HAVE},
{"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR},
{"init_connect", (char*) &sys_init_connect, SHOW_SYS},
{"init_slave", (char*) &sys_init_slave, SHOW_SYS},
#ifdef HAVE_INNOBASE_DB
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
@ -757,6 +771,66 @@ bool sys_var::check(THD *thd, set_var *var)
Functions to check and update variables
*/
/*
Update variables 'init_connect, init_slave'.
In case of 'DEFAULT' value
(for example: 'set GLOBAL init_connect=DEFAULT')
'var' parameter is NULL pointer.
*/
bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex,
set_var *var)
{
char *res= 0, *old_value;
uint new_length= 0;
/* If the string is "", delete old init command */
if (var && (new_length= var->value->str_value.length()))
{
if (!(res= my_strdup_with_length(var->value->str_value.ptr(),
new_length,
MYF(0))))
return 1;
}
/*
Replace the old value in such a way that the any thread using
the value will work.
*/
rw_wrlock(var_mutex);
old_value= var_str->value;
var_str->value= res;
var_str->value_length= new_length;
rw_unlock(var_mutex);
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
return 0;
}
static bool sys_update_init_connect(THD *thd, set_var *var)
{
return update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, var);
}
static void sys_default_init_connect(THD* thd, enum_var_type type)
{
update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, 0);
}
static bool sys_update_init_slave(THD *thd, set_var *var)
{
return update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, var);
}
static void sys_default_init_slave(THD* thd, enum_var_type type)
{
update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, 0);
}
/*
The following 3 functions need to be changed in 4.1 when we allow
one to change character sets
@ -2434,8 +2508,9 @@ int set_var_password::update(THD *thd)
Functions to handle table_type
****************************************************************************/
/* Based upon sys_var::check_enum() */
bool sys_var_thd_table_type::check(THD *thd, set_var *var)
/* Based upon sys_var::check_enum() */
{
char buff[80];
const char *value;
@ -2458,6 +2533,7 @@ err:
return 1;
}
byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
@ -2465,9 +2541,10 @@ byte *sys_var_thd_table_type::value_ptr(THD *thd, enum_var_type type,
val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->variables.*offset);
const char *table_type= ha_get_table_type((enum db_type)val);
return (byte *)table_type;
return (byte *) table_type;
}
void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
@ -2476,6 +2553,7 @@ void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
thd->variables.*offset= (ulong) (global_system_variables.*offset);
}
bool sys_var_thd_table_type::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
@ -2485,6 +2563,7 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var)
return 0;
}
/****************************************************************************
Functions to handle sql_mode
****************************************************************************/

View file

@ -132,6 +132,7 @@ class sys_var_str :public sys_var
{
public:
char *value; // Pointer to allocated string
uint value_length;
sys_check_func check_func;
sys_update_func update_func;
sys_set_default_func set_default_func;
@ -803,6 +804,8 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);
ulong fix_sql_mode(ulong sql_mode);
extern sys_var_str sys_charset_system;
extern sys_var_str sys_init_connect;
extern sys_var_str sys_init_slave;
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
NAMED_LIST **found);

View file

@ -272,10 +272,10 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -266,10 +266,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -274,10 +274,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -263,10 +263,10 @@ character-set=latin1
"ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"ZLIB: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -268,10 +268,10 @@ character-set=latin7
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -263,10 +263,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -263,10 +263,10 @@ character-set=greek
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -265,10 +265,10 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -263,10 +263,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -265,10 +265,10 @@ character-set=ujis
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -263,10 +263,10 @@ character-set=euckr
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -265,10 +265,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -265,10 +265,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -267,10 +267,10 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -264,10 +264,10 @@ character-set=latin1
"Z_BUF_ERROR: Não suficiente espaço no buffer emissor para zlib (provavelmente, o comprimento dos dados descomprimidos está corrupto)",
"Z_DATA_ERROR: Dados de entrada está corrupto para zlib",
"%d linha(s) foi(foram) cortada(s) por group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Usando engine de armazenamento %s para tabela '%s'",
"Combinação ilegal de collations (%s,%s) e (%s,%s) para operação '%s'",

View file

@ -267,10 +267,10 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -265,10 +265,10 @@ character-set=koi8r
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -258,10 +258,10 @@ character-set=cp1250
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -271,10 +271,10 @@ character-set=latin2
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -265,10 +265,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -263,10 +263,10 @@ character-set=latin1
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d rad(er) kapades av group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Använder handler %s för tabell '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -268,10 +268,10 @@ character-set=koi8u
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld";
"Record count is fewer than the column count at row %ld",
"Record count is more than the column count at row %ld",
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",
"Data truncated, out of range for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

View file

@ -3157,6 +3157,18 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name,
llstr(rli->group_relay_log_pos,llbuff1));
/* execute init_slave variable */
if (sys_init_slave.value)
{
execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave);
if (thd->query_error)
{
sql_print_error("\
Slave SQL thread aborted. Can't execute init_slave query");
goto err;
}
}
/* Read queries from the IO/THREAD until this thread is killed */
while (!sql_slave_killed(thd,rli))

View file

@ -2547,7 +2547,6 @@ my_bool grant_init(THD *org_thd)
{
if (hostname_requires_resolving(mem_check->host))
{
char buff[MAX_FIELD_WIDTH];
sql_print_error("Warning: 'tables_priv' entry '%s %s@%s' "
"ignored in --skip-name-resolve mode.",
mem_check->tname, mem_check->user,

View file

@ -104,7 +104,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
/* If running in safe sql mode, don't allow updates without keys */
if (table->quick_keys.is_clear_all())
{
thd->lex->select_lex.options|=QUERY_NO_INDEX_USED;
thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
if (safe_update && !using_limit)
{
delete select;

View file

@ -756,8 +756,7 @@ int READ_INFO::read_field()
{
chr = GET;
#ifdef USE_MB
if (use_mb(read_charset) &&
(my_mbcharlen(read_charset, chr) >1 )&&
if ((my_mbcharlen(read_charset, chr) > 1) &&
to+my_mbcharlen(read_charset, chr) <= end_of_buff)
{
uchar* p = (uchar*)to;
@ -943,7 +942,7 @@ int READ_INFO::next_line()
{
int chr = GET;
#ifdef USE_MB
if (use_mb(read_charset) && (my_mbcharlen(read_charset, chr) >1 ))
if (my_mbcharlen(read_charset, chr) > 1)
{
for (int i=1;
chr != my_b_EOF && i<my_mbcharlen(read_charset, chr);

View file

@ -872,6 +872,37 @@ static int check_connection(THD *thd)
return check_user(thd, COM_CONNECT, passwd, passwd_len, db, true);
}
void execute_init_command(THD *thd, sys_var_str *init_command_var,
rw_lock_t *var_mutex)
{
Vio* save_vio;
ulong save_client_capabilities;
thd->proc_info= "Execution of init_command";
/*
We need to lock init_command_var because
during execution of init_command_var query
values of init_command_var can't be changed
*/
rw_rdlock(var_mutex);
thd->query= init_command_var->value;
thd->query_length= init_command_var->value_length;
save_client_capabilities= thd->client_capabilities;
thd->client_capabilities|= CLIENT_MULTI_QUERIES;
/*
We don't need return result of execution to client side.
To forbid this we should set thd->net.vio to 0.
*/
save_vio= thd->net.vio;
thd->net.vio= 0;
dispatch_command(COM_QUERY, thd, thd->query, thd->query_length+1);
rw_unlock(var_mutex);
thd->client_capabilities= save_client_capabilities;
thd->net.vio= save_vio;
}
pthread_handler_decl(handle_one_connection,arg)
{
THD *thd=(THD*) arg;
@ -944,9 +975,15 @@ pthread_handler_decl(handle_one_connection,arg)
if (thd->client_capabilities & CLIENT_COMPRESS)
net->compress=1; // Use compression
thd->proc_info=0; // Remove 'login'
thd->command=COM_SLEEP;
thd->version=refresh_version;
thd->version= refresh_version;
if (sys_init_connect.value && !(thd->master_access & SUPER_ACL))
{
execute_init_command(thd, &sys_init_connect, &LOCK_sys_init_connect);
if (thd->query_error)
thd->killed= 1;
}
thd->proc_info=0;
thd->set_time();
while (!net->error && net->vio != 0 && !(thd->killed == THD::KILL_CONNECTION))
{
@ -1215,7 +1252,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thread_running++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->lex->select_lex.options=0; // We store status here
thd->server_status&=
~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
switch (command) {
case COM_INIT_DB:
{
@ -1645,8 +1683,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if ((ulong) (thd->start_time - thd->time_after_lock) >
thd->variables.long_query_time ||
((thd->lex->select_lex.options &
(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) &&
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
(specialflag & SPECIAL_LOG_QUERIES_NOT_USING_INDEXES)))
{
long_query_count++;
@ -3979,6 +4017,7 @@ mysql_init_query(THD *thd, bool lexonly)
lex->select_lex.prev= &lex->unit.slave;
lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0;
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
lex->select_lex.options=0;
lex->select_lex.init_order();
lex->select_lex.group_list.empty();
lex->describe= 0;

View file

@ -3621,7 +3621,7 @@ make_join_readinfo(JOIN *join, uint options)
/* These init changes read_record */
if (tab->use_quick == 2)
{
select_lex->options|=QUERY_NO_GOOD_INDEX_USED;
join->thd->server_status|=SERVER_QUERY_NO_GOOD_INDEX_USED;
tab->read_first_record= join_init_quick_read_record;
statistic_increment(select_range_check_count, &LOCK_status);
}
@ -3636,7 +3636,7 @@ make_join_readinfo(JOIN *join, uint options)
}
else
{
select_lex->options|=QUERY_NO_INDEX_USED;
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
statistic_increment(select_scan_count, &LOCK_status);
}
}
@ -3648,7 +3648,7 @@ make_join_readinfo(JOIN *join, uint options)
}
else
{
select_lex->options|=QUERY_NO_INDEX_USED;
join->thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
statistic_increment(select_full_join_count, &LOCK_status);
}
}
@ -4736,6 +4736,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
return 0; // Error
}
case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_ITEM:
return create_tmp_field_from_field(thd, (*from_field=
((Item_field*) item)->field),
item, table, modify_item);
@ -8941,7 +8942,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
(ulong)join->select_lex, join->select_lex->type,
message ? message : "NULL"));
/* Don't log this into the slow query log */
select_lex->options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED);
thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED);
join->unit->offset_limit_cnt= 0;
if (message)

View file

@ -1612,9 +1612,12 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
break;
}
case SHOW_CHAR:
pos= value;
end= strend(pos);
{
if (!(pos= value))
pos= "";
end= strend(pos);
break;
}
case SHOW_STARTTIME:
nr= (long) (thd->query_start() - start_time);
end= int10_to_str(nr, buff, 10);
@ -1640,10 +1643,10 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
break;
case SHOW_CHAR_PTR:
{
if (!(pos= *(char**) value))
pos= "";
end= strend(pos);
break;
if (!(pos= *(char**) value))
pos= "";
end= strend(pos);
break;
}
#ifdef HAVE_OPENSSL
/* First group - functions relying on CTX */

View file

@ -1531,7 +1531,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
case HA_ADMIN_CORRUPT:
protocol->store("error", 5, system_charset_info);
protocol->store("Corrupt", 8, system_charset_info);
protocol->store("Corrupt", 7, system_charset_info);
fatal_error=1;
break;

View file

@ -166,7 +166,7 @@ int mysql_update(THD *thd,
/* If running in safe sql mode, don't allow updates without keys */
if (table->quick_keys.is_clear_all())
{
thd->lex->select_lex.options|=QUERY_NO_INDEX_USED;
thd->server_status|=SERVER_QUERY_NO_INDEX_USED;
if (safe_update && !using_limit)
{
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,

View file

@ -401,7 +401,7 @@ static int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
static int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
{
return (isbig5head(c)? 2: 0);
return (isbig5head(c)? 2 : 1);
}
/* page 0 0xA140-0xC7FC */
@ -6183,16 +6183,16 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if(wc<0x80)
if ((int) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}
if(!(code=func_uni_big5_onechar(wc)))
if (!(code=func_uni_big5_onechar(wc)))
return MY_CS_ILUNI;
if(s+2>e)
if (s+2>e)
return MY_CS_TOOSMALL;
s[0]=code>>8;
@ -6201,6 +6201,7 @@ my_wc_mb_big5(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static int
my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc,const uchar *s,const uchar *e)
@ -6211,16 +6212,16 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOFEW(0);
if(hi<0x80)
if (hi<0x80)
{
pwc[0]=hi;
return 1;
}
if(s+2>e)
if (s+2>e)
return MY_CS_TOOFEW(0);
if(!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1])))
if (!(pwc[0]=func_big5_uni_onechar((hi<<8)+s[1])))
return MY_CS_ILSEQ;
return 2;

View file

@ -193,7 +193,7 @@ static int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
static int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (iseuc_kr(c) ? 2 : 0);
return (iseuc_kr(c) ? 2 : 1);
}
@ -8591,9 +8591,9 @@ my_wc_mb_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((uint) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}

View file

@ -174,7 +174,7 @@ static int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
static int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (isgb2312head(c)? 2:0);
return (isgb2312head(c)? 2 : 1);
}
@ -5641,16 +5641,16 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((uint) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}
if (!(code=func_uni_gb2312_onechar(wc)))
return MY_CS_ILUNI;
if(s+2>e)
if (s+2>e)
return MY_CS_TOOSMALL;
code|=0x8080;
@ -5659,26 +5659,27 @@ my_wc_mb_gb2312(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static int
my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){
int hi;
hi=s[0];
hi=(int) s[0];
if (s >= e)
return MY_CS_TOOFEW(0);
if(hi<0x80)
if (hi<0x80)
{
pwc[0]=hi;
return 1;
}
if(s+2>e)
if (s+2>e)
return MY_CS_TOOFEW(0);
if(!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F)))
if (!(pwc[0]=func_gb2312_uni_onechar(((hi<<8)+s[1])&0x7F7F)))
return MY_CS_ILSEQ;
return 2;

View file

@ -2721,7 +2721,7 @@ static int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
static int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (isgbkhead(c)? 2:0);
return (isgbkhead(c)? 2 : 1);
}
/* page 0 0x8140-0xFE4F */
@ -9837,9 +9837,9 @@ my_wc_mb_gbk(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((uint) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}

View file

@ -191,7 +191,7 @@ static int ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
static int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (issjishead((uchar) c) ? 2: 0);
return (issjishead((uchar) c) ? 2 : 1);
}
@ -4428,16 +4428,16 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOSMALL;
if(wc<0x80)
if ((int) wc < 0x80)
{
s[0]=wc;
s[0]= (uchar) wc;
return 1;
}
if(!(code=func_uni_sjis_onechar(wc)))
if (!(code=func_uni_sjis_onechar(wc)))
return MY_CS_ILUNI;
if(s+2>e)
if (s+2>e)
return MY_CS_TOOSMALL;
s[0]=code>>8;
@ -4445,6 +4445,7 @@ my_wc_mb_sjis(CHARSET_INFO *cs __attribute__((unused)),
return 2;
}
static int
my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){
@ -4453,16 +4454,16 @@ my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (s >= e)
return MY_CS_TOOFEW(0);
if(hi<0x80)
if (hi<0x80)
{
pwc[0]=hi;
return 1;
}
if(s+2>e)
if (s+2>e)
return MY_CS_TOOFEW(0);
if(!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1])))
if (!(pwc[0]=func_sjis_uni_onechar((hi<<8)+s[1])))
return MY_CS_ILSEQ;
return 2;
@ -4481,6 +4482,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_hash_sort_simple,
};
static MY_CHARSET_HANDLER my_charset_handler=
{
ismbchar_sjis,

View file

@ -106,8 +106,8 @@ static int my_uni_ucs2 (CHARSET_INFO *cs __attribute__((unused)) ,
if ( r+2 > e )
return MY_CS_TOOSMALL;
r[0]=wc >> 8;
r[1]=wc & 0xFF;
r[0]= (uchar) (wc >> 8);
r[1]= (uchar) (wc & 0xFF);
return 2;
}
@ -862,7 +862,7 @@ double my_strntod_ucs2(CHARSET_INFO *cs __attribute__((unused)),
s+=cnv;
if (wc > (int) (uchar) 'e' || !wc)
break; /* Can't be part of double */
*b++=wc;
*b++= (char) wc;
}
*b= 0;

View file

@ -196,7 +196,7 @@ static int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
static int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1);
}
@ -252,25 +252,25 @@ my_wc_mb_jisx0201(CHARSET_INFO *cs __attribute__((unused)),
uchar *e __attribute__((unused)))
{
if (wc <= 0x7D)
if ((int) wc <= 0x7D)
{
*s = wc;
*s = (uchar) wc;
return (wc == 0x5C) ? MY_CS_ILUNI : 1;
}
if (wc >= 0xFF61 && wc <= 0xFF9F)
{
*s = (wc - 0xFEC0);
*s = (uchar) (wc - 0xFEC0);
return 1;
}
if (wc==0x00A5)
if (wc == 0x00A5)
{
*s = 0x5C;
return 1;
}
if (wc==0x203E)
if (wc == 0x203E)
{
*s = 0x7E;
return 1;
@ -8349,12 +8349,12 @@ my_wc_mb_euc_jp(CHARSET_INFO *c,my_wc_t wc, unsigned char *s, unsigned char *e)
if (s >= e)
return MY_CS_TOOSMALL;
if (wc<0x80)
if ((int) wc < 0x80)
{
if (s>e)
return MY_CS_TOOSMALL;
*s=wc;
*s= (uchar) wc;
return 1;
}

View file

@ -10,7 +10,7 @@
if cd @prefix@ ; then
if [ ! -f data/mysql/db.frm ] ; then
./scripts/mysql_install_db -IN-RPM
./scripts/mysql_install_db --rpm
fi
if [ -d data ] ; then

View file

@ -470,6 +470,7 @@ fi
%attr(755, root, root) %{_bindir}/myisamlog
%attr(755, root, root) %{_bindir}/myisampack
%attr(755, root, root) %{_bindir}/mysql_convert_table_format
%attr(755, root, root) %{_bindir}/mysql_create_system_tables
%attr(755, root, root) %{_bindir}/mysql_explain_log
%attr(755, root, root) %{_bindir}/mysql_fix_extensions
%attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables
@ -568,6 +569,10 @@ fi
# The spec file changelog only includes changes made to the spec file
# itself
%changelog
* Fri Dec 05 2003 Lenz Grimmer <lenz@mysql.com>
- added missing file mysql_create_system_tables to the server subpackage
* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com>
- removed dependency on MySQL-client from the MySQL-devel subpackage

View file

@ -7955,7 +7955,12 @@ static void test_ts()
/*
Test for bug #1500.
XXX: despite that this bug is fixed, it spots mysqld code which is not
working correctly yet: to fix all things properly we need to implement
Item::cleanup() method for all items (as described in bugs #1663 and
#1749). So don't be surprised in case valgrind barks on it.
*/
static void test_bug1500()
{
MYSQL_STMT *stmt;