Commit 6e3263b8 authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new


storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
parents c1b3f8db dc3e7bdc
...@@ -201,21 +201,21 @@ create table t1 ( ...@@ -201,21 +201,21 @@ create table t1 (
pk1 bit(9) not null primary key, pk1 bit(9) not null primary key,
b int b int
) engine=ndbcluster; ) engine=ndbcluster;
ERROR HY000: Can't create table 'test.t1' (errno: 140) ERROR HY000: Can't create table 'test.t1' (errno: 906)
show warnings; show warnings;
Level Code Message Level Code Message
Error 1296 Got error 739 'Unsupported primary key length' from NDB Error 1296 Got error 906 'Unsupported attribute type in index' from NDB
Error 1005 Can't create table 'test.t1' (errno: 140) Error 1005 Can't create table 'test.t1' (errno: 906)
create table t1 ( create table t1 (
pk1 int not null primary key, pk1 int not null primary key,
b bit(9), b bit(9),
key(b) key(b)
) engine=ndbcluster; ) engine=ndbcluster;
ERROR HY000: Can't create table 'test.t1' (errno: 140) ERROR HY000: Can't create table 'test.t1' (errno: 906)
show warnings; show warnings;
Level Code Message Level Code Message
Error 1296 Got error 743 'Unsupported character set in table or index' from NDB Error 1296 Got error 906 'Unsupported attribute type in index' from NDB
Error 1005 Can't create table 'test.t1' (errno: 140) Error 1005 Can't create table 'test.t1' (errno: 906)
create table t1 ( create table t1 (
pk1 int primary key, pk1 int primary key,
b bit(32) not null b bit(32) not null
......
...@@ -96,7 +96,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -96,7 +96,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
bzero((byte*) &info,sizeof(info)); bzero((byte*) &info,sizeof(info));
my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT, my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,
MY_UNPACK_FILENAME|MY_APPEND_EXT),MYF(0)); MY_UNPACK_FILENAME),MYF(0));
pthread_mutex_lock(&THR_LOCK_myisam); pthread_mutex_lock(&THR_LOCK_myisam);
if (!(old_info=test_if_reopen(name_buff))) if (!(old_info=test_if_reopen(name_buff)))
{ {
......
...@@ -147,7 +147,8 @@ public: ...@@ -147,7 +147,8 @@ public:
enum ErrorCode { enum ErrorCode {
NoError = 0, NoError = 0,
InvalidCharset = 743, InvalidCharset = 743,
TooManyBitsUsed = 831 TooManyBitsUsed = 831,
UnsupportedType = 906
}; };
private: private:
Uint32 userPtr; Uint32 userPtr;
......
...@@ -117,9 +117,9 @@ public: ...@@ -117,9 +117,9 @@ public:
/** /**
* Check character set. * Check character set.
*/ */
static bool usable_in_pk(Uint32 typeId, const void* info); static uint check_column_for_pk(Uint32 typeId, const void* info);
static bool usable_in_hash_index(Uint32 typeId, const void* info); static uint check_column_for_hash_index(Uint32 typeId, const void* info);
static bool usable_in_ordered_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. * 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 ...@@ -872,8 +872,8 @@ NdbSqlUtil::likeLongvarbinary(const void* info, const void* p1, unsigned n1, con
// check charset // check charset
bool uint
NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info) NdbSqlUtil::check_column_for_pk(Uint32 typeId, const void* info)
{ {
const Type& type = getType(typeId); const Type& type = getType(typeId);
switch (type.m_typeId) { switch (type.m_typeId) {
...@@ -882,12 +882,14 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info) ...@@ -882,12 +882,14 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
case Type::Longvarchar: case Type::Longvarchar:
{ {
const CHARSET_INFO *cs = (const CHARSET_INFO*)info; const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
return if(cs != 0 &&
cs != 0 &&
cs->cset != 0 && cs->cset != 0 &&
cs->coll != 0 && cs->coll != 0 &&
cs->coll->strnxfrm != 0 && cs->coll->strnxfrm != 0 &&
cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY; cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY)
return 0;
else
return 743;
} }
break; break;
case Type::Undefined: case Type::Undefined:
...@@ -896,19 +898,19 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info) ...@@ -896,19 +898,19 @@ NdbSqlUtil::usable_in_pk(Uint32 typeId, const void* info)
case Type::Bit: case Type::Bit:
break; break;
default: default:
return true; return 0;
} }
return false; return 906;
} }
bool uint
NdbSqlUtil::usable_in_hash_index(Uint32 typeId, const void* info) 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 uint
NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info) NdbSqlUtil::check_column_for_ordered_index(Uint32 typeId, const void* info)
{ {
const Type& type = getType(typeId); const Type& type = getType(typeId);
if (type.m_cmp == NULL) if (type.m_cmp == NULL)
...@@ -919,13 +921,15 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info) ...@@ -919,13 +921,15 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
case Type::Longvarchar: case Type::Longvarchar:
{ {
const CHARSET_INFO *cs = (const CHARSET_INFO*)info; const CHARSET_INFO *cs = (const CHARSET_INFO*)info;
return if (cs != 0 &&
cs != 0 &&
cs->cset != 0 && cs->cset != 0 &&
cs->coll != 0 && cs->coll != 0 &&
cs->coll->strnxfrm != 0 && cs->coll->strnxfrm != 0 &&
cs->coll->strnncollsp != 0 && cs->coll->strnncollsp != 0 &&
cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY; cs->strxfrm_multiply <= MAX_XFRM_MULTIPLY)
return 0;
else
return 743;
} }
break; break;
case Type::Undefined: case Type::Undefined:
...@@ -934,9 +938,9 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info) ...@@ -934,9 +938,9 @@ NdbSqlUtil::usable_in_ordered_index(Uint32 typeId, const void* info)
case Type::Bit: // can be fixed case Type::Bit: // can be fixed
break; break;
default: default:
return true; return 0;
} }
return false; return 906;
} }
// utilities // utilities
......
...@@ -215,11 +215,12 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal) ...@@ -215,11 +215,12 @@ Dbtux::execTUX_ADD_ATTRREQ(Signal* signal)
break; break;
} }
if (descAttr.m_charset != 0) { if (descAttr.m_charset != 0) {
uint err;
CHARSET_INFO *cs = all_charsets[descAttr.m_charset]; CHARSET_INFO *cs = all_charsets[descAttr.m_charset];
ndbrequire(cs != 0); 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(); jam();
errorCode = TuxAddAttrRef::InvalidCharset; errorCode = (TuxAddAttrRef::ErrorCode) err;
break; break;
} }
} }
......
...@@ -2301,7 +2301,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2301,7 +2301,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
NdbTableImpl & impl, NdbTableImpl & impl,
bool alter) bool alter)
{ {
unsigned i; unsigned i, err;
char *ts_names[MAX_NDB_PARTITIONS]; char *ts_names[MAX_NDB_PARTITIONS];
DBUG_ENTER("NdbDictInterface::createOrAlterTable"); DBUG_ENTER("NdbDictInterface::createOrAlterTable");
...@@ -2602,8 +2602,10 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb, ...@@ -2602,8 +2602,10 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
// primary key type check // primary key type check
if (col->m_pk && ! NdbSqlUtil::usable_in_pk(col->m_type, col->m_cs)) { if (col->m_pk &&
m_error.code= (col->m_cs != 0 ? 743 : 739); (err = NdbSqlUtil::check_column_for_pk(col->m_type, col->m_cs)))
{
m_error.code= err;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
// distribution key not supported for Char attribute // distribution key not supported for Char attribute
...@@ -3034,7 +3036,7 @@ NdbDictInterface::createIndex(Ndb & ndb, ...@@ -3034,7 +3036,7 @@ NdbDictInterface::createIndex(Ndb & ndb,
{ {
//validate(); //validate();
//aggregate(); //aggregate();
unsigned i; unsigned i, err;
UtilBufferWriter w(m_buffer); UtilBufferWriter w(m_buffer);
const size_t len = strlen(impl.m_externalName.c_str()) + 1; const size_t len = strlen(impl.m_externalName.c_str()) + 1;
if(len > MAX_TAB_NAME_SIZE) { if(len > MAX_TAB_NAME_SIZE) {
...@@ -3083,10 +3085,12 @@ NdbDictInterface::createIndex(Ndb & ndb, ...@@ -3083,10 +3085,12 @@ NdbDictInterface::createIndex(Ndb & ndb,
// index key type check // index key type check
if (it == DictTabInfo::UniqueHashIndex && 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 && it == DictTabInfo::OrderedIndex &&
! NdbSqlUtil::usable_in_ordered_index(col->m_type, col->m_cs)) { (err = NdbSqlUtil::check_column_for_ordered_index(col->m_type, col->m_cs)))
m_error.code = 743; {
m_error.code = err;
return -1; return -1;
} }
// API uses external column number to talk to DICT // API uses external column number to talk to DICT
......
AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include \
AM_CPPFLAGS += -I$(top_srcdir)/unittest/mytap -I$(top_srcdir)/unittest/mytap -I$(top_srcdir)/include
AM_LDFLAGS = -L$(top_builddir)/unittest/mytap AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
......
AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include -I$(srcdir)/.. -I$(top_srcdir)/include
AM_CPPFLAGS += -I$(srcdir)/..
AM_LDFLAGS = -L$(top_builddir)/unittest/mytap AM_LDFLAGS = -L$(top_builddir)/unittest/mytap
......
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