Commit c0a46fc4 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0-ndb
parents 9ab13311 c9502b55
......@@ -47,7 +47,7 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
uint key_length, hash_get_key get_key,
void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
void hash_free(HASH *tree);
void hash_reset(HASH *hash);
void my_hash_reset(HASH *hash);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length);
gptr hash_next(HASH *info,const byte *key,uint length);
......
......@@ -1300,7 +1300,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Warning 1265 Data truncated for column 'v' at row 1
Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+ *+*+ *
......@@ -1346,7 +1346,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
Warning 1265 Data truncated for column 't' at row 2
Note 1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
......@@ -255,7 +255,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Warning 1265 Data truncated for column 'v' at row 1
Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+ *+*+ *
......
......@@ -571,7 +571,7 @@ insert into t1 values('+ ', '+ ', '+ ');
set @a=repeat(' ',20);
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
Warnings:
Warning 1265 Data truncated for column 'v' at row 1
Note 1265 Data truncated for column 'v' at row 1
select concat('*',v,'*',c,'*',t,'*') from t1;
concat('*',v,'*',c,'*',t,'*')
*+ *+*+ *
......@@ -617,7 +617,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 modify t varchar(10);
Warnings:
Warning 1265 Data truncated for column 't' at row 2
Note 1265 Data truncated for column 't' at row 2
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......
......@@ -529,3 +529,19 @@ count(*)-8
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9
0
drop table t1;
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
set autocommit=0;
begin;
select count(*) from t1;
count(*)
2
ALTER TABLE t1 ADD COLUMN c int;
select a from t1 where b = 2;
a
2
show tables;
Tables_in_test
t1
drop table t1;
......@@ -70,7 +70,7 @@ def test t9 t9 c18 c18 1 4 1 Y 32768 0 63
def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 254 10 10 Y 0 0 8
def test t9 t9 c22 c22 254 30 30 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
def test t9 t9 c23 c23 252 255 8 Y 144 0 63
def test t9 t9 c24 c24 252 255 8 Y 16 0 8
def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
......@@ -1691,8 +1691,8 @@ affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
3 duplicate
4 duplicate
103 three
delete from t2 ;
prepare stmt1 from ' insert into t2 (b,a)
......@@ -1710,8 +1710,8 @@ affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
select a,b from t2 order by a ;
a b
3 duplicate
4 duplicate
3 duplicate
4 duplicate
103 three
drop table t2;
drop table if exists t5 ;
......@@ -1926,7 +1926,7 @@ def @arg28 253 8192 10 Y 0 31 8
def @arg29 253 8192 8 Y 128 31 63
def @arg30 253 8192 8 Y 0 31 8
def @arg31 253 8192 3 Y 0 31 8
def @arg32 253 8192 6 Y 128 31 63
def @arg32 253 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
......@@ -2023,7 +2023,7 @@ def @arg28 253 8192 10 Y 0 31 8
def @arg29 253 8192 8 Y 128 31 63
def @arg30 253 8192 8 Y 0 31 8
def @arg31 253 8192 3 Y 0 31 8
def @arg32 253 8192 6 Y 128 31 63
def @arg32 253 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
......@@ -2111,7 +2111,7 @@ def @arg28 253 8192 10 Y 0 31 8
def @arg29 253 8192 8 Y 128 31 63
def @arg30 253 8192 8 Y 0 31 8
def @arg31 253 8192 3 Y 0 31 8
def @arg32 253 8192 6 Y 128 31 63
def @arg32 253 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
......@@ -2201,7 +2201,7 @@ def @arg28 253 8192 10 Y 0 31 8
def @arg29 253 8192 8 Y 128 31 63
def @arg30 253 8192 8 Y 0 31 8
def @arg31 253 8192 3 Y 0 31 8
def @arg32 253 8192 6 Y 128 31 63
def @arg32 253 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
......
......@@ -818,7 +818,6 @@ ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('hellobob');
ERROR 01000: Data truncated for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES ('hello ');
ERROR 01000: Data truncated for column 'col2' at row 1
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
ERROR 01000: Data truncated for column 'col1' at row 2
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
......@@ -835,6 +834,7 @@ col1 col2
hello hello
he hellot
hello hello
NULL hello
hello hellob
DROP TABLE t1;
CREATE TABLE t1 (col1 enum('red','blue','green'));
......
......@@ -267,3 +267,21 @@ select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
drop table t1;
# bug#7798
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
connect (con1,localhost,,,test);
connect (con2,localhost,,,test);
connection con1;
set autocommit=0;
begin;
select count(*) from t1;
connection con2;
ALTER TABLE t1 ADD COLUMN c int;
connection con1;
select a from t1 where b = 2;
show tables;
drop table t1;
......@@ -122,13 +122,13 @@ void hash_free(HASH *hash)
Delete all elements from the hash (the hash itself is to be reused).
SYNOPSIS
hash_reset()
my_hash_reset()
hash the hash to delete elements of
*/
void hash_reset(HASH *hash)
void my_hash_reset(HASH *hash)
{
DBUG_ENTER("hash_reset");
DBUG_ENTER("my_hash_reset");
DBUG_PRINT("enter",("hash: 0x%lxd",hash));
hash_free_elements(hash);
......
......@@ -1419,6 +1419,6 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){
Transporter*
TransporterRegistry::get_transporter(NodeId nodeId) {
return theTransporters[nodeId];
};
}
template class Vector<TransporterRegistry::Transporter_interface>;
......@@ -1920,7 +1920,6 @@ void Dbtc::packKeyData000Lab(Signal* signal,
Uint32 totalLen)
{
CacheRecord * const regCachePtr = cachePtr.p;
UintR Tmp;
jam();
Uint32 len = 0;
......@@ -8646,14 +8645,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
apiConnectptr.i = scanTabReq->apiConnectPtr;
tabptr.i = scanTabReq->tableId;
if (apiConnectptr.i >= capiConnectFilesize ||
tabptr.i >= ctabrecFilesize) {
if (apiConnectptr.i >= capiConnectFilesize)
{
jam();
warningHandlerLab(signal);
return;
}//if
ptrAss(apiConnectptr, apiConnectRecord);
ApiConnectRecord * transP = apiConnectptr.p;
if (transP->apiConnectstate != CS_CONNECTED) {
jam();
// could be left over from TCKEYREQ rollback
......@@ -8667,9 +8668,16 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
} else {
jam();
errCode = ZSTATE_ERROR;
goto SCAN_TAB_error;
goto SCAN_TAB_error_no_state_change;
}
}
if(tabptr.i >= ctabrecFilesize)
{
errCode = ZUNKNOWN_TABLE_ERROR;
goto SCAN_TAB_error;
}
ptrAss(tabptr, tableRecord);
if ((aiLength == 0) ||
(!tabptr.p->checkTable(schemaVersion)) ||
......@@ -8766,8 +8774,18 @@ void Dbtc::execSCAN_TABREQ(Signal* signal)
errCode = ZNO_SCANREC_ERROR;
goto SCAN_TAB_error;
SCAN_TAB_error:
SCAN_TAB_error:
jam();
/**
* Prepare for up coming ATTRINFO/KEYINFO
*/
transP->apiConnectstate = CS_ABORTING;
transP->abortState = AS_IDLE;
transP->transid[0] = transid1;
transP->transid[1] = transid2;
SCAN_TAB_error_no_state_change:
ScanTabRef * ref = (ScanTabRef*)&signal->theData[0];
ref->apiConnectPtr = transP->ndbapiConnect;
ref->transId1 = transid1;
......
......@@ -4672,6 +4672,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
uint32 not_used, copy_length;
char buff[80];
String tmpstr(buff,sizeof(buff), &my_charset_bin);
enum MYSQL_ERROR::enum_warning_level level= MYSQL_ERROR::WARN_LEVEL_WARN;
/* Convert character set if nesessary */
if (String::needs_conversion(length, cs, field_charset, &not_used))
......@@ -4696,11 +4697,24 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
*ptr= (uchar) copy_length;
else
int2store(ptr, copy_length);
if (copy_length < length)
// Check if we lost something other than just trailing spaces
if ((copy_length < length) && table->in_use->count_cuted_fields)
{
const char *end= from + length;
from+= copy_length;
from+= field_charset->cset->scan(field_charset, from, end, MY_SEQ_SPACES);
/*
If we lost only spaces then produce a NOTE, not a WARNING.
But if we have already had errors (e.g with charset conversion),
then don't reset level to NOTE.
*/
if (from == end && !error)
level= MYSQL_ERROR::WARN_LEVEL_NOTE;
error= 1;
}
if (error)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
set_warning(level, ER_WARN_DATA_TRUNCATED, 1);
return error;
}
......
This diff is collapsed.
......@@ -255,7 +255,7 @@ my_bool
my_net_write(NET *net,const char *packet,ulong len)
{
uchar buff[NET_HEADER_SIZE];
if (unlikely(!net->vio)) // nowhere to write
if (unlikely(!net->vio)) /* nowhere to write */
return 0;
/*
Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH
......
......@@ -742,8 +742,8 @@ class Statement_map
/* Erase all statements (calls Statement destructor) */
void reset()
{
hash_reset(&names_hash);
hash_reset(&st_hash);
my_hash_reset(&names_hash);
my_hash_reset(&st_hash);
last_found_statement= 0;
}
......
......@@ -292,7 +292,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
error=0;
id=0;
thd->proc_info="update";
if (duplic != DUP_ERROR)
if (duplic != DUP_ERROR || ignore)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
/*
let's *try* to start bulk inserts. It won't necessary
......@@ -471,7 +471,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
table->next_number_field=0;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
thd->next_insert_id=0; // Reset this if wrongly used
if (duplic != DUP_ERROR)
if (duplic != DUP_ERROR || ignore)
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
/* Reset value of LAST_INSERT_ID if no rows where inserted */
......@@ -1606,7 +1606,7 @@ bool delayed_insert::handle_inserts(void)
info.ignore= row->ignore;
info.handle_duplicates= row->dup;
if (info.ignore ||
info.handle_duplicates == DUP_REPLACE)
info.handle_duplicates != DUP_ERROR)
{
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
using_ignore=1;
......@@ -1806,7 +1806,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
thd->cuted_fields=0;
if (info.ignore || info.handle_duplicates == DUP_REPLACE)
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
thd->no_trans_update= 0;
......@@ -2008,7 +2008,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
restore_record(table,s->default_values); // Get empty record
thd->cuted_fields=0;
if (info.ignore || info.handle_duplicates == DUP_REPLACE)
if (info.ignore || info.handle_duplicates != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
thd->no_trans_update= 0;
......
......@@ -172,7 +172,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->proc_list.first= 0;
if (lex->spfuns.records)
hash_reset(&lex->spfuns);
my_hash_reset(&lex->spfuns);
}
void lex_end(LEX *lex)
......
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