Commit 38d1a424 authored by monty@mysql.com's avatar monty@mysql.com

Merge with 4.1

parents 410e51c8 44ceb84c
...@@ -222,6 +222,7 @@ serg@sergbook.mysql.com ...@@ -222,6 +222,7 @@ serg@sergbook.mysql.com
sergefp@mysql.com sergefp@mysql.com
sinisa@rhols221.adsl.netsonic.fi sinisa@rhols221.adsl.netsonic.fi
stewart@mysql.com stewart@mysql.com
svoj@mysql.com
tfr@beta.frontier86.ee tfr@beta.frontier86.ee
tfr@indrek.tfr.cafe.ee tfr@indrek.tfr.cafe.ee
tfr@sarvik.tfr.cafe.ee tfr@sarvik.tfr.cafe.ee
......
...@@ -62,7 +62,6 @@ From: $FROM ...@@ -62,7 +62,6 @@ From: $FROM
To: $INTERNALS To: $INTERNALS
Subject: bk commit into $VERSION tree ($CHANGESET)$BS Subject: bk commit into $VERSION tree ($CHANGESET)$BS
$BH $BH
Below is the list of changes that have just been committed into a local Below is the list of changes that have just been committed into a local
$VERSION repository of $USER. When $USER does a push these changes will $VERSION repository of $USER. When $USER does a push these changes will
be propagated to the main repository and, within 24 hours after the be propagated to the main repository and, within 24 hours after the
......
...@@ -71,9 +71,11 @@ void Querycache_stream::store_int(uint i) ...@@ -71,9 +71,11 @@ void Querycache_stream::store_int(uint i)
cur_data+= 4; cur_data+= 4;
return; return;
} }
memcpy(cur_data, &i, rest_len); char buf[4];
int4store(buf, i);
memcpy(cur_data, buf, rest_len);
use_next_block(); use_next_block();
memcpy(cur_data, ((byte*)&i)+rest_len, 4-rest_len); memcpy(cur_data, buf+rest_len, 4-rest_len);
cur_data+= 4-rest_len; cur_data+= 4-rest_len;
} }
...@@ -186,10 +188,12 @@ uint Querycache_stream::load_int() ...@@ -186,10 +188,12 @@ uint Querycache_stream::load_int()
cur_data+= 4; cur_data+= 4;
return result; return result;
} }
memcpy(&result, cur_data, rest_len); char buf[4];
memcpy(buf, cur_data, rest_len);
use_next_block(); use_next_block();
memcpy(((byte*)&result)+rest_len, cur_data, 4-rest_len); memcpy(buf+rest_len, cur_data, 4-rest_len);
cur_data+= 4-rest_len; cur_data+= 4-rest_len;
result= uint4korr(buf);
return result; return result;
} }
...@@ -270,10 +274,10 @@ int Querycache_stream::load_column(MEM_ROOT *alloc, char** column) ...@@ -270,10 +274,10 @@ int Querycache_stream::load_column(MEM_ROOT *alloc, char** column)
return 0; return 0;
} }
len--; len--;
if (!(*column= (char *)alloc_root(alloc, len + 4 + 1))) if (!(*column= (char *)alloc_root(alloc, len + sizeof(uint) + 1)))
return 1; return 1;
int4store(*column, len); *((uint*)*column)= len;
(*column)+= 4; (*column)+= sizeof(uint);
load_str_only(*column, len); load_str_only(*column, len);
return 1; return 1;
} }
......
...@@ -436,32 +436,24 @@ static int _ftb_strstr(const byte *s0, const byte *e0, ...@@ -436,32 +436,24 @@ static int _ftb_strstr(const byte *s0, const byte *e0,
const byte *s1, const byte *e1, const byte *s1, const byte *e1,
CHARSET_INFO *cs) CHARSET_INFO *cs)
{ {
const byte *p0, *p1; const byte *p0= s0;
my_bool s_after, e_before; my_bool s_after= true_word_char(cs, s1[0]);
my_bool e_before= true_word_char(cs, e1[-1]);
s_after=true_word_char(cs, s1[0]); uint p0_len;
e_before=true_word_char(cs, e1[-1]); my_match_t m[2];
p0=s0;
while (p0 < e0) while (p0 < e0)
{ {
while (p0 < e0 && cs->to_upper[(uint) (uchar) *p0++] != if (cs->coll->instr(cs, p0, e0 - p0, s1, e1 - s1, m, 2) != 2)
cs->to_upper[(uint) (uchar) *s1]) return(0);
/* no-op */; if ((!s_after || p0 + m[1].beg == s0 || !true_word_char(cs, p0[m[1].beg-1])) &&
if (p0 >= e0) (!e_before || p0 + m[1].end == e0 || !true_word_char(cs, p0[m[1].end])))
return 0; return(1);
p0+= m[1].beg;
if (s_after && p0-1 > s0 && true_word_char(cs, p0[-2])) p0+= (p0_len= my_mbcharlen(cs, *(uchar *)p0)) ? p0_len : 1;
continue;
p1=s1+1;
while (p0 < e0 && p1 < e1 && cs->to_upper[(uint) (uchar) *p0] ==
cs->to_upper[(uint) (uchar) *p1])
p0++, p1++;
if (p1 == e1 && (!e_before || p0 == e0 || !true_word_char(cs, p0[0])))
return 1;
} }
return 0;
return(0);
} }
......
...@@ -71,15 +71,15 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) ...@@ -71,15 +71,15 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_RELEASE)) if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_RELEASE))
goto err; goto err;
do do
{ {
/* Read the next block of index file into the preload buffer */ /* Read the next block of index file into the preload buffer */
if ((my_off_t) length > (key_file_length-pos)) if ((my_off_t) length > (key_file_length-pos))
length= (ulong) (key_file_length-pos); length= (ulong) (key_file_length-pos);
if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE))) if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE|MY_FNABP)))
goto err; goto err;
if (ignore_leaves) if (ignore_leaves)
{ {
uchar *end= buff+length; uchar *end= buff+length;
...@@ -88,7 +88,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) ...@@ -88,7 +88,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
if (mi_test_if_nod(buff)) if (mi_test_if_nod(buff))
{ {
if (key_cache_insert(share->key_cache, if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS, share->kfile, pos, DFLT_INIT_HITS,
(byte*) buff, block_length)) (byte*) buff, block_length))
goto err; goto err;
} }
......
...@@ -624,3 +624,17 @@ ucs2_bin 00610009 ...@@ -624,3 +624,17 @@ ucs2_bin 00610009
ucs2_bin 0061 ucs2_bin 0061
ucs2_bin 00610020 ucs2_bin 00610020
drop table t1; drop table t1;
SET NAMES latin1;
SET collation_connection='ucs2_swedish_ci';
CREATE TABLE t1 (Field1 int(10) default '0');
INSERT INTO t1 VALUES ('-1');
SELECT * FROM t1;
Field1
-1
DROP TABLE t1;
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
INSERT INTO t1 VALUES ('-1');
Warnings:
Warning 1265 Data truncated for column 'Field1' at row 1
DROP TABLE t1;
SET NAMES latin1;
...@@ -408,3 +408,10 @@ insert t1 values (1, "aaaa"), (2, "bbbb"); ...@@ -408,3 +408,10 @@ insert t1 values (1, "aaaa"), (2, "bbbb");
insert t2 values (10, "aaaa"), (2, "cccc"); insert t2 values (10, "aaaa"), (2, "cccc");
replace t1 select * from t2; replace t1 select * from t2;
drop table t1, t2; drop table t1, t2;
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
SET NAMES latin1;
INSERT INTO t1 VALUES('Mit freundlichem Gr aus Osnabrck');
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrck"' IN BOOLEAN MODE);
COUNT(*)
1
DROP TABLE t1;
...@@ -74,15 +74,15 @@ Table Op Msg_type Msg_text ...@@ -74,15 +74,15 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK test.t1 preload_keys status OK
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 0 Key_read_requests 581
Key_reads 0 Key_reads 581
select count(*) from t1 where b = 'test1'; select count(*) from t1 where b = 'test1';
count(*) count(*)
4181 4181
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 217 Key_read_requests 798
Key_reads 45 Key_reads 581
flush tables; flush tables;
flush status; flush status;
show status like "key_read%"; show status like "key_read%";
...@@ -98,15 +98,15 @@ Table Op Msg_type Msg_text ...@@ -98,15 +98,15 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK test.t1 preload_keys status OK
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 0 Key_read_requests 10
Key_reads 0 Key_reads 10
select count(*) from t1 where b = 'test1'; select count(*) from t1 where b = 'test1';
count(*) count(*)
4181 4181
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 217 Key_read_requests 227
Key_reads 45 Key_reads 52
flush tables; flush tables;
flush status; flush status;
show status like "key_read%"; show status like "key_read%";
...@@ -123,8 +123,8 @@ test.t1 preload_keys status OK ...@@ -123,8 +123,8 @@ test.t1 preload_keys status OK
test.t2 preload_keys status OK test.t2 preload_keys status OK
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 0 Key_read_requests 587
Key_reads 0 Key_reads 587
select count(*) from t1 where b = 'test1'; select count(*) from t1 where b = 'test1';
count(*) count(*)
4181 4181
...@@ -133,8 +133,8 @@ count(*) ...@@ -133,8 +133,8 @@ count(*)
2584 2584
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 351 Key_read_requests 938
Key_reads 73 Key_reads 613
flush tables; flush tables;
flush status; flush status;
show status like "key_read%"; show status like "key_read%";
...@@ -147,8 +147,8 @@ test.t3 preload_keys error Table 'test.t3' doesn't exist ...@@ -147,8 +147,8 @@ test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys status OK test.t2 preload_keys status OK
show status like "key_read%"; show status like "key_read%";
Variable_name Value Variable_name Value
Key_read_requests 0 Key_read_requests 355
Key_reads 0 Key_reads 355
flush tables; flush tables;
flush status; flush status;
show status like "key_read%"; show status like "key_read%";
......
...@@ -1173,3 +1173,25 @@ show columns from t4; ...@@ -1173,3 +1173,25 @@ show columns from t4;
Field Type Null Key Default Extra Field Type Null Key Default Extra
sdate date YES NULL sdate date YES NULL
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
create table t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
select * from ((select * from t1 limit 1)) a;
a b
1 a
select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
a b
1 a
select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
a b
1 a
select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
a b
1 a
2 b
3 c
select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
a b
1 a
2 b
3 c
drop table t1;
...@@ -392,3 +392,24 @@ SET collation_connection='ucs2_general_ci'; ...@@ -392,3 +392,24 @@ SET collation_connection='ucs2_general_ci';
SET NAMES latin1; SET NAMES latin1;
SET collation_connection='ucs2_bin'; SET collation_connection='ucs2_bin';
-- source include/ctype_filesort.inc -- source include/ctype_filesort.inc
SET NAMES latin1;
#
# Bug#8235
#
# This bug also helped to find another problem that
# INSERT of a UCS2 string containing a negative number
# into a unsigned int column didn't produce warnings.
# This test covers both problems.
#
SET collation_connection='ucs2_swedish_ci';
CREATE TABLE t1 (Field1 int(10) default '0');
# no warnings, negative numbers are allowed
INSERT INTO t1 VALUES ('-1');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (Field1 int(10) unsigned default '0');
# this should generate a "Data truncated" warning
INSERT INTO t1 VALUES ('-1');
DROP TABLE t1;
SET NAMES latin1;
...@@ -322,3 +322,11 @@ insert t2 values (10, "aaaa"), (2, "cccc"); ...@@ -322,3 +322,11 @@ insert t2 values (10, "aaaa"), (2, "cccc");
replace t1 select * from t2; replace t1 select * from t2;
drop table t1, t2; drop table t1, t2;
#
# bug#8351
#
CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
SET NAMES latin1;
INSERT INTO t1 VALUES('Mit freundlichem Gr aus Osnabrck');
SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrck"' IN BOOLEAN MODE);
DROP TABLE t1;
...@@ -717,3 +717,15 @@ union ...@@ -717,3 +717,15 @@ union
order by sdate; order by sdate;
show columns from t4; show columns from t4;
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
#
# Bug #2435 UNION with parentheses not supported
#
create table t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
select * from ((select * from t1 limit 1)) a;
select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
drop table t1;
...@@ -10,7 +10,7 @@ test_DATA=daily-basic-tests.txt daily-devel-tests.txt ...@@ -10,7 +10,7 @@ test_DATA=daily-basic-tests.txt daily-devel-tests.txt
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \ test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh atrt-clear-result.sh make-config.sh make-index.sh make-html-reports.sh
atrt_SOURCES = main.cpp atrt_SOURCES = main.cpp run-test.hpp
INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include INCLUDES_LOC = -I$(top_srcdir)/ndb/test/include
LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \ LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/ndb/src/libndbclient.la \
...@@ -21,7 +21,7 @@ LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \ ...@@ -21,7 +21,7 @@ LDADD_LOC = $(top_builddir)/ndb/test/src/libNDBT.a \
wrappersdir=$(prefix)/bin wrappersdir=$(prefix)/bin
wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run wrappers_SCRIPTS=atrt-testBackup atrt-mysql-test-run
noinst_HEADERS = run-test.hpp $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT EXTRA_DIST = $(test_DATA) $(test_SCRIPTS) $(wrappers_SCRIPTS) README.ATRT
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
......
...@@ -176,9 +176,7 @@ then ...@@ -176,9 +176,7 @@ then
INSERT INTO user (host,user) values ('localhost','');" INSERT INTO user (host,user) values ('localhost','');"
else else
i_u="$i_u i_u="$i_u
INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);"
INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);"
fi fi
fi fi
fi fi
......
...@@ -115,6 +115,8 @@ ...@@ -115,6 +115,8 @@
data - The data is stored in a "row +blobs" format. data - The data is stored in a "row +blobs" format.
*/ */
/* If the archive storage engine has been inited */
static bool archive_inited= 0;
/* Variables for archive share methods */ /* Variables for archive share methods */
pthread_mutex_t archive_mutex; pthread_mutex_t archive_mutex;
static HASH archive_open_tables; static HASH archive_open_tables;
...@@ -158,6 +160,7 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length, ...@@ -158,6 +160,7 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
bool archive_db_init() bool archive_db_init()
{ {
archive_inited= 1;
VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST)); VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0, return (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
(hash_get_key) archive_get_key, 0, 0)); (hash_get_key) archive_get_key, 0, 0));
...@@ -177,8 +180,12 @@ bool archive_db_init() ...@@ -177,8 +180,12 @@ bool archive_db_init()
bool archive_db_end() bool archive_db_end()
{ {
hash_free(&archive_open_tables); if (archive_inited)
VOID(pthread_mutex_destroy(&archive_mutex)); {
hash_free(&archive_open_tables);
VOID(pthread_mutex_destroy(&archive_mutex));
}
archive_inited= 0;
return FALSE; return FALSE;
} }
......
...@@ -2432,6 +2432,13 @@ void Field_medium::sql_type(String &res) const ...@@ -2432,6 +2432,13 @@ void Field_medium::sql_type(String &res) const
** long int ** long int
****************************************************************************/ ****************************************************************************/
static bool test_if_minus(CHARSET_INFO *cs,
const char *s, const char *e)
{
my_wc_t wc;
return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-';
}
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
{ {
...@@ -2734,7 +2741,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -2734,7 +2741,7 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
from+= tmp; from+= tmp;
if (unsigned_flag) if (unsigned_flag)
{ {
if (!len || *from == '-') if (!len || test_if_minus(cs, from, from + len))
{ {
tmp=0; // Set negative to 0 tmp=0; // Set negative to 0
error= 1; error= 1;
......
...@@ -121,8 +121,7 @@ public: ...@@ -121,8 +121,7 @@ public:
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
{ TRASH(ptr, size); }
enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM,
INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM, INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM,
......
...@@ -1665,7 +1665,8 @@ String *Item_func_format::val_str(String *str) ...@@ -1665,7 +1665,8 @@ String *Item_func_format::val_str(String *str)
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
double nr= args[0]->val_real(); double nr= args[0]->val_real();
uint32 diff,length,str_length; int diff;
uint32 length, str_length;
uint dec; uint dec;
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
...@@ -1690,9 +1691,12 @@ String *Item_func_format::val_str(String *str) ...@@ -1690,9 +1691,12 @@ String *Item_func_format::val_str(String *str)
pos[0]= pos[-(int) diff]; pos[0]= pos[-(int) diff];
while (diff) while (diff)
{ {
pos[0]=pos[-(int) diff]; pos--; *pos= *(pos - diff);
pos[0]=pos[-(int) diff]; pos--; pos--;
pos[0]=pos[-(int) diff]; pos--; *pos= *(pos - diff);
pos--;
*pos= *(pos - diff);
pos--;
pos[0]=','; pos[0]=',';
pos--; pos--;
diff--; diff--;
......
...@@ -1438,7 +1438,7 @@ ulong Query_cache::init_cache() ...@@ -1438,7 +1438,7 @@ ulong Query_cache::init_cache()
init(); init();
approx_additional_data_size = (sizeof(Query_cache) + approx_additional_data_size = (sizeof(Query_cache) +
sizeof(gptr)*(def_query_hash_size+ sizeof(gptr)*(def_query_hash_size+
def_query_hash_size)); def_table_hash_size));
if (query_cache_size < approx_additional_data_size) if (query_cache_size < approx_additional_data_size)
goto err; goto err;
......
...@@ -767,6 +767,8 @@ struct Item_change_record: public ilink ...@@ -767,6 +767,8 @@ struct Item_change_record: public ilink
Item *old_value; Item *old_value;
/* Placement new was hidden by `new' in ilink (TODO: check): */ /* Placement new was hidden by `new' in ilink (TODO: check): */
static void *operator new(size_t size, void *mem) { return mem; } static void *operator new(size_t size, void *mem) { return mem; }
static void operator delete(void *ptr, size_t size) {}
static void operator delete(void *ptr, void *mem) { /* never called */ }
}; };
......
...@@ -285,8 +285,7 @@ public: ...@@ -285,8 +285,7 @@ public:
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
{ TRASH(ptr, size); }
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {} st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
virtual ~st_select_lex_node() {} virtual ~st_select_lex_node() {}
inline st_select_lex_node* get_master() { return master; } inline st_select_lex_node* get_master() { return master; }
......
...@@ -35,8 +35,8 @@ public: ...@@ -35,8 +35,8 @@ public:
static void *operator new(size_t size, MEM_ROOT *mem_root) static void *operator new(size_t size, MEM_ROOT *mem_root)
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }
static void operator delete(void *ptr, size_t size, MEM_ROOT *mem_root) static void operator delete(void *ptr, MEM_ROOT *mem_root)
{ TRASH(ptr, size); } { /* never called */ }
static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); } static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); }
#ifdef HAVE_purify #ifdef HAVE_purify
bool dummy; bool dummy;
......
...@@ -708,12 +708,12 @@ static int check_connection(THD *thd) ...@@ -708,12 +708,12 @@ static int check_connection(THD *thd)
{ {
uint connect_errors= 0; uint connect_errors= 0;
NET *net= &thd->net; NET *net= &thd->net;
ulong pkt_len= 0;
char *end;
DBUG_PRINT("info", DBUG_PRINT("info",
("New connection received on %s", vio_description(net->vio))); ("New connection received on %s", vio_description(net->vio)));
vio_in_addr(net->vio,&thd->remote.sin_addr);
if (!thd->host) // If TCP/IP connection if (!thd->host) // If TCP/IP connection
{ {
char ip[30]; char ip[30];
...@@ -723,6 +723,7 @@ static int check_connection(THD *thd) ...@@ -723,6 +723,7 @@ static int check_connection(THD *thd)
if (!(thd->ip= my_strdup(ip,MYF(0)))) if (!(thd->ip= my_strdup(ip,MYF(0))))
return (ER_OUT_OF_RESOURCES); return (ER_OUT_OF_RESOURCES);
thd->host_or_ip= thd->ip; thd->host_or_ip= thd->ip;
vio_in_addr(net->vio,&thd->remote.sin_addr);
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread) #if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
/* Fast local hostname resolve for Win32 */ /* Fast local hostname resolve for Win32 */
if (!strcmp(thd->ip,"127.0.0.1")) if (!strcmp(thd->ip,"127.0.0.1"))
...@@ -758,10 +759,10 @@ static int check_connection(THD *thd) ...@@ -758,10 +759,10 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host)); DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host; thd->host_or_ip= thd->host;
thd->ip= 0; thd->ip= 0;
/* Reset sin_addr */
bzero((char*) &thd->remote, sizeof(thd->remote));
} }
vio_keepalive(net->vio, TRUE); vio_keepalive(net->vio, TRUE);
ulong pkt_len= 0;
char *end;
{ {
/* buff[] needs to big enough to hold the server_version variable */ /* buff[] needs to big enough to hold the server_version variable */
char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64]; char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH + 64];
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
{ return (void*) alloc_root(mem_root, (uint) size); } { return (void*) alloc_root(mem_root, (uint) size); }
static void operator delete(void *ptr_arg,size_t size) static void operator delete(void *ptr_arg,size_t size)
{ TRASH(ptr_arg, size); } { TRASH(ptr_arg, size); }
static void operator delete(void *ptr_arg,size_t size, MEM_ROOT *mem_root) static void operator delete(void *ptr_arg, MEM_ROOT *mem_root)
{ TRASH(ptr_arg, size); } { TRASH(ptr_arg, size); }
~String() { free(); } ~String() { free(); }
......
...@@ -3811,7 +3811,10 @@ select: ...@@ -3811,7 +3811,10 @@ select:
select_init: select_init:
SELECT_SYM select_init2 SELECT_SYM select_init2
| |
'(' SELECT_SYM select_part2 ')' '(' select_paren ')' union_opt;
select_paren:
SELECT_SYM select_part2
{ {
LEX *lex= Lex; LEX *lex= Lex;
SELECT_LEX * sel= lex->current_select; SELECT_LEX * sel= lex->current_select;
...@@ -3830,7 +3833,8 @@ select_init: ...@@ -3830,7 +3833,8 @@ select_init:
if (sel->master_unit()->fake_select_lex) if (sel->master_unit()->fake_select_lex)
sel->master_unit()->global_parameters= sel->master_unit()->global_parameters=
sel->master_unit()->fake_select_lex; sel->master_unit()->fake_select_lex;
} union_opt; }
| '(' select_paren ')';
select_init2: select_init2:
select_part2 select_part2
...@@ -4990,7 +4994,7 @@ table_factor: ...@@ -4990,7 +4994,7 @@ table_factor:
} }
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}' | '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; } { add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
| '(' SELECT_SYM select_derived ')' opt_table_alias | '(' select_derived union_opt ')' opt_table_alias
{ {
LEX *lex=Lex; LEX *lex=Lex;
SELECT_LEX_UNIT *unit= lex->current_select->master_unit(); SELECT_LEX_UNIT *unit= lex->current_select->master_unit();
...@@ -5004,6 +5008,24 @@ table_factor: ...@@ -5004,6 +5008,24 @@ table_factor:
lex->current_select->add_joined_table($$); lex->current_select->add_joined_table($$);
}; };
select_derived:
SELECT_SYM select_derived2
| '(' select_derived ')'
{
SELECT_LEX *sel= Select;
if (sel->set_braces(1))
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
/* select in braces, can't contain global parameters */
if (sel->master_unit()->fake_select_lex)
sel->master_unit()->global_parameters=
sel->master_unit()->fake_select_lex;
}
;
select_derived: select_derived:
{ {
LEX *lex= Lex; LEX *lex= Lex;
...@@ -5026,7 +5048,7 @@ select_derived: ...@@ -5026,7 +5048,7 @@ select_derived:
{ {
Select->parsing_place= NO_MATTER; Select->parsing_place= NO_MATTER;
} }
opt_select_from union_opt opt_select_from
; ;
opt_outer: opt_outer:
......
...@@ -661,7 +661,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -661,7 +661,6 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if (!(field->flags & BINARY_FLAG)) if (!(field->flags & BINARY_FLAG))
keyinfo->flags|= HA_END_SPACE_KEY; keyinfo->flags|= HA_END_SPACE_KEY;
} }
set_if_bigger(share->max_key_length, keyinfo->key_length);
if (field->type() == MYSQL_TYPE_BIT) if (field->type() == MYSQL_TYPE_BIT)
key_part->key_part_flag|= HA_BIT_PART; key_part->key_part_flag|= HA_BIT_PART;
......
...@@ -1493,6 +1493,29 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, ...@@ -1493,6 +1493,29 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs,
} }
ulong my_scan_ucs2(CHARSET_INFO *cs __attribute__((unused)),
const char *str, const char *end, int sequence_type)
{
const char *str0= str;
end--; /* for easier loop condition, because of two bytes per character */
switch (sequence_type)
{
case MY_SEQ_SPACES:
for ( ; str < end; str+= 2)
{
if (str[0] != '\0' || str[1] != ' ')
break;
}
return str - str0;
default:
return 0;
}
}
static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler = static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
{ {
NULL, /* init */ NULL, /* init */
...@@ -1549,7 +1572,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler= ...@@ -1549,7 +1572,7 @@ MY_CHARSET_HANDLER my_charset_ucs2_handler=
my_strntoull_ucs2, my_strntoull_ucs2,
my_strntod_ucs2, my_strntod_ucs2,
my_strtoll10_ucs2, my_strtoll10_ucs2,
my_scan_8bit my_scan_ucs2
}; };
......
...@@ -272,6 +272,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port) ...@@ -272,6 +272,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
} }
/*
Get in_addr for a TCP/IP connection
SYNOPSIS
vio_in_addr()
vio vio handle
in put in_addr here
NOTES
one must call vio_peer_addr() before calling this one
*/
void vio_in_addr(Vio *vio, struct in_addr *in) void vio_in_addr(Vio *vio, struct in_addr *in)
{ {
DBUG_ENTER("vio_in_addr"); DBUG_ENTER("vio_in_addr");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment