From: Date: May 22 2008 6:22pm Subject: bk commit into 5.1 tree (frazer:1.2599) BUG#35393 List-Archive: http://lists.mysql.com/commits/46962 X-Bug: 35393 Message-Id: <200805221622.m4MGMqHS017561@forth.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of frazer. When frazer does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-05-22 17:22:34+01:00, frazer@stripped +4 -0 Bug # 35393 Full size of VAR* types is sent in interpreted programs Only send significant bytes of VAR* values. mysql-test/suite/ndb/r/ndb_condition_pushdown.result@stripped, 2008-05-22 17:22:12+01:00, frazer@stripped +9 -0 Add testcase to show max length of VAR* fields not being sent mysql-test/suite/ndb/t/ndb_condition_pushdown.test@stripped, 2008-05-22 17:22:19+01:00, frazer@stripped +10 -0 Add testcase to show max length of VAR* fields not being sent storage/ndb/src/ndbapi/NdbInterpretedCode.cpp@stripped, 2008-05-22 17:22:21+01:00, frazer@stripped +17 -6 For VAR* types with operators other than LIKE and NOTLIKE, use the length information in the value passed. storage/ndb/src/ndbapi/NdbOperationInt.cpp@stripped, 2008-05-22 17:22:23+01:00, frazer@stripped +18 -7 For VAR* types with operators other than LIKE and NOTLIKE, use the length information in the value passed. diff -Nrup a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result --- a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result 2008-03-25 16:48:45 +00:00 +++ b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result 2008-05-22 17:22:12 +01:00 @@ -1953,5 +1953,14 @@ create table t1 (a int primary key, b va insert into t1 values (0, 'I just cant beg you, any-more'); select * from t1 where b="value"; a b +drop table t1; +create table t1 (a int primary key, b varchar(5000) character set latin1) engine=ndb; +insert into t1 values(0, 'Edinburgh'),(1, 'Glasgow'),(2,'Aberdeen'); +select * from t1 where b in ('0', '1', '2','3','4','5','6','7','8','9', +'10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', 'Aberdeen'); +a b +2 Aberdeen +show warnings; +Level Code Message set engine_condition_pushdown = @old_ecpd; DROP TABLE t1,t2,t3,t4,t5; diff -Nrup a/mysql-test/suite/ndb/t/ndb_condition_pushdown.test b/mysql-test/suite/ndb/t/ndb_condition_pushdown.test --- a/mysql-test/suite/ndb/t/ndb_condition_pushdown.test 2008-03-25 16:48:46 +00:00 +++ b/mysql-test/suite/ndb/t/ndb_condition_pushdown.test 2008-05-22 17:22:19 +01:00 @@ -2089,5 +2089,15 @@ create table t1 (a int primary key, b va insert into t1 values (0, 'I just cant beg you, any-more'); select * from t1 where b="value"; +# Bug 35393, Sending irrelevant data for var length comparison +drop table t1; + +create table t1 (a int primary key, b varchar(5000) character set latin1) engine=ndb; +insert into t1 values(0, 'Edinburgh'),(1, 'Glasgow'),(2,'Aberdeen'); +select * from t1 where b in ('0', '1', '2','3','4','5','6','7','8','9', +'10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', 'Aberdeen'); + +show warnings; + set engine_condition_pushdown = @old_ecpd; DROP TABLE t1,t2,t3,t4,t5; diff -Nrup a/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp b/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp --- a/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp 2008-04-07 10:52:16 +01:00 +++ b/storage/ndb/src/ndbapi/NdbInterpretedCode.cpp 2008-05-22 17:22:21 +01:00 @@ -511,14 +511,25 @@ NdbInterpretedCode::branch_col(Uint32 br if (val == NULL) len = 0; else { - if (! col->getStringType()) { - // prevent assert in NdbSqlUtil on length error - Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize; - if (len != 0 && len != sizeInBytes) + if (! col->getStringType()) + { + /* Fixed size type */ + len= col->m_attrSize * col->m_arraySize; + } + else + { + /* For Like and Not like we must use the passed in + * length. Otherwise we use the length encoded + * in the passed string + */ + if ((branch_type != Interpreter::LIKE) && + (branch_type != Interpreter::NOT_LIKE)) { - DBUG_RETURN(error(BadLength)); + if (! col->get_var_length(val, len)) + { + DBUG_RETURN(error(BadLength)); + } } - len = sizeInBytes; } } diff -Nrup a/storage/ndb/src/ndbapi/NdbOperationInt.cpp b/storage/ndb/src/ndbapi/NdbOperationInt.cpp --- a/storage/ndb/src/ndbapi/NdbOperationInt.cpp 2008-04-28 15:17:14 +01:00 +++ b/storage/ndb/src/ndbapi/NdbOperationInt.cpp 2008-05-22 17:22:23 +01:00 @@ -1093,15 +1093,26 @@ NdbOperation::branch_col(Uint32 type, if (val == NULL) len = 0; else { - if (! col->getStringType()) { - // prevent assert in NdbSqlUtil on length error - Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize; - if (len != 0 && len != sizeInBytes) + if (! col->getStringType()) + { + /* Fixed size type */ + len= col->m_attrSize * col->m_arraySize; + } + else + { + /* For Like and Not like we must use the passed in + * length. Otherwise we use the length encoded + * in the passed string + */ + if ((type != Interpreter::LIKE) && + (type != Interpreter::NOT_LIKE)) { - setErrorCodeAbort(4209); - DBUG_RETURN(-1); + if (! col->get_var_length(val, len)) + { + setErrorCodeAbort(4209); + DBUG_RETURN(-1); + } } - len = sizeInBytes; } }