mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
Merge mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new storage/ndb/include/kernel/signaldata/TupFrag.hpp: Auto merged storage/ndb/include/util/NdbSqlUtil.hpp: Auto merged storage/ndb/src/common/util/NdbSqlUtil.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp: Auto merged mysql-test/r/ndb_bitfield.result: Merge, will generate new result file manually storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Merge
This commit is contained in:
commit
ae3e853870
5 changed files with 47 additions and 37 deletions
|
@ -147,7 +147,8 @@ public:
|
|||
enum ErrorCode {
|
||||
NoError = 0,
|
||||
InvalidCharset = 743,
|
||||
TooManyBitsUsed = 831
|
||||
TooManyBitsUsed = 831,
|
||||
UnsupportedType = 906
|
||||
};
|
||||
private:
|
||||
Uint32 userPtr;
|
||||
|
|
|
@ -117,9 +117,9 @@ public:
|
|||
/**
|
||||
* Check character set.
|
||||
*/
|
||||
static bool usable_in_pk(Uint32 typeId, const void* info);
|
||||
static bool usable_in_hash_index(Uint32 typeId, const void* info);
|
||||
static bool usable_in_ordered_index(Uint32 typeId, const void* info);
|
||||
static uint check_column_for_pk(Uint32 typeId, const void* info);
|
||||
static uint check_column_for_hash_index(Uint32 typeId, const void* info);
|
||||
static uint check_column_for_ordered_index(Uint32 typeId, const void* info);
|
||||
|
||||
/**
|
||||
* Get number of length bytes and length from variable length string.
|
||||
|
|
|
@ -872,8 +872,8 @@ NdbSqlUtil::likeLongvarbinary(const void* info, const void* p1, unsigned n1, con
|
|||
|
||||
// check charset
|
||||
|
||||
bool
|
||||
NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
|
||||
uint
|
||||
NdbSqlUtil::check_column_for_pk(Uint32 typeId, const void* info)
|
||||
{
|
||||
const Type& type = getType(typeId);
|
||||
switch (type.m_typeId) {
|
||||
|
@ -882,12 +882,14 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
|
|||
case Type::Longvarchar:
|
||||
{
|
||||
const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
|
||||
return
|
||||
cs != 0 &&
|
||||
cs->cset != 0 &&
|
||||
cs->coll != 0 &&
|
||||
cs->coll->strnxfrm != 0 &&
|
||||
cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY;
|
||||
if(cs != 0 &&
|
||||
cs->cset != 0 &&
|
||||
cs->coll != 0 &&
|
||||
cs->coll->strnxfrm != 0 &&
|
||||
cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY)
|
||||
return 0;
|
||||
else
|
||||
return 743;
|
||||
}
|
||||
break;
|
||||
case Type::Undefined:
|
||||
|
@ -896,19 +898,19 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
|
|||
case Type::Bit:
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
return false;
|
||||
return 906;
|
||||
}
|
||||
|
||||
bool
|
||||
NdbSqlUtil::usable_in_hash_index(Uint32 typeId, const void* info)
|
||||
uint
|
||||
NdbSqlUtil::check_column_for_hash_index(Uint32 typeId, const void* info)
|
||||
{
|
||||
return usable_in_pk(typeId, info);
|
||||
return check_column_for_pk(typeId, info);
|
||||
}
|
||||
|
||||
bool
|
||||
NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
|
||||
uint
|
||||
NdbSqlUtil::check_column_for_ordered_index(Uint32 typeId, const void* info)
|
||||
{
|
||||
const Type& type = getType(typeId);
|
||||
if (type.m_cmp == NULL)
|
||||
|
@ -919,13 +921,15 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
|
|||
case Type::Longvarchar:
|
||||
{
|
||||
const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
|
||||
return
|
||||
cs != 0 &&
|
||||
cs->cset != 0 &&
|
||||
cs->coll != 0 &&
|
||||
cs->coll->strnxfrm != 0 &&
|
||||
cs->coll->strnncollsp != 0 &&
|
||||
cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY;
|
||||
if (cs != 0 &&
|
||||
cs->cset != 0 &&
|
||||
cs->coll != 0 &&
|
||||
cs->coll->strnxfrm != 0 &&
|
||||
cs->coll->strnncollsp != 0 &&
|
||||
cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY)
|
||||
return 0;
|
||||
else
|
||||
return 743;
|
||||
}
|
||||
break;
|
||||
case Type::Undefined:
|
||||
|
@ -934,9 +938,9 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
|
|||
case Type::Bit: // can be fixed
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
return false;
|
||||
return 906;
|
||||
}
|
||||
|
||||
// utilities
|
||||
|
|
|
@ -215,11 +215,12 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal)
|
|||
break;
|
||||
}
|
||||
if (descAttr.m_charset != 0) {
|
||||
uint err;
|
||||
CHARSET_INFO *cs = all_charsets[descAttr.m_charset];
|
||||
ndbrequire(cs != 0);
|
||||
if (! NdbSqlUtil::usable_in_ordered_index(descAttr.m_typeId, cs)) {
|
||||
if ((err = NdbSqlUtil::check_column_for_ordered_index(descAttr.m_typeId, cs))) {
|
||||
jam();
|
||||
errorCode = TuxAddAttrRef::InvalidCharset;
|
||||
errorCode = (TuxAddAttrRef::ErrorCode) err;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2292,7 +2292,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
|
|||
NdbTableImpl & impl,
|
||||
bool alter)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned i, err;
|
||||
char *ts_names[MAX_NDB_PARTITIONS];
|
||||
DBUG_ENTER("NdbDictInterface::createOrAlterTable");
|
||||
|
||||
|
@ -2593,8 +2593,10 @@ loop:
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
// primary key type check
|
||||
if (col->m_pk && ! NdbSqlUtil::usable_in_pk(col->m_type, col->m_cs)) {
|
||||
m_error.code= (col->m_cs != 0 ? 743 : 739);
|
||||
if (col->m_pk &&
|
||||
(err = NdbSqlUtil::check_column_for_pk(col->m_type, col->m_cs)))
|
||||
{
|
||||
m_error.code= err;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
// distribution key not supported for Char attribute
|
||||
|
@ -3025,7 +3027,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
|
|||
{
|
||||
//validate();
|
||||
//aggregate();
|
||||
unsigned i;
|
||||
unsigned i, err;
|
||||
UtilBufferWriter w(m_buffer);
|
||||
const size_t len = strlen(impl.m_externalName.c_str()) + 1;
|
||||
if(len > MAX_TAB_NAME_SIZE) {
|
||||
|
@ -3074,10 +3076,12 @@ NdbDictInterface::createIndex(Ndb & ndb,
|
|||
|
||||
// index key type check
|
||||
if (it == DictTabInfo::UniqueHashIndex &&
|
||||
! NdbSqlUtil::usable_in_hash_index(col->m_type, col->m_cs) ||
|
||||
(err = NdbSqlUtil::check_column_for_hash_index(col->m_type, col->m_cs))
|
||||
||
|
||||
it == DictTabInfo::OrderedIndex &&
|
||||
! NdbSqlUtil::usable_in_ordered_index(col->m_type, col->m_cs)) {
|
||||
m_error.code = 743;
|
||||
(err = NdbSqlUtil::check_column_for_ordered_index(col->m_type, col->m_cs)))
|
||||
{
|
||||
m_error.code = err;
|
||||
return -1;
|
||||
}
|
||||
// API uses external column number to talk to DICT
|
||||
|
|
Loading…
Reference in a new issue