This commit is contained in:
ndbdev@dl145b.mysql.com 2005-06-06 23:39:19 +02:00
commit 161a58ab4b
99 changed files with 8420 additions and 6367 deletions

View File

@ -147,10 +147,6 @@ SOURCE="..\strings\ctype-czech.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-cp932.c"
# End Source File
# Begin Source File
SOURCE="..\strings\ctype-euc_kr.c"
# End Source File
# Begin Source File

View File

@ -1657,11 +1657,12 @@ int mysql_real_query_for_lazy(const char *buf, int length)
{
for (uint retry=0;; retry++)
{
int error;
if (!mysql_real_query(&mysql,buf,length))
return 0;
int error= put_error(&mysql);
error= put_error(&mysql);
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
!opt_reconnect)
!opt_reconnect)
return error;
if (reconnect())
return error;
@ -2314,22 +2315,23 @@ print_table_data_vertically(MYSQL_RES *result)
}
}
/* print_warnings should be called right after executing a statement */
static void
print_warnings()
static void print_warnings()
{
char query[30];
const char *query;
MYSQL_RES *result;
MYSQL_ROW cur;
my_ulonglong num_rows;
/* Get the warnings */
strmov(query,"show warnings");
mysql_real_query_for_lazy(query,strlen(query));
query= "show warnings";
mysql_real_query_for_lazy(query, strlen(query));
mysql_store_result_for_lazy(&result);
/* Bail out when no warnings */
my_ulonglong num_rows = mysql_num_rows(result);
if (num_rows == 0)
if (!(num_rows= mysql_num_rows(result)))
{
mysql_free_result(result);
return;
@ -2343,13 +2345,12 @@ print_warnings()
mysql_free_result(result);
}
static const char
*array_value(const char **array, char key)
static const char *array_value(const char **array, char key)
{
int x;
for (x= 0; array[x]; x+= 2)
if (*array[x] == key)
return array[x + 1];
for (; *array; array+= 2)
if (**array == key)
return array[1];
return 0;
}

View File

@ -246,6 +246,7 @@ typedef struct
static char *subst_env_var(const char *cmd);
static FILE *my_popen(const char *cmd, const char *mode);
#undef popen
#define popen(A,B) my_popen((A),(B))
#endif /* __NETWARE__ */
@ -2587,13 +2588,13 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
{
if (i)
dynstr_append_mem(ds, "\t", 1);
replace_dynstr_append_mem(ds, val, len);
replace_dynstr_append_mem(ds, val, (int)len);
}
else
{
dynstr_append(ds, fields[i].name);
dynstr_append_mem(ds, "\t", 1);
replace_dynstr_append_mem(ds, val, len);
replace_dynstr_append_mem(ds, val, (int)len);
dynstr_append_mem(ds, "\n", 1);
}
}
@ -2960,7 +2961,7 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
int error= 0; /* Function return code if "goto end;" */
int err; /* Temporary storage of return code from calls */
int query_len, got_error_on_execute;
uint num_rows;
ulonglong num_rows;
char *query;
MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */
DYNAMIC_STRING *ds;
@ -3215,13 +3216,13 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
{
if (col_idx) /* No tab before first col */
dynstr_append_mem(ds, "\t", 1);
replace_dynstr_append_mem(ds, val, len);
replace_dynstr_append_mem(ds, val, (int)len);
}
else
{
dynstr_append(ds, field[col_idx].name);
dynstr_append_mem(ds, "\t", 1);
replace_dynstr_append_mem(ds, val, len);
replace_dynstr_append_mem(ds, val, (int)len);
dynstr_append_mem(ds, "\n", 1);
}
}

View File

@ -260,8 +260,6 @@ public:
}
bool fill(uint32 max_length,char fill);
void strip_sp();
inline void caseup() { my_caseup(str_charset,Ptr,str_length); }
inline void casedn() { my_casedn(str_charset,Ptr,str_length); }
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);

View File

@ -37,16 +37,18 @@
namespace mySTL {
template<typename T, typename Deletor = void (*) (T*)>
template<typename T>
struct auto_ptr_ref {
typedef void (*Deletor)(T*);
T* ptr_;
Deletor del_;
auto_ptr_ref(T* p, Deletor d) : ptr_(p), del_(d) {}
};
template<typename T, typename Deletor = void (*) (T*)>
template<typename T>
class auto_ptr {
typedef void (*Deletor)(T*);
T* ptr_;
Deletor del_;

View File

@ -718,7 +718,7 @@ void processReply(SSL& ssl)
mySTL::auto_ptr<input_buffer> buffered(ysDelete);
for (;;) {
mySTL::auto_ptr<input_buffer> tmp = DoProcessReply(ssl, buffered);
mySTL::auto_ptr<input_buffer> tmp(DoProcessReply(ssl, buffered));
if (tmp.get()) // had only part of a record's data, call again
buffered = tmp;
else

View File

@ -67,7 +67,7 @@ MK_FUNDAMENTAL_TYPE(float)
MK_FUNDAMENTAL_TYPE( double)
MK_FUNDAMENTAL_TYPE(long double)
#ifdef WORD64_AVAILABLE
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
MK_FUNDAMENTAL_TYPE(word64)
#endif

View File

@ -45,10 +45,12 @@ typedef unsigned int word32;
#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE)
#define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE
typedef unsigned long long word64;
#define W64LIT(x) x##LL
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE
typedef unsigned __int64 word64;
#define W64LIT(x) x##ui64
#elif defined(__DECCXX)

View File

@ -149,7 +149,8 @@ unsigned long Crop(unsigned long value, unsigned int size)
}
#if !(defined(_MSC_VER) && (_MSC_VER < 1300))
#if !(defined(_MSC_VER) && (_MSC_VER < 1300)) && \
!(defined(__HP_aCC) && (__HP_aCC <= 35700))
using std::new_handler;
using std::set_new_handler;
#endif

View File

@ -392,7 +392,6 @@ inline double ulonglong2double(ulonglong value)
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */
#define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_cp932
#define HAVE_CHARSET_cp1250 1
/* #undef HAVE_CHARSET_cp1251 */
/* #undef HAVE_CHARSET_cp1256 */

View File

@ -44,6 +44,9 @@ typedef struct unicase_info_st
uint16 sort;
} MY_UNICASE_INFO;
extern MY_UNICASE_INFO *my_unicase_default[256];
extern MY_UNICASE_INFO *my_unicase_turkish[256];
#define MY_CS_ILSEQ 0
#define MY_CS_ILUNI 0
#define MY_CS_TOOSMALL -1
@ -164,8 +167,10 @@ typedef struct my_charset_handler_st
/* Functions for case and sort convertion */
void (*caseup_str)(struct charset_info_st *, char *);
void (*casedn_str)(struct charset_info_st *, char *);
void (*caseup)(struct charset_info_st *, char *, uint);
void (*casedn)(struct charset_info_st *, char *, uint);
uint (*caseup)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
uint (*casedn)(struct charset_info_st *, char *src, uint srclen,
char *dst, uint dstlen);
/* Charset dependant snprintf() */
int (*snprintf)(struct charset_info_st *, char *to, uint n, const char *fmt,
@ -216,9 +221,12 @@ typedef struct charset_info_st
uint16 **sort_order_big;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
MY_UNICASE_INFO **caseinfo;
uchar *state_map;
uchar *ident_map;
uint strxfrm_multiply;
uchar caseup_multiply;
uchar casedn_multiply;
uint mbminlen;
uint mbmaxlen;
uint16 min_sort_char;
@ -286,8 +294,10 @@ extern uint my_instr_simple(struct charset_info_st *,
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
extern void my_casedn_str_8bit(CHARSET_INFO *, char *);
extern void my_caseup_8bit(CHARSET_INFO *, char *, uint);
extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
extern uint my_caseup_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_8bit(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
@ -359,8 +369,10 @@ int my_mbcharlen_8bit(CHARSET_INFO *, uint c);
/* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *);
extern void my_casedn_str_mb(CHARSET_INFO *, char *);
extern void my_caseup_mb(CHARSET_INFO *, char *, uint);
extern void my_casedn_mb(CHARSET_INFO *, char *, uint);
extern uint my_caseup_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern uint my_casedn_mb(CHARSET_INFO *, char *src, uint srclen,
char *dst, uint dstlen);
extern int my_strcasecmp_mb(CHARSET_INFO * cs,const char *, const char *);
int my_wildcmp_mb(CHARSET_INFO *,
@ -441,8 +453,6 @@ my_bool my_propagate_complex(CHARSET_INFO *cs, const uchar *str, uint len);
#define my_mbcharlen(s, a) 1
#endif
#define my_caseup(s, a, l) ((s)->cset->caseup((s), (a), (l)))
#define my_casedn(s, a, l) ((s)->cset->casedn((s), (a), (l)))
#define my_caseup_str(s, a) ((s)->cset->caseup_str((s), (a)))
#define my_casedn_str(s, a) ((s)->cset->casedn_str((s), (a)))
#define my_strntol(s, a, b, c, d, e) ((s)->cset->strntol((s),(a),(b),(c),(d),(e)))

View File

@ -181,7 +181,7 @@ extern void my_large_free(gptr ptr, myf my_flags);
#endif /* _AIX */
#if defined(__MWERKS__)
#undef alloca
#define alloca __alloca
#define alloca _alloca
#endif /* __MWERKS__ */
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) && ! defined(alloca)
#define alloca __builtin_alloca
@ -836,7 +836,10 @@ my_bool my_gethwaddr(uchar *to);
#define MAP_NOSYNC 0x0800
#define MAP_FAILED ((void *)-1)
#define MS_SYNC 0x0000
#ifndef __NETWARE__
#define HAVE_MMAP
#endif
int my_getpagesize(void);
void *my_mmap(void *, size_t, int, int, int, my_off_t);

View File

@ -1738,7 +1738,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
/* Default number of rows fetched per one COM_FETCH command. */
#define DEFAULT_PREFETCH_ROWS 1UL
#define DEFAULT_PREFETCH_ROWS (ulong) 1
/*
These functions are called by function pointer MYSQL_STMT::read_row_func.

View File

@ -48,6 +48,7 @@ dist-hook:
mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \
$(distdir)/std_data $(distdir)/lib
$(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include

View File

@ -887,7 +887,7 @@ report_stats () {
found_error=0
# Find errors
for i in "^Warning:" "^Error:" "^==.* at 0x"
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning"
do
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
then

View File

@ -355,3 +355,42 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
insert into t1 (b) values (1);
replace into t1 (b) values (2), (1), (3);
select * from t1;
a b
3 1
2 2
4 3
truncate table t1;
insert into t1 (b) values (1);
replace into t1 (b) values (2);
replace into t1 (b) values (1);
replace into t1 (b) values (3);
select * from t1;
a b
3 1
2 2
4 3
drop table t1;
create table t1 (rowid int not null auto_increment, val int not null,primary
key (rowid), unique(val));
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
insert into t1 (val) values ('1'),('2');
ERROR 23000: Duplicate entry '1' for key 2
select * from t1;
rowid val
3 1
4 2
drop table t1;
create table t1 (a int not null auto_increment primary key, val int);
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
insert into t1 (val) values (1);
select * from t1;
a val
2 1
3 1
drop table t1;

View File

@ -2396,3 +2396,27 @@ utf8_unicode_ci 6109
utf8_unicode_ci 61
utf8_unicode_ci 6120
drop table t1;
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
a la l ll u lu
ıi 3 ıi 3 II 2
ıı 4 ıı 4 II 2
ii 2 ii 2 II 2
İI 3 ii 2 İI 3
İİ 4 ii 2 İİ 4
II 2 ii 2 II 2
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
a la l ll u lu
ıi 3 ıi 3 Iİ 3
ıı 4 ıı 4 II 2
ii 2 ii 2 İİ 4
İI 3 iı 3 İI 3
İİ 4 ii 2 İİ 4
II 2 ıı 4 II 2
DROP TABLE t1;

View File

@ -1,4 +1,4 @@
drop table if exists t1,t11,t12,t2;
drop table if exists t1,t2,t3,t11,t12;
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
@ -172,3 +172,23 @@ a
0
2
DROP TABLE t1;
CREATE TABLE t1 (a int not null,b int not null);
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
insert into t1 values (1,1),(2,1),(1,3);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(2,1),(1,3);
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
a b a b a b
1 1 1 1 1 1
2 1 2 2 2 1
1 3 1 1 1 3
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index
1 SIMPLE t3 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
select * from t3;
a b
drop table t1,t2,t3;

View File

@ -688,6 +688,21 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
select last_day('2005-00-00');
last_day('2005-00-00')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-00-00'
select last_day('2005-00-01');
last_day('2005-00-01')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-00-01'
select last_day('2005-01-00');
last_day('2005-01-00')
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '2005-01-00'
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
100 100 04 04 4

View File

@ -1,3 +1,4 @@
DROP TABLE IF EXISTS t0,t1,t2;
show variables where variable_name like "skip_show_database";
Variable_name Value
skip_show_database OFF

View File

@ -2401,3 +2401,51 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
ERROR HY000: The used table type doesn't support FULLTEXT indexes
DROP TABLE t1;
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
insert into t1 values ('8', '6'), ('4', '7');
select min(a) from t1;
min(a)
4
select min(b) from t1 where a='8';
min(b)
6
drop table t1;
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
insert into t1 (b) values (1);
replace into t1 (b) values (2), (1), (3);
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
1 1
truncate table t1;
insert into t1 (b) values (1);
replace into t1 (b) values (2);
replace into t1 (b) values (1);
replace into t1 (b) values (3);
ERROR 23000: Duplicate entry '3' for key 1
select * from t1;
a b
3 1
2 2
drop table t1;
create table t1 (rowid int not null auto_increment, val int not null,primary
key (rowid), unique(val)) engine=innodb;
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
ERROR 23000: Duplicate entry '3' for key 1
insert into t1 (val) values ('1'),('2');
ERROR 23000: Duplicate entry '1' for key 2
select * from t1;
rowid val
1 1
2 2
drop table t1;
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
insert into t1 (val) values (1);
ERROR 23000: Duplicate entry '2' for key 1
select * from t1;
a val
2 1
drop table t1;

View File

@ -3138,4 +3138,44 @@ x
x
3
drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
Warnings:
Note 1051 Unknown table 'test.tv'
DROP TABLE IF EXISTS tt1,tt2,tt3|
Warnings:
Note 1051 Unknown table 'tt1'
Note 1051 Unknown table 'tt2'
Note 1051 Unknown table 'tt3'
CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
CREATE TABLE tt2 (a2 int, data2 varchar(10))|
CREATE TABLE tt3 (a3 int, data3 varchar(10))|
INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
INSERT INTO tt2 VALUES (1, 'a')|
INSERT INTO tt2 VALUES (2, 'b')|
INSERT INTO tt2 VALUES (3, 'c')|
INSERT INTO tt3 VALUES (4, 'd')|
INSERT INTO tt3 VALUES (5, 'e')|
INSERT INTO tt3 VALUES (6, 'f')|
CREATE VIEW tv AS
SELECT tt1.*, tt2.data2, tt3.data3
FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
LEFT JOIN tt3 ON tt1.a3 = tt3.a3
ORDER BY tt1.a1, tt2.a2, tt3.a3|
CREATE PROCEDURE bug6866 (_a1 int)
BEGIN
SELECT * FROM tv WHERE a1 = _a1;
END|
CALL bug6866(1)|
a1 a2 a3 data data2 data3
1 1 4 xx a d
CALL bug6866(1)|
a1 a2 a3 data data2 data3
1 1 4 xx a d
CALL bug6866(1)|
a1 a2 a3 data data2 data3
1 1 4 xx a d
DROP PROCEDURE bug6866;
DROP VIEW tv|
DROP TABLE tt1, tt2, tt3|
drop table t1,t2;

View File

@ -458,3 +458,11 @@ select h from t1;
h
a
drop table t1;
create table t1 (a bit(8)) engine=heap;
insert into t1 values ('1111100000');
Warnings:
Warning 1264 Out of range value adjusted for column 'a' at row 1
select a+0 from t1;
a+0
255
drop table t1;

View File

@ -218,3 +218,39 @@ CHECK TABLE t1;
INSERT INTO t1 (b) VALUES ('bbbb');
CHECK TABLE t1;
DROP TABLE IF EXISTS t1;
#
# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
#
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
insert into t1 (b) values (1);
replace into t1 (b) values (2), (1), (3);
select * from t1;
truncate table t1;
insert into t1 (b) values (1);
replace into t1 (b) values (2);
replace into t1 (b) values (1);
replace into t1 (b) values (3);
select * from t1;
drop table t1;
create table t1 (rowid int not null auto_increment, val int not null,primary
key (rowid), unique(val));
replace into t1 (val) values ('1'),('2');
replace into t1 (val) values ('1'),('2');
--error 1062
insert into t1 (val) values ('1'),('2');
select * from t1;
drop table t1;
#
# Test that update changes internal auto-increment value
#
create table t1 (a int not null auto_increment primary key, val int);
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
insert into t1 (val) values (1);
select * from t1;
drop table t1;

View File

@ -455,3 +455,18 @@ drop table t1;
SET collation_connection='utf8_unicode_ci';
-- source include/ctype_filesort.inc
#
# Check UPPER/LOWER changeing length
#
# Result shorter than argument
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
FROM t1 ORDER BY id;
DROP TABLE t1;

View File

@ -3,7 +3,7 @@
#
--disable_warnings
drop table if exists t1,t11,t12,t2;
drop table if exists t1,t2,t3,t11,t12;
--enable_warnings
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
@ -152,3 +152,20 @@ INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
DROP TABLE t1;
#
# Test of multi-delete where we are not scanning the first table
#
CREATE TABLE t1 (a int not null,b int not null);
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
insert into t1 values (1,1),(2,1),(1,3);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(2,1),(1,3);
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
# This should be empty
select * from t3;
drop table t1,t2,t3;

View File

@ -337,6 +337,14 @@ DROP TABLE t1;
explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1,
timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2;
#
# Bug #10568
#
select last_day('2005-00-00');
select last_day('2005-00-01');
select last_day('2005-01-00');
#
# Bug #10590: %h, %I, and %l format specifies should all return results in
# the 0-11 range

View File

@ -4,6 +4,11 @@
# Test for information_schema.schemata &
# show databases
--disable_warnings
DROP TABLE IF EXISTS t0,t1,t2;
--enable_warnings
show variables where variable_name like "skip_show_database";
grant select, update, execute on test.* to mysqltest_2@localhost;
grant select, update on test.* to mysqltest_1@localhost;

View File

@ -1319,3 +1319,58 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
--error 1214;
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
DROP TABLE t1;
#
# BUG#11039 Wrong key length in min()
#
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
insert into t1 values ('8', '6'), ('4', '7');
select min(a) from t1;
select min(b) from t1 where a='8';
drop table t1;
#
# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
#
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
insert into t1 (b) values (1);
# We shouldn't get the following error
--error 1062
replace into t1 (b) values (2), (1), (3);
select * from t1;
truncate table t1;
insert into t1 (b) values (1);
replace into t1 (b) values (2);
replace into t1 (b) values (1);
# We shouldn't get the following error
--error 1062
replace into t1 (b) values (3);
select * from t1;
drop table t1;
create table t1 (rowid int not null auto_increment, val int not null,primary
key (rowid), unique(val)) engine=innodb;
replace into t1 (val) values ('1'),('2');
# We shouldn't get the following error
--error 1062
replace into t1 (val) values ('1'),('2');
--error 1062
insert into t1 (val) values ('1'),('2');
select * from t1;
drop table t1;
#
# Test that update changes internal auto-increment value
#
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
insert into t1 (val) values (1);
update t1 set a=2 where a=1;
# We shouldn't get the following error
--error 1062
insert into t1 (val) values (1);
select * from t1;
drop table t1;

View File

@ -3848,6 +3848,50 @@ call bug10961()|
drop procedure bug10961|
#
# BUG #6866: Second call of a stored procedure using a view with on expressions
#
--disable_warnings
DROP PROCEDURE IF EXISTS bug6866|
--enable_warnings
DROP VIEW IF EXISTS tv|
DROP TABLE IF EXISTS tt1,tt2,tt3|
CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
CREATE TABLE tt2 (a2 int, data2 varchar(10))|
CREATE TABLE tt3 (a3 int, data3 varchar(10))|
INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
INSERT INTO tt2 VALUES (1, 'a')|
INSERT INTO tt2 VALUES (2, 'b')|
INSERT INTO tt2 VALUES (3, 'c')|
INSERT INTO tt3 VALUES (4, 'd')|
INSERT INTO tt3 VALUES (5, 'e')|
INSERT INTO tt3 VALUES (6, 'f')|
CREATE VIEW tv AS
SELECT tt1.*, tt2.data2, tt3.data3
FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
LEFT JOIN tt3 ON tt1.a3 = tt3.a3
ORDER BY tt1.a1, tt2.a2, tt3.a3|
CREATE PROCEDURE bug6866 (_a1 int)
BEGIN
SELECT * FROM tv WHERE a1 = _a1;
END|
CALL bug6866(1)|
CALL bug6866(1)|
CALL bug6866(1)|
DROP PROCEDURE bug6866;
DROP VIEW tv|
DROP TABLE tt1, tt2, tt3|
#
# BUG#NNNN: New bug synopsis

View File

@ -162,3 +162,12 @@ create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
insert into t1 set a=1;
select h from t1;
drop table t1;
#
# Bug #10539
#
create table t1 (a bit(8)) engine=heap;
insert into t1 values ('1111100000');
select a+0 from t1;
drop table t1;

View File

@ -911,7 +911,9 @@ DROP TABLE t1;
# Bug #10465
#
--disable_warnings
CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
--enable_warnings
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
SELECT GRADE FROM t1 WHERE GRADE= 151;

View File

@ -850,7 +850,7 @@ static void init_default_directories()
*ptr++= "C:/";
if (GetWindowsDirectory(system_dir,sizeof(system_dir)))
*ptr++= &system_dir;
*ptr++= (char*)&system_dir;
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
/* Only VC7 and up */
/* Only add shared system directory if different from default. */

View File

@ -39,10 +39,11 @@
DESCRIPTION
This function prepares memory root for further use, sets initial size of
chunk for memory allocation and pre-allocates first block if specified.
Altough error can happen during execution of this function if pre_alloc_size
is non-0 it won't be reported. Instead it will be reported as error in first
alloc_root() on this memory root.
Altough error can happen during execution of this function if
pre_alloc_size is non-0 it won't be reported. Instead it will be
reported as error in first alloc_root() on this memory root.
*/
void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size __attribute__((unused)))
{
@ -71,6 +72,7 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
reset_root_defaults()
@ -86,7 +88,7 @@ void init_alloc_root(MEM_ROOT *mem_root, uint block_size,
reuse one of existing blocks as prealloc block, or malloc new one of
requested size. If no blocks can be reused, all unused blocks are freed
before allocation.
*/
*/
void reset_root_defaults(MEM_ROOT *mem_root, uint block_size,
uint pre_alloc_size __attribute__((unused)))
@ -260,6 +262,7 @@ static inline void mark_blocks_free(MEM_ROOT* root)
NOTES
One can call this function either with root block initialised with
init_alloc_root() or with a bzero()-ed block.
It's also safe to call this multiple times with the same mem_root.
*/
void free_root(MEM_ROOT *root, myf MyFlags)

View File

@ -23,7 +23,7 @@ int mi_compare_text(CHARSET_INFO *charset_info, uchar *a, uint a_length,
{
if (!part_key)
return charset_info->coll->strnncollsp(charset_info, a, a_length,
b, b_length, !skip_end_space);
b, b_length, (my_bool)!skip_end_space);
return charset_info->coll->strnncoll(charset_info, a, a_length,
b, b_length, part_key);
}

View File

@ -684,8 +684,10 @@ void thr_unlock(THR_LOCK_DATA *data)
lock->read.last=data->prev;
else if (lock_type == TL_WRITE_DELAYED && data->cond)
{
/* This only happens in extreme circumstances when a
write delayed lock that is waiting for a lock */
/*
This only happens in extreme circumstances when a
write delayed lock that is waiting for a lock
*/
lock->write_wait.last=data->prev; /* Put it on wait queue */
}
else

View File

@ -30,6 +30,10 @@ rm -f */*.linux
# build tools only
make clean all-local
# Create mysql_version.h which was deleted my previous step
./config.status include/mysql_version.h
(cd dbug; make libdbug.a)
(cd strings; make libmystrings.a)
(cd mysys; make libmysys.a)
@ -56,3 +60,5 @@ cp libmysql_r/conf_to_src libmysql_r/conf_to_src.linux
cp sql/gen_lex_hash sql/gen_lex_hash.linux
cp strings/conf_to_src strings/conf_to_src.linux
# Delete mysql_version.h
rm -f include/mysql_version.h

View File

@ -22,6 +22,11 @@ rm -rf Makefile.in.bk
# run auto tools
. $path/compile-AUTOTOOLS
# For NetWare there is no comp_err but comp_err.linux
sed -e "s/comp_err/comp_err.linux/g" extra/Makefile.am > extra/Makefile.am.$$
sed -e "s/replace comp_err.linux/replace comp_err/g" extra/Makefile.am.$$ > extra/Makefile.am
rm extra/Makefile.am.$$
# configure
./configure $base_configs $extra_configs

View File

@ -6,7 +6,7 @@
# the default is "F:/mydev"
export MYDEV="F:/mydev"
export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.1.4;$MYDEV"
export MWCNWx86Includes="$MYDEV/libc/include;$MYDEV/fs64/headers;$MYDEV/zlib-1.1.4;$MYDEV/mysql-VERSION/include;$MYDEV"
export MWNWx86Libraries="$MYDEV/libc/imports;$MYDEV/mw/lib;$MYDEV/fs64/imports;$MYDEV/zlib-1.1.4;$MYDEV/openssl;$MYDEV/mysql-VERSION/netware/BUILD"
export MWNWx86LibraryFiles="libcpre.o;libc.imp;netware.imp;mwcrtl.lib;mwcpp.lib;libz.a;neb.imp;zPublics.imp;knetware.imp"
@ -19,9 +19,9 @@ export AR='mwldnlm'
export AR_FLAGS='-type library -o'
export AS='mwasmnlm'
export CC='mwccnlm -gccincludes'
export CFLAGS='-O3 -align 8 -proc 686 -relax_pointers -dialect c'
export CFLAGS='-enum int -O3 -align 8 -proc 686 -relax_pointers -dialect c'
export CXX='mwccnlm -gccincludes'
export CXXFLAGS='-O3 -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T'
export CXXFLAGS='-enum int -O3 -align 8 -proc 686 -relax_pointers -dialect c++ -bool on -wchar_t on -D_WCHAR_T'
export LD='mwldnlm'
export LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -map -flags pseudopreemption'
export RANLIB=:

View File

@ -1162,6 +1162,8 @@ void setup(char *file)
setenv("MYSQL_TCP_PORT", "3306", 1);
snprintf(file_path, PATH_MAX*2, "%s/mysql_client_test --no-defaults --testcase--user=root --port=%u ", bin_dir, master_port);
setenv("MYSQL_CLIENT_TEST",file_path,1);
snprintf(file_path, PATH_MAX*2, "%s/mysql --no-defaults --user=root --port=%u ", bin_dir, master_port);
setenv("MYSQL",file_path,1);
}
/******************************************************************************

View File

@ -666,7 +666,6 @@ void mysql_start(int argc, char *argv[])
if (!strnicmp(argv[i], private_options[j], strlen(private_options[j])))
{
skip= TRUE;
consoleprintf("The argument skipped is %s\n", argv[i]);
break;
}
}
@ -674,7 +673,6 @@ void mysql_start(int argc, char *argv[])
if (!skip)
{
add_arg(&al, "%s", argv[i]);
consoleprintf("The final argument is %s\n", argv[i]);
}
}
// spawn

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7836,7 +7836,7 @@ int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
int Field_bit::store(double nr)
{
return (Field_bit::store((longlong) nr));
return store((longlong) nr);
}
@ -8019,7 +8019,8 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
(delta == 0 && bits && (uint) (uchar) *from >= (uint) (1 << bits)))
{
memset(ptr, 0xff, field_length);
*ptr&= ((1 << bits) - 1); /* set first byte */
if (bits)
*ptr&= ((1 << bits) - 1); /* set first byte */
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}

View File

@ -345,12 +345,11 @@
*/
#ifdef __GNUC__
#include "mysql_priv.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#ifdef HAVE_FEDERATED_DB
#include "ha_federated.h"
#define MAX_REMOTE_SIZE IO_SIZE

View File

@ -21,7 +21,7 @@
that you can implement.
*/
#ifdef __GNUC__
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif

View File

@ -5495,8 +5495,8 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
const NDBINDEX *idx= (NDBINDEX *) m_index[active_index].index;
const NdbOperation* lastOp= m_active_trans->getLastDefinedOperation();
NdbIndexScanOperation* scanOp= 0;
for(; multi_range_curr<multi_range_end && curr+reclength <= end_of_buffer;
multi_range_curr++)
for (; multi_range_curr<multi_range_end && curr+reclength <= end_of_buffer;
multi_range_curr++)
{
switch(index_type){
case PRIMARY_KEY_INDEX:
@ -5633,7 +5633,7 @@ ha_ndbcluster::read_multi_range_next(KEY_MULTI_RANGE ** multi_range_found_p)
int range_no;
ulong reclength= table->s->reclength;
const NdbOperation* op= m_current_multi_operation;
for(;multi_range_curr < m_multi_range_defined; multi_range_curr++)
for (;multi_range_curr < m_multi_range_defined; multi_range_curr++)
{
if (multi_range_curr->range_flag & UNIQUE_RANGE)
{

View File

@ -2248,9 +2248,8 @@ bool Item_param::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
SELECT_LEX_UNIT::item set only for subqueries, so test of it presence
can be barrier to stop before derived table SELECT or very outer SELECT
*/
for(;
cursel->master_unit()->item;
cursel= cursel->outer_select())
for (; cursel->master_unit()->item;
cursel= cursel->outer_select())
{
Item_subselect *subselect_item= cursel->master_unit()->item;
subselect_item->used_tables_cache|= OUTER_REF_TABLE_BIT;
@ -2530,9 +2529,8 @@ void mark_select_range_as_dependent(THD *thd,
resolving)
*/
SELECT_LEX *previous_select= current_sel;
for(;
previous_select->outer_select() != last_select;
previous_select= previous_select->outer_select())
for (; previous_select->outer_select() != last_select;
previous_select= previous_select->outer_select())
{
Item_subselect *prev_subselect_item=
previous_select->master_unit()->item;

View File

@ -284,7 +284,9 @@ public:
Item(THD *thd, Item *item);
virtual ~Item()
{
#ifdef EXTRA_DEBUG
name=0;
#endif
} /*lint -e1509 */
void set_name(const char *str,uint length, CHARSET_INFO *cs);
void rename(char *new_name);

View File

@ -213,15 +213,16 @@ void Item_func::set_arguments(List<Item> &list)
{
allowed_arg_cols= 1;
arg_count=list.elements;
if ((args=(Item**) sql_alloc(sizeof(Item*)*arg_count)))
args= tmp_arg; // If 2 arguments
if (arg_count <= 2 || (args=(Item**) sql_alloc(sizeof(Item*)*arg_count)))
{
uint i=0;
List_iterator_fast<Item> li(list);
Item *item;
Item **save_args= args;
while ((item=li++))
{
args[i++]= item;
*(save_args++)= item;
with_sum_func|=item->with_sum_func;
}
}
@ -4724,7 +4725,6 @@ Item_func_sp::func_name() const
Field *
Item_func_sp::sp_result_field(void) const
{
Field *field;
DBUG_ENTER("Item_func_sp::sp_result_field");
if (!m_sp)

View File

@ -902,7 +902,7 @@ void Item_func_insert::fix_length_and_dec()
}
String *Item_func_lcase::val_str(String *str)
String *Item_str_conv::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res;
@ -912,24 +912,25 @@ String *Item_func_lcase::val_str(String *str)
return 0; /* purecov: inspected */
}
null_value=0;
res=copy_if_not_alloced(str,res,res->length());
res->casedn();
return res;
}
String *Item_func_ucase::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
String *res;
if (!(res=args[0]->val_str(str)))
if (multiply == 1)
{
null_value=1; /* purecov: inspected */
return 0; /* purecov: inspected */
uint len;
res= copy_if_not_alloced(str,res,res->length());
len= converter(collation.collation, (char*) res->ptr(), res->length(),
(char*) res->ptr(), res->length());
DBUG_ASSERT(len <= res->length());
res->length(len);
}
else
{
uint len= res->length() * multiply;
tmp_value.alloc(len);
tmp_value.set_charset(collation.collation);
len= converter(collation.collation, (char*) res->ptr(), res->length(),
(char*) tmp_value.ptr(), len);
tmp_value.length(len);
res= &tmp_value;
}
null_value=0;
res=copy_if_not_alloced(str,res,res->length());
res->caseup();
return res;
}

View File

@ -133,13 +133,14 @@ public:
class Item_str_conv :public Item_str_func
{
protected:
uint multiply;
uint (*converter)(CHARSET_INFO *cs, char *src, uint srclen,
char *dst, uint dstlen);
String tmp_value;
public:
Item_str_conv(Item *item) :Item_str_func(item) {}
void fix_length_and_dec()
{
collation.set(args[0]->collation);
max_length = args[0]->max_length;
}
String *val_str(String *);
};
@ -147,16 +148,28 @@ class Item_func_lcase :public Item_str_conv
{
public:
Item_func_lcase(Item *item) :Item_str_conv(item) {}
String *val_str(String *);
const char *func_name() const { return "lcase"; }
void fix_length_and_dec()
{
collation.set(args[0]->collation);
multiply= collation.collation->casedn_multiply;
converter= collation.collation->cset->casedn;
max_length= args[0]->max_length * multiply;
}
};
class Item_func_ucase :public Item_str_conv
{
public:
Item_func_ucase(Item *item) :Item_str_conv(item) {}
String *val_str(String *);
const char *func_name() const { return "ucase"; }
void fix_length_and_dec()
{
collation.set(args[0]->collation);
multiply= collation.collation->caseup_multiply;
converter= collation.collation->cset->caseup;
max_length= args[0]->max_length * multiply;
}
};

View File

@ -772,9 +772,8 @@ Item_in_subselect::single_value_transformer(JOIN *join,
Comp_creator *func)
{
Item_subselect::trans_res result= RES_ERROR;
DBUG_ENTER("Item_in_subselect::single_value_transformer");
SELECT_LEX *select_lex= join->select_lex;
DBUG_ENTER("Item_in_subselect::single_value_transformer");
/*
Check that the right part of the subselect contains no more than one
@ -1646,7 +1645,7 @@ void subselect_uniquesubquery_engine::exclude()
table_map subselect_engine::calc_const_tables(TABLE_LIST *table)
{
table_map map= 0;
for(; table; table= table->next_leaf)
for (; table; table= table->next_leaf)
{
TABLE *tbl= table->table;
if (tbl && tbl->const_table)

View File

@ -242,8 +242,12 @@ Item_sum_hybrid::Item_sum_hybrid(THD *thd, Item_sum_hybrid *item)
case REAL_RESULT:
sum= item->sum;
break;
case STRING_RESULT: // This can happen with ROLLUP. Note that the value is already
break; // copied at function call.
case STRING_RESULT:
/*
This can happen with ROLLUP. Note that the value is already
copied at function call.
*/
break;
case ROW_RESULT:
default:
DBUG_ASSERT(0);

View File

@ -3014,7 +3014,7 @@ String *Item_func_str_to_date::val_str(String *str)
bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date)
{
if (get_arg0_date(ltime,fuzzy_date))
if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE))
return 1;
uint month_idx= ltime->month-1;
ltime->day= days_in_month[month_idx];

View File

@ -94,7 +94,7 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define MAX_FIELDS_BEFORE_HASH 32
#define USER_VARS_HASH_SIZE 16
#define STACK_MIN_SIZE 8192 // Abort if less stack during eval.
#define STACK_BUFF_ALLOC 64 // For stack overrun checks
#define STACK_BUFF_ALLOC 256 // For stack overrun checks
#ifndef MYSQLD_NET_RETRY_COUNT
#define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int.
#endif
@ -1357,7 +1357,8 @@ inline void mark_as_null_row(TABLE *table)
inline void table_case_convert(char * name, uint length)
{
if (lower_case_table_names)
my_casedn(files_charset_info, name, length);
files_charset_info->cset->casedn(files_charset_info,
name, length, name, length);
}
inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)

View File

@ -398,7 +398,7 @@ TRP_GROUP_MIN_MAX *get_best_group_min_max(PARAM *param, SEL_TREE *tree);
static int get_index_merge_params(PARAM *param, key_map& needed_reg,
SEL_IMERGE *imerge, double *read_time,
ha_rows* imerge_rows);
inline double get_index_only_read_time(const PARAM* param, ha_rows records,
static double get_index_only_read_time(const PARAM* param, ha_rows records,
int keynr);
#ifndef DBUG_OFF
@ -1120,6 +1120,7 @@ int QUICK_ROR_UNION_SELECT::init()
val1 First merged select
val2 Second merged select
*/
int QUICK_ROR_UNION_SELECT::queue_cmp(void *arg, byte *val1, byte *val2)
{
QUICK_ROR_UNION_SELECT *self= (QUICK_ROR_UNION_SELECT*)arg;
@ -1588,7 +1589,7 @@ static int fill_used_fields_bitmap(PARAM *param)
KEY_PART_INFO *key_part= param->table->key_info[pk].key_part;
KEY_PART_INFO *key_part_end= key_part +
param->table->key_info[pk].key_parts;
for(;key_part != key_part_end; ++key_part)
for (;key_part != key_part_end; ++key_part)
{
bitmap_clear_bit(&param->needed_fields, key_part->fieldnr);
}
@ -1752,18 +1753,20 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
double best_read_time= read_time;
if (cond)
tree= get_mm_tree(&param,cond);
if (tree && tree->type == SEL_TREE::IMPOSSIBLE)
{
records=0L; /* Return -1 from this function. */
read_time= (double) HA_POS_ERROR;
goto free_mem;
if ((tree= get_mm_tree(&param,cond)))
{
if (tree->type == SEL_TREE::IMPOSSIBLE)
{
records=0L; /* Return -1 from this function. */
read_time= (double) HA_POS_ERROR;
goto free_mem;
}
if (tree->type != SEL_TREE::KEY &&
tree->type != SEL_TREE::KEY_SMALLER)
goto free_mem;
}
}
else if (tree && tree->type != SEL_TREE::KEY &&
tree->type != SEL_TREE::KEY_SMALLER)
goto free_mem;
/*
Try to construct a QUICK_GROUP_MIN_MAX_SELECT.
@ -2254,7 +2257,7 @@ skip_to_ror_scan:
clustered index)
*/
inline double get_index_only_read_time(const PARAM* param, ha_rows records,
static double get_index_only_read_time(const PARAM* param, ha_rows records,
int keynr)
{
double read_time;
@ -2300,6 +2303,7 @@ typedef struct st_ror_scan_info
param Parameter from test_quick_select function
idx Index of key in param->keys
sel_arg Set of intervals for a given key
RETURN
NULL - out of memory
ROR scan structure containing a scan for {idx, sel_arg}
@ -2312,19 +2316,20 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
uint32 *bitmap_buf;
uint keynr;
DBUG_ENTER("make_ror_scan");
if (!(ror_scan= (ROR_SCAN_INFO*)alloc_root(param->mem_root,
sizeof(ROR_SCAN_INFO))))
DBUG_RETURN(NULL);
ror_scan->idx= idx;
ror_scan->keynr= keynr= param->real_keynr[idx];
ror_scan->key_rec_length= param->table->key_info[keynr].key_length +
param->table->file->ref_length;
ror_scan->key_rec_length= (param->table->key_info[keynr].key_length +
param->table->file->ref_length);
ror_scan->sel_arg= sel_arg;
ror_scan->records= param->table->quick_rows[keynr];
if (!(bitmap_buf= (uint32*)alloc_root(param->mem_root,
bytes_word_aligned(param->fields_bitmap_size))))
bytes_word_aligned(param->fields_bitmap_size))))
DBUG_RETURN(NULL);
if (bitmap_init(&ror_scan->covered_fields, bitmap_buf,
@ -2335,14 +2340,10 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
KEY_PART_INFO *key_part= param->table->key_info[keynr].key_part;
KEY_PART_INFO *key_part_end= key_part +
param->table->key_info[keynr].key_parts;
uint n_used_covered= 0;
for (;key_part != key_part_end; ++key_part)
{
if (bitmap_is_set(&param->needed_fields, key_part->fieldnr))
{
n_used_covered++;
bitmap_set_bit(&ror_scan->covered_fields, key_part->fieldnr);
}
}
ror_scan->index_read_cost=
get_index_only_read_time(param, param->table->quick_rows[ror_scan->keynr],
@ -2363,6 +2364,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
0 a = b
1 a > b
*/
static int cmp_ror_scan_info(ROR_SCAN_INFO** a, ROR_SCAN_INFO** b)
{
double val1= rows2double((*a)->records) * (*a)->key_rec_length;
@ -2386,6 +2388,7 @@ static int cmp_ror_scan_info(ROR_SCAN_INFO** a, ROR_SCAN_INFO** b)
0 a = b
1 a > b
*/
static int cmp_ror_scan_info_covering(ROR_SCAN_INFO** a, ROR_SCAN_INFO** b)
{
if ((*a)->used_fields_covered > (*b)->used_fields_covered)
@ -2403,6 +2406,7 @@ static int cmp_ror_scan_info_covering(ROR_SCAN_INFO** a, ROR_SCAN_INFO** b)
return 0;
}
/* Auxiliary structure for incremental ROR-intersection creation */
typedef struct
{
@ -2469,6 +2473,8 @@ void ror_intersect_cpy(ROR_INTERSECT_INFO *dst, const ROR_INTERSECT_INFO *src)
dst->index_scan_costs= src->index_scan_costs;
dst->total_cost= src->total_cost;
}
/*
Get selectivity of a ROR scan wrt ROR-intersection.
@ -2486,7 +2492,7 @@ void ror_intersect_cpy(ROR_INTERSECT_INFO *dst, const ROR_INTERSECT_INFO *src)
where k_ij may be the same as any k_pq (i.e. keys may have common parts).
A full row is retrieved iff entire cond holds.
A full row is retrieved if entire condition holds.
The recursive procedure for finding P(cond) is as follows:
@ -2497,7 +2503,7 @@ void ror_intersect_cpy(ROR_INTERSECT_INFO *dst, const ROR_INTERSECT_INFO *src)
Here R may still contain condition(s) equivalent to k_11=c_11.
Nevertheless, the following holds:
P(k_11=c_11 AND R) = P(k_11=c_11) * P(R|k_11=c_11).
P(k_11=c_11 AND R) = P(k_11=c_11) * P(R | k_11=c_11).
Mark k_11 as fixed field (and satisfied condition) F, save P(F),
save R to be cond and proceed to recursion step.
@ -2544,7 +2550,7 @@ void ror_intersect_cpy(ROR_INTERSECT_INFO *dst, const ROR_INTERSECT_INFO *src)
( this is result of application of option b) of the recursion step for
parts of a single key).
Since it is reasonable to expect that most of the fields are not marked
as fixed, we calcualate (3) as
as fixed, we calculate (3) as
n_{i1} n_{i_2}
(3) = n_{max_key_part} / ( --------- * --------- * .... )
@ -2578,33 +2584,32 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
max_range.key= (byte*) key_val;
max_range.flag= HA_READ_AFTER_KEY;
ha_rows prev_records= info->param->table->file->records;
int i;
DBUG_ENTER("ror_intersect_selectivity");
for(i= 0, sel_arg= scan->sel_arg; sel_arg;
i++, sel_arg= sel_arg->next_key_part)
for (sel_arg= scan->sel_arg; sel_arg;
sel_arg= sel_arg->next_key_part)
{
DBUG_PRINT("info",("sel_arg step"));
cur_covered= test(bitmap_is_set(&info->covered_fields,
(key_part + i)->fieldnr));
key_part[sel_arg->part].fieldnr));
if (cur_covered != prev_covered)
{
/* create (part1val, ..., part{n-1}val) tuple. */
{
if (!tuple_arg)
{
tuple_arg= scan->sel_arg;
tuple_arg->store_min(key_part->length, &key_ptr, 0);
}
while (tuple_arg->next_key_part != sel_arg)
{
tuple_arg= tuple_arg->next_key_part;
tuple_arg->store_min(key_part->length, &key_ptr, 0);
}
}
ha_rows records;
if (!tuple_arg)
{
tuple_arg= scan->sel_arg;
/* Here we use the length of the first key part */
tuple_arg->store_min(key_part->length, &key_ptr, 0);
}
while (tuple_arg->next_key_part != sel_arg)
{
tuple_arg= tuple_arg->next_key_part;
tuple_arg->store_min(key_part[tuple_arg->part].length, &key_ptr, 0);
}
min_range.length= max_range.length= ((char*) key_ptr - (char*) key_val);
records= info->param->table->file->
records_in_range(scan->keynr, &min_range, &max_range);
records= (info->param->table->file->
records_in_range(scan->keynr, &min_range, &max_range));
if (cur_covered)
{
/* uncovered -> covered */
@ -2632,6 +2637,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
DBUG_RETURN(selectivity_mult);
}
/*
Check if adding a ROR scan to a ROR-intersection reduces its cost of
ROR-intersection and if yes, update parameters of ROR-intersection,
@ -2669,7 +2675,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
*/
static bool ror_intersect_add(ROR_INTERSECT_INFO *info,
ROR_SCAN_INFO* ror_scan, bool is_cpk_scan)
ROR_SCAN_INFO* ror_scan, bool is_cpk_scan)
{
double selectivity_mult= 1.0;
@ -3225,11 +3231,11 @@ QUICK_SELECT_I *TRP_INDEX_MERGE::make_quick(PARAM *param,
quick_imerge->records= records;
quick_imerge->read_time= read_cost;
for(TRP_RANGE **range_scan= range_scans; range_scan != range_scans_end;
range_scan++)
for (TRP_RANGE **range_scan= range_scans; range_scan != range_scans_end;
range_scan++)
{
if (!(quick= (QUICK_RANGE_SELECT*)
((*range_scan)->make_quick(param, FALSE, &quick_imerge->alloc)))||
((*range_scan)->make_quick(param, FALSE, &quick_imerge->alloc)))||
quick_imerge->push_quick_back(quick))
{
delete quick;
@ -3258,7 +3264,7 @@ QUICK_SELECT_I *TRP_ROR_INTERSECT::make_quick(PARAM *param,
"creating ROR-intersect",
first_scan, last_scan););
alloc= parent_alloc? parent_alloc: &quick_intrsect->alloc;
for(; first_scan != last_scan;++first_scan)
for (; first_scan != last_scan;++first_scan)
{
if (!(quick= get_quick_select(param, (*first_scan)->idx,
(*first_scan)->sel_arg, alloc)) ||
@ -3300,7 +3306,7 @@ QUICK_SELECT_I *TRP_ROR_UNION::make_quick(PARAM *param,
*/
if ((quick_roru= new QUICK_ROR_UNION_SELECT(param->thd, param->table)))
{
for(scan= first_ror; scan != last_ror; scan++)
for (scan= first_ror; scan != last_ror; scan++)
{
if (!(quick= (*scan)->make_quick(param, FALSE, &quick_roru->alloc)) ||
quick_roru->push_quick_back(quick))
@ -4203,7 +4209,7 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag)
clone_flag=swap_clone_flag(clone_flag);
}
// If one of the key is MAYBE_KEY then the found region may be smaller
/* If one of the key is MAYBE_KEY then the found region may be smaller */
if (key2->type == SEL_ARG::MAYBE_KEY)
{
if (key1->use_count > 1)
@ -5336,8 +5342,8 @@ static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
KEY_PART_INFO *pk_part= param->table->key_info[pk_number].key_part;
KEY_PART_INFO *pk_part_end= pk_part +
param->table->key_info[pk_number].key_parts;
for(;(key_part!=key_part_end) && (pk_part != pk_part_end);
++key_part, ++pk_part)
for (;(key_part!=key_part_end) && (pk_part != pk_part_end);
++key_part, ++pk_part)
{
if ((key_part->field != pk_part->field) ||
(key_part->length != pk_part->length))
@ -7330,8 +7336,8 @@ check_group_min_max_predicates(COND *cond, Item_field *min_max_arg_item,
DESCRIPTION
Test conditions (NGA1, NGA2) from get_best_group_min_max(). Namely,
for each keypart field NGF_i not in GROUP-BY, check that there is a constant
equality predicate among conds with the form (NGF_i = const_ci) or
for each keypart field NGF_i not in GROUP-BY, check that there is a
constant equality predicate among conds with the form (NGF_i = const_ci) or
(const_ci = NGF_i).
Thus all the NGF_i attributes must fill the 'gap' between the last group-by
attribute and the MIN/MAX attribute in the index (if present). If these
@ -7964,7 +7970,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
max_used_key_length= real_prefix_len;
if (min_max_ranges.elements > 0)
{
QUICK_RANGE *cur_range= 0;
QUICK_RANGE *cur_range;
if (have_min)
{ /* Check if the right-most range has a lower boundary. */
get_dynamic(&min_max_ranges, (gptr)&cur_range,
@ -7972,7 +7978,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
if (!(cur_range->flag & NO_MIN_RANGE))
{
max_used_key_length+= min_max_arg_len;
++used_key_parts;
used_key_parts++;
return;
}
}
@ -7982,7 +7988,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
if (!(cur_range->flag & NO_MAX_RANGE))
{
max_used_key_length+= min_max_arg_len;
++used_key_parts;
used_key_parts++;
return;
}
}
@ -7999,7 +8005,7 @@ void QUICK_GROUP_MIN_MAX_SELECT::update_key_stat()
usable key length.
*/
max_used_key_length+= min_max_arg_len;
++used_key_parts;
used_key_parts++;
}
}
@ -8696,7 +8702,7 @@ static void print_ror_scans_arr(TABLE *table, const char *msg,
char buff[1024];
String tmp(buff,sizeof(buff),&my_charset_bin);
tmp.length(0);
for(;start != end; start++)
for (;start != end; start++)
{
if (tmp.length())
tmp.append(',');

View File

@ -677,7 +677,8 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
If key_part2 may be NULL, then we want to find the first row
that is not null
*/
ref->key_buff[ref->key_length++]= 1;
ref->key_buff[ref->key_length]= 1;
ref->key_length+= part->store_length;
*range_fl&= ~NO_MIN_RANGE;
*range_fl|= NEAR_MIN; // > NULL
}

View File

@ -475,7 +475,7 @@ read_escaped_string(char *ptr, char *eol, LEX_STRING *str)
{
char *write_pos= str->str;
for(; ptr < eol; ptr++, write_pos++)
for (; ptr < eol; ptr++, write_pos++)
{
char c= *ptr;
if (c == '\\')
@ -635,7 +635,7 @@ File_parser::parse(gptr base, MEM_ROOT *mem_root,
File_option *parameter= parameters+first_param,
*parameters_end= parameters+required;
int len= 0;
for(; parameter < parameters_end; parameter++)
for (; parameter < parameters_end; parameter++)
{
len= parameter->name.length;
// check length

View File

@ -14,11 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
#include "mysql_priv.h"
#include "sp_cache.h"
#include "sp_head.h"

View File

@ -14,11 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
#include "mysql_priv.h"
#include "sp_head.h"
#include "sp.h"
#include "sp_pcontext.h"
@ -1904,33 +1903,33 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
else
{
sp_lex_keeper *lex_keeper= c->pre_open(thd);
if (!lex_keeper)
if (!lex_keeper) // cursor already open or OOM
{
res= -1;
*nextp= m_ip+1;
}
else
res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);
/*
Work around the fact that errors in selects are not returned properly
(but instead converted into a warning), so if a condition handler
caught, we have lost the result code.
*/
if (!res)
{
uint dummy1, dummy2;
res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);
/*
Work around the fact that errors in selects are not returned properly
(but instead converted into a warning), so if a condition handler
caught, we have lost the result code.
*/
if (!res)
{
uint dummy1, dummy2;
if (thd->spcont->found_handler(&dummy1, &dummy2))
res= -1;
if (thd->spcont->found_handler(&dummy1, &dummy2))
res= -1;
}
c->post_open(thd, res ? FALSE : TRUE);
}
c->post_open(thd, (lex_keeper && !res ? TRUE : FALSE));
}
DBUG_RETURN(res);
}
int
sp_instr_copen::exec_core(THD *thd, uint *nextp)
{

View File

@ -14,6 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
@ -22,7 +23,6 @@
#undef SAFEMALLOC /* Problems with threads */
#endif
#include "mysql_priv.h"
#include "sp_pcontext.h"
#include "sp_head.h"

View File

@ -14,6 +14,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
@ -22,7 +23,6 @@
#undef SAFEMALLOC /* Problems with threads */
#endif
#include "mysql_priv.h"
#include "mysql.h"
#include "sp_head.h"
#include "sp_rcontext.h"
@ -168,8 +168,22 @@ sp_rcontext::pop_cursors(uint count)
*
*/
// We have split this in two to make it easy for sp_instr_copen
// to reuse the sp_instr::exec_stmt() code.
/*
pre_open cursor
SYNOPSIS
pre_open()
THD Thread handler
NOTES
We have to open cursor in two steps to make it easy for sp_instr_copen
to reuse the sp_instr::exec_stmt() code.
If this function returns 0, post_open should not be called
RETURN
0 ERROR
*/
sp_lex_keeper*
sp_cursor::pre_open(THD *thd)
{
@ -179,32 +193,31 @@ sp_cursor::pre_open(THD *thd)
MYF(0));
return NULL;
}
bzero((char *)&m_mem_root, sizeof(m_mem_root));
init_alloc_root(&m_mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
if ((m_prot= new Protocol_cursor(thd, &m_mem_root)) == NULL)
return NULL;
m_oprot= thd->protocol; // Save the original protocol
thd->protocol= m_prot;
/* Save for execution. Will be restored in post_open */
m_oprot= thd->protocol;
m_nseof= thd->net.no_send_eof;
/* Change protocol for execution */
thd->protocol= m_prot;
thd->net.no_send_eof= TRUE;
return m_lex_keeper;
}
void
sp_cursor::post_open(THD *thd, my_bool was_opened)
{
thd->net.no_send_eof= m_nseof; // Restore the originals
thd->protocol= m_oprot;
if (was_opened)
{
m_isopen= was_opened;
if ((m_isopen= was_opened))
m_current_row= m_prot->data;
}
}
int
sp_cursor::close(THD *thd)
{
@ -217,6 +230,7 @@ sp_cursor::close(THD *thd)
return 0;
}
void
sp_cursor::destroy()
{
@ -225,7 +239,6 @@ sp_cursor::destroy()
delete m_prot;
m_prot= NULL;
free_root(&m_mem_root, MYF(0));
bzero((char *)&m_mem_root, sizeof(m_mem_root));
}
m_isopen= FALSE;
}

View File

@ -753,7 +753,7 @@ TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
t_name= table->table_name;
DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
for(;;)
for (;;)
{
if (!(res= find_table_in_global_list(table_list, d_name, t_name)) ||
(!res->table || res->table != table->table) &&

View File

@ -81,7 +81,7 @@ public:
if (sizeof(buffer) >= 8)
return uint8korr(buffer);
DBUG_ASSERT(sizeof(buffer) >= 4);
uint4korr(buffer);
return (ulonglong) uint4korr(buffer);
}
};

View File

@ -1863,7 +1863,8 @@ class multi_delete :public select_result_interceptor
ha_rows deleted, found;
uint num_of_tables;
int error;
bool do_delete, transactional_tables, normal_tables;
bool do_delete, transactional_tables, normal_tables, delete_while_scanning;
public:
multi_delete(THD *thd, TABLE_LIST *dt, uint num_of_tables);
~multi_delete();
@ -1871,7 +1872,7 @@ public:
bool send_data(List<Item> &items);
bool initialize_tables (JOIN *join);
void send_error(uint errcode,const char *err);
int do_deletes (bool from_send_error);
int do_deletes();
bool send_eof();
};

View File

@ -418,7 +418,7 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt,
num_of_tables(num_of_tables_arg), error(0),
do_delete(0), transactional_tables(0), normal_tables(0)
{
tempfiles = (Unique **) sql_calloc(sizeof(Unique *) * (num_of_tables-1));
tempfiles= (Unique **) sql_calloc(sizeof(Unique *) * num_of_tables);
}
@ -448,6 +448,7 @@ multi_delete::initialize_tables(JOIN *join)
tables_to_delete_from|= walk->table->map;
walk= delete_tables;
delete_while_scanning= 1;
for (JOIN_TAB *tab=join->join_tab, *end=join->join_tab+join->tables;
tab < end;
tab++)
@ -467,10 +468,25 @@ multi_delete::initialize_tables(JOIN *join)
else
normal_tables= 1;
}
else if ((tab->type != JT_SYSTEM && tab->type != JT_CONST) &&
walk == delete_tables)
{
/*
We are not deleting from the table we are scanning. In this
case send_data() shouldn't delete any rows a we may touch
the rows in the deleted table many times
*/
delete_while_scanning= 0;
}
}
walk= delete_tables;
tempfiles_ptr= tempfiles;
for (walk= walk->next_local ;walk ;walk= walk->next_local)
if (delete_while_scanning)
{
table_being_deleted= delete_tables;
walk= walk->next_local;
}
for (;walk ;walk= walk->next_local)
{
TABLE *table=walk->table;
*tempfiles_ptr++= new Unique (refpos_order_cmp,
@ -489,12 +505,12 @@ multi_delete::~multi_delete()
table_being_deleted;
table_being_deleted= table_being_deleted->next_local)
{
TABLE *t=table_being_deleted->table;
free_io_cache(t); // Alloced by unique
t->no_keyread=0;
TABLE *table= table_being_deleted->table;
free_io_cache(table); // Alloced by unique
table->no_keyread=0;
}
for (uint counter= 0; counter < num_of_tables-1; counter++)
for (uint counter= 0; counter < num_of_tables; counter++)
{
if (tempfiles[counter])
delete tempfiles[counter];
@ -504,14 +520,15 @@ multi_delete::~multi_delete()
bool multi_delete::send_data(List<Item> &values)
{
int secure_counter= -1;
int secure_counter= delete_while_scanning ? -1 : 0;
TABLE_LIST *del_table;
DBUG_ENTER("multi_delete::send_data");
for (table_being_deleted= delete_tables;
table_being_deleted;
table_being_deleted= table_being_deleted->next_local, secure_counter++)
for (del_table= delete_tables;
del_table;
del_table= del_table->next_local, secure_counter++)
{
TABLE *table=table_being_deleted->table;
TABLE *table= del_table->table;
/* Check if we are using outer join and we didn't find the row */
if (table->status & (STATUS_NULL_ROW | STATUS_DELETED))
@ -522,7 +539,8 @@ bool multi_delete::send_data(List<Item> &values)
if (secure_counter < 0)
{
/* If this is the table we are scanning */
/* We are scanning the current table */
DBUG_ASSERT(del_table == table_being_deleted);
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))
@ -536,8 +554,7 @@ bool multi_delete::send_data(List<Item> &values)
TRG_ACTION_AFTER, FALSE))
DBUG_RETURN(1);
}
else if (!table_being_deleted->next_local ||
table_being_deleted->table->file->has_transactions())
else
{
table->file->print_error(error,MYF(0));
DBUG_RETURN(1);
@ -548,7 +565,7 @@ bool multi_delete::send_data(List<Item> &values)
error=tempfiles[secure_counter]->unique_add((char*) table->file->ref);
if (error)
{
error=-1;
error= 1; // Fatal error
DBUG_RETURN(1);
}
}
@ -571,22 +588,24 @@ void multi_delete::send_error(uint errcode,const char *err)
/* Something already deleted so we have to invalidate cache */
query_cache_invalidate3(thd, delete_tables, 1);
/* Below can happen when thread is killed early ... */
if (!table_being_deleted)
table_being_deleted=delete_tables;
/*
If rows from the first table only has been deleted and it is
transactional, just do rollback.
The same if all tables are transactional, regardless of where we are.
In all other cases do attempt deletes ...
*/
if ((table_being_deleted->table->file->has_transactions() &&
table_being_deleted == delete_tables) || !normal_tables)
if ((table_being_deleted == delete_tables &&
table_being_deleted->table->file->has_transactions()) ||
!normal_tables)
ha_rollback_stmt(thd);
else if (do_delete)
{
VOID(do_deletes(1));
/*
We have to execute the recorded do_deletes() and write info into the
error log
*/
error= 1;
send_eof();
}
DBUG_VOID_RETURN;
}
@ -599,28 +618,21 @@ void multi_delete::send_error(uint errcode,const char *err)
1 error
*/
int multi_delete::do_deletes(bool from_send_error)
int multi_delete::do_deletes()
{
int local_error= 0, counter= 0, error;
bool will_batch;
DBUG_ENTER("do_deletes");
DBUG_ASSERT(do_delete);
if (from_send_error)
{
/* Found out table number for 'table_being_deleted*/
for (TABLE_LIST *aux= delete_tables;
aux != table_being_deleted;
aux= aux->next_local)
counter++;
}
else
table_being_deleted = delete_tables;
do_delete= 0;
do_delete= 0; // Mark called
if (!found)
DBUG_RETURN(0);
for (table_being_deleted= table_being_deleted->next_local;
table_being_deleted;
table_being_deleted= (delete_while_scanning ? delete_tables->next_local :
delete_tables);
for (; table_being_deleted;
table_being_deleted= table_being_deleted->next_local, counter++)
{
TABLE *table = table_being_deleted->table;
@ -691,7 +703,7 @@ bool multi_delete::send_eof()
thd->proc_info="deleting from reference tables";
/* Does deletes for the last n - 1 tables, returns 0 if ok */
int local_error= do_deletes(0); // returns 0 if success
int local_error= do_deletes(); // returns 0 if success
/* reset used flags */
thd->proc_info="end";

View File

@ -137,7 +137,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
/* it is join view => we need to find table for update */
List_iterator_fast<Item> it(fields);
Item *item;
TABLE_LIST *tbl= 0;
TABLE_LIST *tbl= 0; // reset for call to check_single_table()
table_map map= 0;
while ((item= it++))
@ -929,6 +929,12 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (res == VIEW_CHECK_ERROR)
goto before_trg_err;
if (thd->clear_next_insert_id)
{
/* Reset auto-increment cacheing if we do an update */
thd->clear_next_insert_id= 0;
thd->next_insert_id= 0;
}
if ((error=table->file->update_row(table->record[1],table->record[0])))
{
if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
@ -962,6 +968,12 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_BEFORE, TRUE))
goto before_trg_err;
if (thd->clear_next_insert_id)
{
/* Reset auto-increment cacheing if we do an update */
thd->clear_next_insert_id= 0;
thd->next_insert_id= 0;
}
if ((error=table->file->update_row(table->record[1],
table->record[0])))
goto err;
@ -1025,6 +1037,7 @@ ok_or_after_trg_err:
err:
info->last_errno= error;
thd->lex->current_select->no_error= 0; // Give error
table->file->print_error(error,MYF(0));
before_trg_err:

View File

@ -4541,7 +4541,8 @@ unsent_create_error:
send_ok(thd);
break;
}
if (thd->transaction.xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
if (thd->transaction.xa_state == XA_IDLE &&
thd->lex->xa_opt == XA_ONE_PHASE)
{
int r;
if ((r= ha_commit(thd)))
@ -4549,8 +4550,8 @@ unsent_create_error:
else
send_ok(thd);
}
else
if (thd->transaction.xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE)
else if (thd->transaction.xa_state == XA_PREPARED &&
thd->lex->xa_opt == XA_NONE)
{
if (wait_if_global_read_lock(thd, 0, 0))
{

View File

@ -953,32 +953,35 @@ JOIN::optimize()
}
DBUG_EXECUTE("info",TEST_join(this););
/*
Because filesort always does a full table scan or a quick range scan
we must add the removed reference to the select for the table.
We only need to do this when we have a simple_order or simple_group
as in other cases the join is done before the sort.
*/
if (const_tables != tables &&
(order || group_list) &&
join_tab[const_tables].type != JT_ALL &&
join_tab[const_tables].type != JT_FT &&
join_tab[const_tables].type != JT_REF_OR_NULL &&
(order && simple_order || group_list && simple_group))
{
if (add_ref_to_table_cond(thd,&join_tab[const_tables]))
DBUG_RETURN(1);
}
if (!(select_options & SELECT_BIG_RESULT) &&
((group_list && const_tables != tables &&
(!simple_group ||
!test_if_skip_sort_order(&join_tab[const_tables], group_list,
unit->select_limit_cnt, 0))) ||
select_distinct) &&
tmp_table_param.quick_group && !procedure)
if (const_tables != tables)
{
need_tmp=1; simple_order=simple_group=0; // Force tmp table without sort
/*
Because filesort always does a full table scan or a quick range scan
we must add the removed reference to the select for the table.
We only need to do this when we have a simple_order or simple_group
as in other cases the join is done before the sort.
*/
if ((order || group_list) &&
join_tab[const_tables].type != JT_ALL &&
join_tab[const_tables].type != JT_FT &&
join_tab[const_tables].type != JT_REF_OR_NULL &&
(order && simple_order || group_list && simple_group))
{
if (add_ref_to_table_cond(thd,&join_tab[const_tables]))
DBUG_RETURN(1);
}
if (!(select_options & SELECT_BIG_RESULT) &&
((group_list &&
(!simple_group ||
!test_if_skip_sort_order(&join_tab[const_tables], group_list,
unit->select_limit_cnt, 0))) ||
select_distinct) &&
tmp_table_param.quick_group && !procedure)
{
need_tmp=1; simple_order=simple_group=0; // Force tmp table without sort
}
}
tmp_having= having;
@ -5377,6 +5380,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
JOIN_TAB *first_inner_tab= tab->first_inner;
table_map current_map= tab->table->map;
bool use_quick_range=0;
COND *tmp;
/*
Following force including random expression in last table condition.
It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5
@ -5398,7 +5403,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
join->best_positions[i].records_read= rows2double(tab->quick->records);
}
COND *tmp= NULL;
tmp= NULL;
if (cond)
tmp= make_cond_for_table(cond,used_tables,current_map);
if (cond && !tmp && tab->quick)
@ -7375,6 +7380,8 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
}
else
{
if (!(table->prep_on_expr))
table->prep_on_expr= table->on_expr;
used_tables= table->table->map;
if (conds)
not_null_tables= conds->not_null_tables();
@ -7985,7 +7992,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
bool using_unique_constraint= 0;
bool use_packed_rows= 0;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
char *tmpname,path[FN_REFLEN], filename[FN_REFLEN];
char *tmpname,path[FN_REFLEN];
byte *pos,*group_buff;
uchar *null_flags;
Field **reg_field, **from_field;
@ -13613,7 +13620,7 @@ static void print_join(THD *thd, String *str, List<TABLE_LIST> *tables)
(*table)->print(thd, str);
TABLE_LIST **end= table + tables->elements;
for(TABLE_LIST **tbl= table + 1; tbl < end; tbl++)
for (TABLE_LIST **tbl= table + 1; tbl < end; tbl++)
{
TABLE_LIST *curr= *tbl;
if (curr->outer_join)

View File

@ -1265,7 +1265,7 @@ static bool show_status_array(THD *thd, const char *wild,
name_buffer, wild)))
{
char *value=variables->value;
const char *pos, *end;
const char *pos, *end; // We assign a lot of const's
long nr;
if (show_type == SHOW_SYS)
{
@ -1336,8 +1336,8 @@ static bool show_status_array(THD *thd, const char *wild,
case SHOW_SLAVE_RETRIED_TRANS:
{
/*
TODO: in 5.1 with multimaster, have one such counter per line in SHOW
SLAVE STATUS, and have the sum over all lines here.
TODO: in 5.1 with multimaster, have one such counter per line in
SHOW SLAVE STATUS, and have the sum over all lines here.
*/
pthread_mutex_lock(&LOCK_active_mi);
pthread_mutex_lock(&active_mi->rli.data_lock);
@ -1359,7 +1359,11 @@ static bool show_status_array(THD *thd, const char *wild,
}
else
{
for (int i= 1; i < MAX_SLAVE_ERROR; i++)
/* 10 is enough assuming errors are max 4 digits */
int i;
for (i= 1;
i < MAX_SLAVE_ERROR && (uint) (end-buff) < sizeof(buff)-10;
i++)
{
if (bitmap_is_set(bitmap, i))
{
@ -1369,6 +1373,8 @@ static bool show_status_array(THD *thd, const char *wild,
}
if (end != buff)
end--; // Remove last ','
if (i < MAX_SLAVE_ERROR)
end= strmov((char*) end, "..."); // Couldn't show all errors
}
break;
}

View File

@ -261,8 +261,6 @@ public:
}
bool fill(uint32 max_length,char fill);
void strip_sp();
inline void caseup() { my_caseup(str_charset,Ptr,str_length); }
inline void casedn() { my_casedn(str_charset,Ptr,str_length); }
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);

View File

@ -810,7 +810,7 @@ bool mysql_multi_update_prepare(THD *thd)
tl->table->reginfo.lock_type= tl->lock_type;
}
}
for(tl= table_list; tl; tl= tl->next_local)
for (tl= table_list; tl; tl= tl->next_local)
{
/* Check access privileges for table */
if (!tl->derived)

View File

@ -2167,16 +2167,12 @@ bool st_table_list::check_single_table(st_table_list **table, table_map map,
{
if (*table)
return TRUE;
else
{
*table= tbl;
tbl->check_option= view->check_option;
}
*table= tbl;
tbl->check_option= view->check_option;
}
}
else
if (tbl->check_single_table(table, map, view))
return TRUE;
else if (tbl->check_single_table(table, map, view))
return TRUE;
}
return FALSE;
}

View File

@ -436,10 +436,7 @@ typedef struct st_table_list
bool skip_temporary; /* this table shouldn't be temporary */
/* TRUE if this merged view contain auto_increment field */
bool contain_auto_increment;
#if 0
#else
bool multitable_view; /* TRUE iff this is multitable view */
#endif
/* FRMTYPE_ERROR if any type is acceptable */
enum frm_type_enum required_type;
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */

View File

@ -178,7 +178,7 @@ static double get_merge_many_buffs_cost(uint *buffer,
Set initial state: first maxbuffer sequences contain max_n_elems elements
each, last sequence contains last_n_elems elements.
*/
for(i = 0; i < (int)maxbuffer; i++)
for (i = 0; i < (int)maxbuffer; i++)
buff_elems[i]= max_n_elems;
buff_elems[maxbuffer]= last_n_elems;

View File

@ -668,7 +668,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type,
{
int error;
Field::utype type;
uint firstpos, null_count;
uint null_count;
uchar *buff,*null_pos;
TABLE table;
create_field *field;

View File

@ -667,7 +667,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
{
tmp_keydef.keysegs=1;
tmp_keydef.flag= HA_UNIQUE_CHECK;
tmp_keydef.block_length= myisam_block_size;
tmp_keydef.block_length= (uint16)myisam_block_size;
tmp_keydef.keylength= MI_UNIQUE_HASH_LENGTH + pointer;
tmp_keydef.minlength=tmp_keydef.maxlength=tmp_keydef.keylength;
tmp_keyseg.type= MI_UNIQUE_HASH_TYPE;

View File

@ -471,20 +471,25 @@ static void update_record(char *record)
ptr=blob_key;
memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
my_casedn(default_charset_info,blob_key,length);
default_charset_info->cset->casedn(default_charset_info,
blob_key, length, blob_key, length);
pos+=recinfo[1].length;
}
else if (recinfo[1].type == FIELD_VARCHAR)
{
uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos);
my_casedn(default_charset_info,pos+pack_length,length);
default_charset_info->cset->casedn(default_charset_info,
pos + pack_length, length,
pos + pack_length, length);
pos+=recinfo[1].length;
}
else
{
if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM)
my_casedn(default_charset_info,pos,keyinfo[0].seg[0].length);
default_charset_info->cset->casedn(default_charset_info,
pos, keyinfo[0].seg[0].length,
pos, keyinfo[0].seg[0].length);
pos+=recinfo[1].length;
}

View File

@ -6384,9 +6384,12 @@ CHARSET_INFO my_charset_big5_chinese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -6412,9 +6415,12 @@ CHARSET_INFO my_charset_big5_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -208,10 +208,13 @@ static void my_case_str_bin(CHARSET_INFO *cs __attribute__((unused)),
{
}
static void my_case_bin(CHARSET_INFO *cs __attribute__((unused)),
char *str __attribute__((unused)),
uint length __attribute__((unused)))
static uint my_case_bin(CHARSET_INFO *cs __attribute__((unused)),
char *src __attribute__((unused)),
uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
return srclen;
}
@ -526,9 +529,12 @@ CHARSET_INFO my_charset_bin =
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -5512,9 +5512,12 @@ CHARSET_INFO my_charset_cp932_japanese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -5539,9 +5542,12 @@ CHARSET_INFO my_charset_cp932_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -618,9 +618,12 @@ CHARSET_INFO my_charset_latin2_czech_ci =
NULL, /* sort_order_big*/
tab_8859_2_uni, /* tab_to_uni */
idx_uni_8859_2, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
4, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8696,9 +8696,12 @@ CHARSET_INFO my_charset_euckr_korean_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -8724,9 +8727,12 @@ CHARSET_INFO my_charset_euckr_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8698,9 +8698,12 @@ CHARSET_INFO my_charset_eucjpms_japanese_ci=
NULL, /* contractions */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -8726,9 +8729,12 @@ CHARSET_INFO my_charset_eucjpms_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -33,9 +33,12 @@ CHARSET_INFO compiled_charsets[] = {
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
0, /* strxfrm_mul */
0, /* caseup_mul */
0, /* casedn_mul */
0, /* mbminlen */
0, /* mbmaxlen */
0, /* min_sort_ord */

View File

@ -5747,9 +5747,12 @@ CHARSET_INFO my_charset_gb2312_chinese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -5774,9 +5777,12 @@ CHARSET_INFO my_charset_gb2312_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -9994,9 +9994,12 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -10021,9 +10024,12 @@ CHARSET_INFO my_charset_gbk_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -424,9 +424,12 @@ CHARSET_INFO my_charset_latin1=
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
@ -719,9 +722,12 @@ CHARSET_INFO my_charset_latin1_german2_ci=
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
2, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
@ -747,9 +753,12 @@ CHARSET_INFO my_charset_latin1_bin=
NULL, /* sort_order_big*/
cs_to_uni, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -57,40 +57,48 @@ void my_casedn_str_mb(CHARSET_INFO * cs, char *str)
}
}
void my_caseup_mb(CHARSET_INFO * cs, char *str, uint length)
uint my_caseup_mb(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
register uint32 l;
register char *end=str+length;
register uchar *map=cs->to_upper;
while (str<end)
register char *srcend= src + srclen;
register uchar *map= cs->to_upper;
DBUG_ASSERT(src == dst && srclen == dstlen);
while (src < srcend)
{
if ((l=my_ismbchar(cs, str,end)))
str+=l;
if ((l=my_ismbchar(cs, src, srcend)))
src+= l;
else
{
*str=(char) map[(uchar)*str];
str++;
*src=(char) map[(uchar) *src];
src++;
}
}
return srclen;
}
void my_casedn_mb(CHARSET_INFO * cs, char *str, uint length)
uint my_casedn_mb(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
register uint32 l;
register char *end=str+length;
register char *srcend= src + srclen;
register uchar *map=cs->to_lower;
while (str<end)
DBUG_ASSERT(src == dst && srclen == dstlen);
while (src < srcend)
{
if ((l=my_ismbchar(cs, str,end)))
str+=l;
if ((l= my_ismbchar(cs, src, srcend)))
src+= l;
else
{
*str=(char) map[(uchar)*str];
str++;
*src= (char) map[(uchar)*src];
src++;
}
}
return srclen;
}
int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)

View File

@ -201,18 +201,28 @@ void my_casedn_str_8bit(CHARSET_INFO * cs,char *str)
str++;
}
void my_caseup_8bit(CHARSET_INFO * cs, char *str, uint length)
uint my_caseup_8bit(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
register uchar *map=cs->to_upper;
for ( ; length>0 ; length--, str++)
*str= (char) map[(uchar)*str];
uint srclen0= srclen;
register uchar *map= cs->to_upper;
DBUG_ASSERT(src == dst && srclen == dstlen);
for ( ; srclen > 0 ; srclen--, src++)
*src= (char) map[(uchar) *src];
return srclen0;
}
void my_casedn_8bit(CHARSET_INFO * cs, char *str, uint length)
uint my_casedn_8bit(CHARSET_INFO * cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
uint srclen0= srclen;
register uchar *map=cs->to_lower;
for ( ; length>0 ; length--, str++)
*str= (char) map[(uchar) *str];
DBUG_ASSERT(src == dst && srclen == dstlen);
for ( ; srclen > 0 ; srclen--, src++)
*src= (char) map[(uchar) *src];
return srclen0;
}
int my_strcasecmp_8bit(CHARSET_INFO * cs,const char *s, const char *t)
@ -1303,6 +1313,8 @@ static my_bool create_fromuni(CHARSET_INFO *cs, void *(*alloc)(uint))
static my_bool my_cset_init_8bit(CHARSET_INFO *cs, void *(*alloc)(uint))
{
cs->caseup_multiply= 1;
cs->casedn_multiply= 1;
return create_fromuni(cs, alloc);
}

View File

@ -4681,9 +4681,12 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -4708,9 +4711,12 @@ CHARSET_INFO my_charset_sjis_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -983,9 +983,12 @@ CHARSET_INFO my_charset_tis620_thai_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
4, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */
@ -1010,9 +1013,12 @@ CHARSET_INFO my_charset_tis620_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8049,9 +8049,12 @@ CHARSET_INFO my_charset_ucs2_general_uca=
uca_weight, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8076,9 +8079,12 @@ CHARSET_INFO my_charset_ucs2_icelandic_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8103,9 +8109,12 @@ CHARSET_INFO my_charset_ucs2_latvian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8130,9 +8139,12 @@ CHARSET_INFO my_charset_ucs2_romanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8157,9 +8169,12 @@ CHARSET_INFO my_charset_ucs2_slovenian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8184,9 +8199,12 @@ CHARSET_INFO my_charset_ucs2_polish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8211,9 +8229,12 @@ CHARSET_INFO my_charset_ucs2_estonian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8238,9 +8259,12 @@ CHARSET_INFO my_charset_ucs2_spanish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8265,9 +8289,12 @@ CHARSET_INFO my_charset_ucs2_swedish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8292,9 +8319,12 @@ CHARSET_INFO my_charset_ucs2_turkish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_turkish, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8319,9 +8349,12 @@ CHARSET_INFO my_charset_ucs2_czech_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8347,9 +8380,12 @@ CHARSET_INFO my_charset_ucs2_danish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8374,9 +8410,12 @@ CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8401,9 +8440,12 @@ CHARSET_INFO my_charset_ucs2_slovak_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8428,9 +8470,12 @@ CHARSET_INFO my_charset_ucs2_spanish2_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8456,9 +8501,12 @@ CHARSET_INFO my_charset_ucs2_roman_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8484,9 +8532,12 @@ CHARSET_INFO my_charset_ucs2_persian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
@ -8559,9 +8610,12 @@ CHARSET_INFO my_charset_utf8_general_uca_ci=
uca_weight, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8587,9 +8641,12 @@ CHARSET_INFO my_charset_utf8_icelandic_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8614,9 +8671,12 @@ CHARSET_INFO my_charset_utf8_latvian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8641,9 +8701,12 @@ CHARSET_INFO my_charset_utf8_romanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8668,9 +8731,12 @@ CHARSET_INFO my_charset_utf8_slovenian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8695,9 +8761,12 @@ CHARSET_INFO my_charset_utf8_polish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8722,9 +8791,12 @@ CHARSET_INFO my_charset_utf8_estonian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8749,9 +8821,12 @@ CHARSET_INFO my_charset_utf8_spanish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8776,9 +8851,12 @@ CHARSET_INFO my_charset_utf8_swedish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8803,9 +8881,12 @@ CHARSET_INFO my_charset_utf8_turkish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_turkish, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
2, /* caseup_multiply */
2, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8830,9 +8911,12 @@ CHARSET_INFO my_charset_utf8_czech_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8858,9 +8942,12 @@ CHARSET_INFO my_charset_utf8_danish_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8885,9 +8972,12 @@ CHARSET_INFO my_charset_utf8_lithuanian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8912,9 +9002,12 @@ CHARSET_INFO my_charset_utf8_slovak_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8939,9 +9032,12 @@ CHARSET_INFO my_charset_utf8_spanish2_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8966,9 +9062,12 @@ CHARSET_INFO my_charset_utf8_roman_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */
@ -8993,9 +9092,12 @@ CHARSET_INFO my_charset_utf8_persian_uca_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
9, /* min_sort_char */

View File

@ -30,7 +30,6 @@
#define EILSEQ ENOENT
#endif
extern MY_UNICASE_INFO *uni_plane[256];
static uchar ctype_ucs2[] = {
0,
@ -113,20 +112,26 @@ static int my_uni_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
}
static void my_caseup_ucs2(CHARSET_INFO *cs, char *s, uint slen)
static uint my_caseup_ucs2(CHARSET_INFO *cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
my_wc_t wc;
int res;
char *e=s+slen;
while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
char *srcend= src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src == dst && srclen == dstlen);
while ((src < srcend) &&
(res= my_ucs2_uni(cs, &wc, (uchar *)src, (uchar*) srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if (res != my_uni_ucs2(cs,wc,(uchar*)s,(uchar*)e))
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if (res != my_uni_ucs2(cs, wc, (uchar*) src, (uchar*) srcend))
break;
s+=res;
src+= res;
}
return srclen;
}
@ -136,6 +141,7 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, uint slen,
my_wc_t wc;
int res;
const uchar *e=s+slen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while (e > s+1 && e[-1] == ' ' && e[-2] == '\0')
e-= 2;
@ -160,22 +166,26 @@ static void my_caseup_str_ucs2(CHARSET_INFO * cs __attribute__((unused)),
static void my_casedn_ucs2(CHARSET_INFO *cs, char *s, uint slen)
static uint my_casedn_ucs2(CHARSET_INFO *cs, char *src, uint srclen,
char *dst __attribute__((unused)),
uint dstlen __attribute__((unused)))
{
my_wc_t wc;
int res;
char *e=s+slen;
char *srcend= src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src == dst && srclen == dstlen);
while ((s < e) && (res=my_ucs2_uni(cs, &wc, (uchar*)s, (uchar*)e))>0)
while ((src < srcend) &&
(res= my_ucs2_uni(cs, &wc, (uchar*) src, (uchar*) srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if (res != my_uni_ucs2(cs, wc, (uchar*)s, (uchar*)e))
{
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if (res != my_uni_ucs2(cs, wc, (uchar*) src, (uchar*) srcend))
break;
}
s+=res;
src+= res;
}
return srclen;
}
static void my_casedn_str_ucs2(CHARSET_INFO *cs __attribute__((unused)),
@ -193,6 +203,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs,
my_wc_t s_wc,t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while ( s < se && t < te )
{
@ -256,6 +267,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
{
const uchar *se, *te;
uint minlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
/* extra safety to make sure the lengths are even numbers */
slen&= ~1;
@ -305,6 +317,7 @@ static int my_strncasecmp_ucs2(CHARSET_INFO *cs,
my_wc_t s_wc,t_wc;
const char *se=s+len;
const char *te=t+len;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while ( s < se && t < te )
{
@ -352,6 +365,7 @@ static int my_strnxfrm_ucs2(CHARSET_INFO *cs,
int plane;
uchar *de = dst + dstlen;
const uchar *se = src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while( src < se && dst < de )
{
@ -1310,6 +1324,7 @@ int my_wildcmp_ucs2_ci(CHARSET_INFO *cs,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many)
{
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend,
escape,w_one,w_many,uni_plane);
}
@ -1596,9 +1611,12 @@ CHARSET_INFO my_charset_ucs2_general_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
@ -1623,9 +1641,12 @@ CHARSET_INFO my_charset_ucs2_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -8566,9 +8566,12 @@ CHARSET_INFO my_charset_ujis_japanese_ci=
NULL, /* contractions */
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -8594,9 +8597,12 @@ CHARSET_INFO my_charset_ujis_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -172,6 +172,8 @@ static MY_UNICASE_INFO plane00[]={
{0x00DE,0x00FE,0x00DE}, {0x0178,0x00FF,0x0059}
};
static MY_UNICASE_INFO plane01[]={
{0x0100,0x0101,0x0041}, {0x0100,0x0101,0x0041},
{0x0102,0x0103,0x0041}, {0x0102,0x0103,0x0041},
@ -1482,7 +1484,7 @@ static MY_UNICASE_INFO planeFF[]={
{0xFFFE,0xFFFE,0xFFFE}, {0xFFFF,0xFFFF,0xFFFF}
};
MY_UNICASE_INFO *uni_plane[256]={
MY_UNICASE_INFO *my_unicase_default[256]={
plane00, plane01, plane02, plane03, plane04, plane05, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -1519,6 +1521,186 @@ MY_UNICASE_INFO *uni_plane[256]={
};
/*
Turkish lower/upper mapping:
1. LOWER(0x0049 LATIN CAPITAL LETTER I) ->
0x0131 LATIN SMALL LETTER DOTLESS I
2. UPPER(0x0069 LATIN SMALL LETTER I) ->
0x0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
static MY_UNICASE_INFO turk00[]=
{
{0x0000,0x0000,0x0000}, {0x0001,0x0001,0x0001},
{0x0002,0x0002,0x0002}, {0x0003,0x0003,0x0003},
{0x0004,0x0004,0x0004}, {0x0005,0x0005,0x0005},
{0x0006,0x0006,0x0006}, {0x0007,0x0007,0x0007},
{0x0008,0x0008,0x0008}, {0x0009,0x0009,0x0009},
{0x000A,0x000A,0x000A}, {0x000B,0x000B,0x000B},
{0x000C,0x000C,0x000C}, {0x000D,0x000D,0x000D},
{0x000E,0x000E,0x000E}, {0x000F,0x000F,0x000F},
{0x0010,0x0010,0x0010}, {0x0011,0x0011,0x0011},
{0x0012,0x0012,0x0012}, {0x0013,0x0013,0x0013},
{0x0014,0x0014,0x0014}, {0x0015,0x0015,0x0015},
{0x0016,0x0016,0x0016}, {0x0017,0x0017,0x0017},
{0x0018,0x0018,0x0018}, {0x0019,0x0019,0x0019},
{0x001A,0x001A,0x001A}, {0x001B,0x001B,0x001B},
{0x001C,0x001C,0x001C}, {0x001D,0x001D,0x001D},
{0x001E,0x001E,0x001E}, {0x001F,0x001F,0x001F},
{0x0020,0x0020,0x0020}, {0x0021,0x0021,0x0021},
{0x0022,0x0022,0x0022}, {0x0023,0x0023,0x0023},
{0x0024,0x0024,0x0024}, {0x0025,0x0025,0x0025},
{0x0026,0x0026,0x0026}, {0x0027,0x0027,0x0027},
{0x0028,0x0028,0x0028}, {0x0029,0x0029,0x0029},
{0x002A,0x002A,0x002A}, {0x002B,0x002B,0x002B},
{0x002C,0x002C,0x002C}, {0x002D,0x002D,0x002D},
{0x002E,0x002E,0x002E}, {0x002F,0x002F,0x002F},
{0x0030,0x0030,0x0030}, {0x0031,0x0031,0x0031},
{0x0032,0x0032,0x0032}, {0x0033,0x0033,0x0033},
{0x0034,0x0034,0x0034}, {0x0035,0x0035,0x0035},
{0x0036,0x0036,0x0036}, {0x0037,0x0037,0x0037},
{0x0038,0x0038,0x0038}, {0x0039,0x0039,0x0039},
{0x003A,0x003A,0x003A}, {0x003B,0x003B,0x003B},
{0x003C,0x003C,0x003C}, {0x003D,0x003D,0x003D},
{0x003E,0x003E,0x003E}, {0x003F,0x003F,0x003F},
{0x0040,0x0040,0x0040}, {0x0041,0x0061,0x0041},
{0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043},
{0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045},
{0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047},
{0x0048,0x0068,0x0048}, {0x0049,0x0131,0x0049},
{0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B},
{0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D},
{0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F},
{0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051},
{0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053},
{0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055},
{0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057},
{0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059},
{0x005A,0x007A,0x005A}, {0x005B,0x005B,0x005B},
{0x005C,0x005C,0x005C}, {0x005D,0x005D,0x005D},
{0x005E,0x005E,0x005E}, {0x005F,0x005F,0x005F},
{0x0060,0x0060,0x0060}, {0x0041,0x0061,0x0041},
{0x0042,0x0062,0x0042}, {0x0043,0x0063,0x0043},
{0x0044,0x0064,0x0044}, {0x0045,0x0065,0x0045},
{0x0046,0x0066,0x0046}, {0x0047,0x0067,0x0047},
{0x0048,0x0068,0x0048}, {0x0130,0x0069,0x0049},
{0x004A,0x006A,0x004A}, {0x004B,0x006B,0x004B},
{0x004C,0x006C,0x004C}, {0x004D,0x006D,0x004D},
{0x004E,0x006E,0x004E}, {0x004F,0x006F,0x004F},
{0x0050,0x0070,0x0050}, {0x0051,0x0071,0x0051},
{0x0052,0x0072,0x0052}, {0x0053,0x0073,0x0053},
{0x0054,0x0074,0x0054}, {0x0055,0x0075,0x0055},
{0x0056,0x0076,0x0056}, {0x0057,0x0077,0x0057},
{0x0058,0x0078,0x0058}, {0x0059,0x0079,0x0059},
{0x005A,0x007A,0x005A}, {0x007B,0x007B,0x007B},
{0x007C,0x007C,0x007C}, {0x007D,0x007D,0x007D},
{0x007E,0x007E,0x007E}, {0x007F,0x007F,0x007F},
{0x0080,0x0080,0x0080}, {0x0081,0x0081,0x0081},
{0x0082,0x0082,0x0082}, {0x0083,0x0083,0x0083},
{0x0084,0x0084,0x0084}, {0x0085,0x0085,0x0085},
{0x0086,0x0086,0x0086}, {0x0087,0x0087,0x0087},
{0x0088,0x0088,0x0088}, {0x0089,0x0089,0x0089},
{0x008A,0x008A,0x008A}, {0x008B,0x008B,0x008B},
{0x008C,0x008C,0x008C}, {0x008D,0x008D,0x008D},
{0x008E,0x008E,0x008E}, {0x008F,0x008F,0x008F},
{0x0090,0x0090,0x0090}, {0x0091,0x0091,0x0091},
{0x0092,0x0092,0x0092}, {0x0093,0x0093,0x0093},
{0x0094,0x0094,0x0094}, {0x0095,0x0095,0x0095},
{0x0096,0x0096,0x0096}, {0x0097,0x0097,0x0097},
{0x0098,0x0098,0x0098}, {0x0099,0x0099,0x0099},
{0x009A,0x009A,0x009A}, {0x009B,0x009B,0x009B},
{0x009C,0x009C,0x009C}, {0x009D,0x009D,0x009D},
{0x009E,0x009E,0x009E}, {0x009F,0x009F,0x009F},
{0x00A0,0x00A0,0x00A0}, {0x00A1,0x00A1,0x00A1},
{0x00A2,0x00A2,0x00A2}, {0x00A3,0x00A3,0x00A3},
{0x00A4,0x00A4,0x00A4}, {0x00A5,0x00A5,0x00A5},
{0x00A6,0x00A6,0x00A6}, {0x00A7,0x00A7,0x00A7},
{0x00A8,0x00A8,0x00A8}, {0x00A9,0x00A9,0x00A9},
{0x00AA,0x00AA,0x00AA}, {0x00AB,0x00AB,0x00AB},
{0x00AC,0x00AC,0x00AC}, {0x00AD,0x00AD,0x00AD},
{0x00AE,0x00AE,0x00AE}, {0x00AF,0x00AF,0x00AF},
{0x00B0,0x00B0,0x00B0}, {0x00B1,0x00B1,0x00B1},
{0x00B2,0x00B2,0x00B2}, {0x00B3,0x00B3,0x00B3},
{0x00B4,0x00B4,0x00B4}, {0x039C,0x00B5,0x039C},
{0x00B6,0x00B6,0x00B6}, {0x00B7,0x00B7,0x00B7},
{0x00B8,0x00B8,0x00B8}, {0x00B9,0x00B9,0x00B9},
{0x00BA,0x00BA,0x00BA}, {0x00BB,0x00BB,0x00BB},
{0x00BC,0x00BC,0x00BC}, {0x00BD,0x00BD,0x00BD},
{0x00BE,0x00BE,0x00BE}, {0x00BF,0x00BF,0x00BF},
{0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041},
{0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041},
{0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041},
{0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043},
{0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045},
{0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045},
{0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049},
{0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049},
{0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E},
{0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F},
{0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F},
{0x00D6,0x00F6,0x004F}, {0x00D7,0x00D7,0x00D7},
{0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055},
{0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055},
{0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059},
{0x00DE,0x00FE,0x00DE}, {0x00DF,0x00DF,0x00DF},
{0x00C0,0x00E0,0x0041}, {0x00C1,0x00E1,0x0041},
{0x00C2,0x00E2,0x0041}, {0x00C3,0x00E3,0x0041},
{0x00C4,0x00E4,0x0041}, {0x00C5,0x00E5,0x0041},
{0x00C6,0x00E6,0x00C6}, {0x00C7,0x00E7,0x0043},
{0x00C8,0x00E8,0x0045}, {0x00C9,0x00E9,0x0045},
{0x00CA,0x00EA,0x0045}, {0x00CB,0x00EB,0x0045},
{0x00CC,0x00EC,0x0049}, {0x00CD,0x00ED,0x0049},
{0x00CE,0x00EE,0x0049}, {0x00CF,0x00EF,0x0049},
{0x00D0,0x00F0,0x00D0}, {0x00D1,0x00F1,0x004E},
{0x00D2,0x00F2,0x004F}, {0x00D3,0x00F3,0x004F},
{0x00D4,0x00F4,0x004F}, {0x00D5,0x00F5,0x004F},
{0x00D6,0x00F6,0x004F}, {0x00F7,0x00F7,0x00F7},
{0x00D8,0x00F8,0x00D8}, {0x00D9,0x00F9,0x0055},
{0x00DA,0x00FA,0x0055}, {0x00DB,0x00FB,0x0055},
{0x00DC,0x00FC,0x0055}, {0x00DD,0x00FD,0x0059},
{0x00DE,0x00FE,0x00DE}, {0x0178,0x00FF,0x0059}
};
MY_UNICASE_INFO *my_unicase_turkish[256]=
{
turk00, plane01, plane02, plane03, plane04, plane05, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
NULL, plane21, NULL, NULL, plane24, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, planeFF
};
/*
** Compare string against string with wildcard
** This function is used in UTF8 and UCS2
@ -1907,20 +2089,26 @@ static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)) ,
}
static void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint slen)
static uint my_caseup_utf8(CHARSET_INFO *cs, char *src, uint srclen,
char *dst, uint dstlen)
{
my_wc_t wc;
int res;
char *e=s+slen;
int srcres, dstres;
char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src != dst || cs->caseup_multiply == 1);
while ((s < e) && (res=my_utf8_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
while ((src < srcend) &&
(srcres= my_utf8_uni(cs, &wc, (uchar *) src, (uchar*) srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if (res != my_uni_utf8(cs,wc,(uchar*)s,(uchar*)e))
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].toupper : wc;
if ((dstres= my_uni_utf8(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
break;
s+=res;
src+= srcres;
dst+= dstres;
}
return dst - dst0;
}
static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen,
@ -1929,6 +2117,7 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen,
my_wc_t wc;
int res;
const uchar *e=s+slen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
/*
Remove end space. We have to do this to be able to compare
@ -1952,31 +2141,37 @@ static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen,
static void my_caseup_str_utf8(CHARSET_INFO * cs, char * s)
{
my_caseup_utf8(cs, s, strlen(s));
uint len= strlen(s);
my_caseup_utf8(cs, s, len, s, len);
}
static void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint slen)
static uint my_casedn_utf8(CHARSET_INFO *cs, char *src, uint srclen,
char *dst, uint dstlen)
{
my_wc_t wc;
int res;
char *e=s+slen;
int srcres, dstres;
char *srcend= src + srclen, *dstend= dst + dstlen, *dst0= dst;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
DBUG_ASSERT(src != dst || cs->casedn_multiply == 1);
while ((s < e) && (res=my_utf8_uni(cs, &wc, (uchar*)s, (uchar*)e))>0)
while ((src < srcend) &&
(srcres= my_utf8_uni(cs, &wc, (uchar*) src, (uchar*)srcend)) > 0)
{
int plane = (wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if (res != my_uni_utf8(cs, wc, (uchar*)s, (uchar*)e))
{
int plane= (wc>>8) & 0xFF;
wc= uni_plane[plane] ? uni_plane[plane][wc & 0xFF].tolower : wc;
if ((dstres= my_uni_utf8(cs, wc, (uchar*) dst, (uchar*) dstend)) <= 0)
break;
}
s+=res;
src+= srcres;
dst+= dstres;
}
return dst - dst0;
}
static void my_casedn_str_utf8(CHARSET_INFO *cs, char * s)
{
my_casedn_utf8(cs, s, strlen(s));
uint len= strlen(s);
my_casedn_utf8(cs, s, len, s, len);
}
@ -1989,6 +2184,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs,
my_wc_t s_wc,t_wc;
const uchar *se=s+slen;
const uchar *te=t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while ( s < se && t < te )
{
@ -2057,6 +2253,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
int s_res, t_res, res;
my_wc_t s_wc,t_wc;
const uchar *se= s+slen, *te= t+tlen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
diff_if_only_endspace_difference= 0;
@ -2144,6 +2341,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
static
int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
{
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while (s[0] && t[0])
{
my_wc_t s_wc,t_wc;
@ -2228,6 +2426,7 @@ int my_wildcmp_utf8(CHARSET_INFO *cs,
const char *wildstr,const char *wildend,
int escape, int w_one, int w_many)
{
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
return my_wildcmp_unicode(cs,str,str_end,wildstr,wildend,
escape,w_one,w_many,uni_plane);
}
@ -2249,6 +2448,7 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
uchar *de= dst + dstlen;
uchar *de_beg= de - 1;
const uchar *se = src + srclen;
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
while (dst < de_beg)
{
@ -2367,9 +2567,12 @@ CHARSET_INFO my_charset_utf8_general_ci=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -2395,9 +2598,12 @@ CHARSET_INFO my_charset_utf8_bin=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */
@ -2561,9 +2767,12 @@ CHARSET_INFO my_charset_utf8_general_cs=
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
1, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
3, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -652,9 +652,12 @@ CHARSET_INFO my_charset_cp1250_czech_ci =
NULL, /* sort_order_big*/
tab_cp1250_uni, /* tab_to_uni */
idx_uni_cp1250, /* tab_from_uni */
my_unicase_default, /* caseinfo */
NULL, /* state_map */
NULL, /* ident_map */
2, /* strxfrm_multiply */
1, /* caseup_multiply */
1, /* casedn_multiply */
1, /* mbminlen */
1, /* mbmaxlen */
0, /* min_sort_char */

View File

@ -1549,15 +1549,19 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
}
else
{
while (unlikely(*buf1 == 0) && buf1 >= to->buf)
buf1--;
if (buf1 < to->buf)
for (;;)
{
decimal_make_zero(to);
return E_DEC_OK;
if (likely(*buf1))
break;
if (buf1-- == to->buf)
{
decimal_make_zero(to);
return E_DEC_OK;
}
}
}
if (scale<0) scale=0;
if (scale<0)
scale=0;
done:
to->frac=scale;
@ -1727,11 +1731,14 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2)
buf1++, buf2++;
if (buf1 <= end1)
{
if (buf2 <= end2)
carry= *buf2 > *buf1;
else
carry= 0;
}
else
{
if (buf2 <= end2)
carry=1;
else /* short-circuit everything: from1 == from2 */
@ -1741,6 +1748,7 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
decimal_make_zero(to);
return E_DEC_OK;
}
}
}
if (to == 0) /* decimal_cmp() */
@ -1937,10 +1945,18 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to)
{
dec1 *buf= to->buf;
dec1 *end= to->buf + intg0 + frac0;
for (; (buf<end) && !*buf; buf++);
if (buf == end)
/* So we got decimal zero */
decimal_make_zero(to);
DBUG_ASSERT(buf != end);
for (;;)
{
if (*buf)
break;
if (++buf == end)
{
/* We got decimal zero */
decimal_make_zero(to);
break;
}
}
}
return error;
}