Commit 2c12921a authored by unknown's avatar unknown

Merge


client/mysql.cc:
  Auto merged
mysql-test/r/ndb_index_ordered.result:
  Auto merged
mysql-test/t/ndb_index_ordered.test:
  Auto merged
ndb/src/ndbapi/NdbDictionary.cpp:
  Auto merged
ndb/include/kernel/signaldata/DictTabInfo.hpp:
  merge
ndb/include/ndbapi/NdbDictionary.hpp:
  merge
ndb/include/util/NdbSqlUtil.hpp:
  merge
ndb/src/common/util/NdbSqlUtil.cpp:
  merge
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  merge
sql/ha_ndbcluster.cc:
  merge
parents 5802259d 94504d52
...@@ -79,7 +79,8 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength, ...@@ -79,7 +79,8 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength,
if (!memcmp(p->arKey, arKey, nKeyLength)) { if (!memcmp(p->arKey, arKey, nKeyLength)) {
entry *n; entry *n;
n = (entry *) alloc_root(&ht->mem_root,sizeof(entry)); if (!(n = (entry *) alloc_root(&ht->mem_root,sizeof(entry))))
return FAILURE;
n->pNext = p->pData; n->pNext = p->pData;
n->str = str; n->str = str;
p->pData = n; p->pData = n;
......
...@@ -1502,7 +1502,10 @@ You can turn off this feature to get a quicker startup with -A\n\n"); ...@@ -1502,7 +1502,10 @@ You can turn off this feature to get a quicker startup with -A\n\n");
if (!(field_names[i] = (char **) alloc_root(&hash_mem_root, if (!(field_names[i] = (char **) alloc_root(&hash_mem_root,
sizeof(char *) * sizeof(char *) *
(num_fields*2+1)))) (num_fields*2+1))))
break; {
mysql_free_result(fields);
break;
}
field_names[i][num_fields*2]= '\0'; field_names[i][num_fields*2]= '\0';
j=0; j=0;
while ((sql_field=mysql_fetch_field(fields))) while ((sql_field=mysql_fetch_field(fields)))
...@@ -2077,10 +2080,10 @@ print_table_data_html(MYSQL_RES *result) ...@@ -2077,10 +2080,10 @@ print_table_data_html(MYSQL_RES *result)
} }
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))
{ {
ulong *lengths=mysql_fetch_lengths(result);
(void) tee_fputs("<TR>", PAGER); (void) tee_fputs("<TR>", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
{ {
ulong *lengths=mysql_fetch_lengths(result);
(void) tee_fputs("<TD>", PAGER); (void) tee_fputs("<TD>", PAGER);
safe_put_field(cur[i],lengths[i]); safe_put_field(cur[i],lengths[i]);
(void) tee_fputs("</TD>", PAGER); (void) tee_fputs("</TD>", PAGER);
...@@ -2106,10 +2109,10 @@ print_table_data_xml(MYSQL_RES *result) ...@@ -2106,10 +2109,10 @@ print_table_data_xml(MYSQL_RES *result)
fields = mysql_fetch_fields(result); fields = mysql_fetch_fields(result);
while ((cur = mysql_fetch_row(result))) while ((cur = mysql_fetch_row(result)))
{ {
ulong *lengths=mysql_fetch_lengths(result);
(void) tee_fputs("\n <row>\n", PAGER); (void) tee_fputs("\n <row>\n", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
{ {
ulong *lengths=mysql_fetch_lengths(result);
tee_fprintf(PAGER, "\t<%s>", (fields[i].name ? tee_fprintf(PAGER, "\t<%s>", (fields[i].name ?
(fields[i].name[0] ? fields[i].name : (fields[i].name[0] ? fields[i].name :
" &nbsp; ") : "NULL")); " &nbsp; ") : "NULL"));
......
...@@ -145,7 +145,7 @@ case $FLAG in ...@@ -145,7 +145,7 @@ case $FLAG in
# #
-fh) -fh)
cat $FILES | $AWK '/el_action_t/ { print $3 }' | \ cat $FILES | $AWK '/el_action_t/ { print $3 }' | \
sort | tr '[a-z]' '[A-Z]' | $AWK ' sort | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | $AWK '
BEGIN { BEGIN {
printf("/* Automatically generated file, do not edit */\n"); printf("/* Automatically generated file, do not edit */\n");
printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n"); printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");
......
...@@ -87,7 +87,8 @@ parse_line(EditLine *el, const char *line) ...@@ -87,7 +87,8 @@ parse_line(EditLine *el, const char *line)
int argc; int argc;
Tokenizer *tok; Tokenizer *tok;
tok = tok_init(NULL); if (!(tok = tok_init(NULL)))
return -1;
tok_line(tok, line, &argc, &argv); tok_line(tok, line, &argc, &argv);
argc = el_parse(el, argc, argv); argc = el_parse(el, argc, argv);
tok_end(tok); tok_end(tok);
......
...@@ -419,3 +419,113 @@ SubscrID SbclID ...@@ -419,3 +419,113 @@ SubscrID SbclID
3 NULL 3 NULL
drop table test1; drop table test1;
drop table test2; drop table test2;
create table t1 (
pk int primary key,
dt datetime not null,
da date not null,
ye year not null,
ti time not null,
ts timestamp not null,
index(dt),
index(da),
index(ye),
index(ti),
index(ts)
) engine=ndb;
insert into t1 (pk,dt,da,ye,ti) values
(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
count(*)-9
0
select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
count(*)-6
0
select count(*)-5 from t1 use index (dt) where dt > '1955-12-31 00:00:00';
count(*)-5
0
select count(*)-5 from t1 use index (dt) where dt < '1970-03-03 22:22:22';
count(*)-5
0
select count(*)-7 from t1 use index (dt) where dt < '2001-01-01 10:11:11';
count(*)-7
0
select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
count(*)-8
0
select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';
count(*)-9
0
select count(*)-9 from t1 use index (da) where da > '1900-01-01';
count(*)-9
0
select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
count(*)-6
0
select count(*)-5 from t1 use index (da) where da > '1955-12-31';
count(*)-5
0
select count(*)-5 from t1 use index (da) where da < '1970-03-03';
count(*)-5
0
select count(*)-6 from t1 use index (da) where da < '2001-01-01';
count(*)-6
0
select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
count(*)-8
0
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
count(*)-9
0
select count(*)-9 from t1 use index (ye) where ye > '1900';
count(*)-9
0
select count(*)-6 from t1 use index (ye) where ye >= '1955';
count(*)-6
0
select count(*)-5 from t1 use index (ye) where ye > '1955';
count(*)-5
0
select count(*)-5 from t1 use index (ye) where ye < '1970';
count(*)-5
0
select count(*)-6 from t1 use index (ye) where ye < '2001';
count(*)-6
0
select count(*)-8 from t1 use index (ye) where ye <= '2001';
count(*)-8
0
select count(*)-9 from t1 use index (ye) where ye <= '2055';
count(*)-9
0
select count(*)-9 from t1 use index (ti) where ti >= '00:00:00';
count(*)-9
0
select count(*)-7 from t1 use index (ti) where ti > '00:00:00';
count(*)-7
0
select count(*)-7 from t1 use index (ti) where ti > '05:05:05';
count(*)-7
0
select count(*)-5 from t1 use index (ti) where ti > '06:06:06';
count(*)-5
0
select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
count(*)-5
0
select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
count(*)-6
0
select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
count(*)-8
0
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9
0
...@@ -203,3 +203,67 @@ SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON ...@@ -203,3 +203,67 @@ SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2; l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
drop table test1; drop table test1;
drop table test2; drop table test2;
# bug#7424 + bug#7725
create table t1 (
pk int primary key,
dt datetime not null,
da date not null,
ye year not null,
ti time not null,
ts timestamp not null,
index(dt),
index(da),
index(ye),
index(ti),
index(ts)
) engine=ndb;
insert into t1 (pk,dt,da,ye,ti) values
(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59'),
(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59'),
(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00'),
(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00'),
(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06'),
(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06'),
(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10'),
(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11'),
(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59');
# datetime
select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
select count(*)-5 from t1 use index (dt) where dt > '1955-12-31 00:00:00';
select count(*)-5 from t1 use index (dt) where dt < '1970-03-03 22:22:22';
select count(*)-7 from t1 use index (dt) where dt < '2001-01-01 10:11:11';
select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';
# date
select count(*)-9 from t1 use index (da) where da > '1900-01-01';
select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
select count(*)-5 from t1 use index (da) where da > '1955-12-31';
select count(*)-5 from t1 use index (da) where da < '1970-03-03';
select count(*)-6 from t1 use index (da) where da < '2001-01-01';
select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
# year
select count(*)-9 from t1 use index (ye) where ye > '1900';
select count(*)-6 from t1 use index (ye) where ye >= '1955';
select count(*)-5 from t1 use index (ye) where ye > '1955';
select count(*)-5 from t1 use index (ye) where ye < '1970';
select count(*)-6 from t1 use index (ye) where ye < '2001';
select count(*)-8 from t1 use index (ye) where ye <= '2001';
select count(*)-9 from t1 use index (ye) where ye <= '2055';
# time
select count(*)-9 from t1 use index (ti) where ti >= '00:00:00';
select count(*)-7 from t1 use index (ti) where ti > '00:00:00';
select count(*)-7 from t1 use index (ti) where ti > '05:05:05';
select count(*)-5 from t1 use index (ti) where ti > '06:06:06';
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';
...@@ -266,10 +266,11 @@ public: ...@@ -266,10 +266,11 @@ public:
ExtBinary = NdbSqlUtil::Type::Binary, ExtBinary = NdbSqlUtil::Type::Binary,
ExtVarbinary = NdbSqlUtil::Type::Varbinary, ExtVarbinary = NdbSqlUtil::Type::Varbinary,
ExtDatetime = NdbSqlUtil::Type::Datetime, ExtDatetime = NdbSqlUtil::Type::Datetime,
ExtTimespec = NdbSqlUtil::Type::Timespec, ExtDate = NdbSqlUtil::Type::Date,
ExtBlob = NdbSqlUtil::Type::Blob, ExtBlob = NdbSqlUtil::Type::Blob,
ExtText = NdbSqlUtil::Type::Text, ExtText = NdbSqlUtil::Type::Text,
ExtBit = NdbSqlUtil::Type::Bit ExtBit = NdbSqlUtil::Type::Bit,
ExtTime = NdbSqlUtil::Type::Time
}; };
// Attribute data interpretation // Attribute data interpretation
...@@ -371,10 +372,10 @@ public: ...@@ -371,10 +372,10 @@ public:
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 8 * AttributeExtLength; AttributeArraySize = 8 * AttributeExtLength;
return true; return true;
case DictTabInfo::ExtTimespec: case DictTabInfo::ExtDate:
// to fix // to fix
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 12 * AttributeExtLength; AttributeArraySize = 3 * AttributeExtLength;
return true; return true;
case DictTabInfo::ExtBlob: case DictTabInfo::ExtBlob:
case DictTabInfo::ExtText: case DictTabInfo::ExtText:
...@@ -382,6 +383,11 @@ public: ...@@ -382,6 +383,11 @@ public:
// head + inline part [ attr precision lower half ] // head + inline part [ attr precision lower half ]
AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
return true; return true;
case DictTabInfo::ExtTime:
AttributeType = DictTabInfo::StringType;
AttributeSize = DictTabInfo::an8Bit;
AttributeArraySize = 3 * AttributeExtLength;
return true;
case DictTabInfo::ExtBit: case DictTabInfo::ExtBit:
AttributeSize = DictTabInfo::aBit; AttributeSize = DictTabInfo::aBit;
AttributeArraySize = AttributeExtLength; AttributeArraySize = AttributeExtLength;
......
...@@ -183,10 +183,11 @@ public: ...@@ -183,10 +183,11 @@ public:
Binary = NDB_TYPE_BINARY, ///< Len Binary = NDB_TYPE_BINARY, ///< Len
Varbinary = NDB_TYPE_VARBINARY, ///< Max len Varbinary = NDB_TYPE_VARBINARY, ///< Max len
Datetime = NDB_TYPE_DATETIME, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes ) Datetime = NDB_TYPE_DATETIME, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes )
Timespec = NDB_TYPE_TIMESPEC, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes ) Date = NDB_TYPE_DATE, ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
Blob = NDB_TYPE_BLOB, ///< Binary large object (see NdbBlob) Blob = NDB_TYPE_BLOB, ///< Binary large object (see NdbBlob)
Text = NDB_TYPE_TEXT, ///< Text blob, Text = NDB_TYPE_TEXT, ///< Text blob,
Bit = NDB_TYPE_BIT ///< Bit, length specifies no of bits Bit = NDB_TYPE_BIT, ///< Bit, length specifies no of bits
Time = NDB_TYPE_TIME ///< Time without date
}; };
/** /**
......
...@@ -86,7 +86,8 @@ public: ...@@ -86,7 +86,8 @@ public:
Timespec = NDB_TYPE_TIMESPEC, Timespec = NDB_TYPE_TIMESPEC,
Blob = NDB_TYPE_BLOB, Blob = NDB_TYPE_BLOB,
Text = NDB_TYPE_TEXT, Text = NDB_TYPE_TEXT,
Bit = NDB_TYPE_BIT Bit = NDB_TYPE_BIT,
Time = NDB_TYPE_TIME
}; };
Enum m_typeId; Enum m_typeId;
Cmp* m_cmp; // comparison method Cmp* m_cmp; // comparison method
...@@ -135,9 +136,10 @@ private: ...@@ -135,9 +136,10 @@ private:
static Cmp cmpBinary; static Cmp cmpBinary;
static Cmp cmpVarbinary; static Cmp cmpVarbinary;
static Cmp cmpDatetime; static Cmp cmpDatetime;
static Cmp cmpTimespec; static Cmp cmpDate;
static Cmp cmpBlob; static Cmp cmpBlob;
static Cmp cmpText; static Cmp cmpText;
static Cmp cmpTime;
}; };
#endif #endif
...@@ -153,8 +153,8 @@ NdbSqlUtil::m_typeList[] = { ...@@ -153,8 +153,8 @@ NdbSqlUtil::m_typeList[] = {
cmpDatetime cmpDatetime
}, },
{ {
Type::Timespec, Type::Date,
NULL // cmpTimespec cmpDate
}, },
{ {
Type::Blob, Type::Blob,
...@@ -163,6 +163,22 @@ NdbSqlUtil::m_typeList[] = { ...@@ -163,6 +163,22 @@ NdbSqlUtil::m_typeList[] = {
{ {
Type::Text, Type::Text,
NULL // cmpText NULL // cmpText
},
{
Type::Undefined, // 5.0 Bit
NULL
},
{
Type::Undefined, // 5.0 Longvarchar
NULL
},
{
Type::Undefined, // 5.0 Longvarbinary
NULL
},
{
Type::Time,
cmpTime
} }
}; };
...@@ -433,7 +449,6 @@ NdbSqlUtil::cmpVarchar(const void* info, const void* p1, unsigned n1, const void ...@@ -433,7 +449,6 @@ NdbSqlUtil::cmpVarchar(const void* info, const void* p1, unsigned n1, const void
return 0; return 0;
} }
int
NdbSqlUtil::cmpBinary(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) NdbSqlUtil::cmpBinary(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{ {
const uchar* v1 = (const uchar*)p1; const uchar* v1 = (const uchar*)p1;
...@@ -458,19 +473,57 @@ NdbSqlUtil::cmpVarbinary(const void* info, const void* p1, unsigned n1, const vo ...@@ -458,19 +473,57 @@ NdbSqlUtil::cmpVarbinary(const void* info, const void* p1, unsigned n1, const vo
return 0; return 0;
} }
// allowed but ordering is wrong before wl-1442 done
int int
NdbSqlUtil::cmpDatetime(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) NdbSqlUtil::cmpDatetime(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{ {
return cmpBinary(info, p1, n1, p2, n2, full); if (n2 >= sizeof(Int64)) {
Int64 v1, v2;
memcpy(&v1, p1, sizeof(Int64));
memcpy(&v2, p2, sizeof(Int64));
if (v1 < v2)
return -1;
if (v1 > v2)
return +1;
return 0;
}
assert(! full);
return CmpUnknown;
} }
// not used by MySQL or NDB
int int
NdbSqlUtil::cmpTimespec(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full) NdbSqlUtil::cmpDate(const void* info, const void* p1, unsigned n1, const void* p2, unsigned n2, bool full)
{ {
assert(false); #ifdef ndb_date_is_4_byte_native_int
return 0; if (n2 >= sizeof(Int32)) {
Int32 v1, v2;
memcpy(&v1, p1, sizeof(Int32));
memcpy(&v2, p2, sizeof(Int32));
if (v1 < v2)
return -1;
if (v1 > v2)
return +1;
return 0;
}
assert(! full);
return cmpUnknown;
#else
if (n2 >= 4) { // may access 4-th byte
const uchar* v1 = (const uchar*)p1;
const uchar* v2 = (const uchar*)p2;
// from Field_newdate::val_int
Uint64 j1 = uint3korr(v1);
Uint64 j2 = uint3korr(v2);
j1 = (j1 % 32L)+(j1 / 32L % 16L)*100L + (j1/(16L*32L))*10000L;
j2 = (j2 % 32L)+(j2 / 32L % 16L)*100L + (j2/(16L*32L))*10000L;
if (j1 < j2)
return -1;
if (j1 > j2)
return +1;
return 0;
}
assert(! full);
return cmpUnknown;
#endif
} }
// not supported // not supported
...@@ -489,6 +542,25 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p ...@@ -489,6 +542,25 @@ NdbSqlUtil::cmpText(const void* info, const void* p1, unsigned n1, const void* p
return 0; return 0;
} }
int
NdbSqlUtil::cmpTime(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size)
{
if (n2 >= 4) { // may access 4-th byte
const uchar* v1 = (const uchar*)p1;
const uchar* v2 = (const uchar*)p2;
// from Field_time::val_int
Int32 j1 = sint3korr(u1.v);
Int32 j2 = sint3korr(u2.v);
if (j1 < j2)
return -1;
if (j1 > j2)
return +1;
return 0;
}
assert(! full);
return CmpUnknown;
}
// check charset // check charset
bool bool
......
...@@ -920,8 +920,8 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) ...@@ -920,8 +920,8 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Datetime:
out << "Datetime"; out << "Datetime";
break; break;
case NdbDictionary::Column::Timespec: case NdbDictionary::Column::Date:
out << "Timespec"; out << "Date";
break; break;
case NdbDictionary::Column::Blob: case NdbDictionary::Column::Blob:
out << "Blob(" << col.getInlineSize() << "," << col.getPartSize() out << "Blob(" << col.getInlineSize() << "," << col.getPartSize()
...@@ -931,6 +931,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) ...@@ -931,6 +931,9 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col)
out << "Text(" << col.getInlineSize() << "," << col.getPartSize() out << "Text(" << col.getInlineSize() << "," << col.getPartSize()
<< ";" << col.getStripeSize() << ";" << csname << ")"; << ";" << col.getStripeSize() << ";" << csname << ")";
break; break;
case NdbDictionary::Column::Time:
out << "Time";
break;
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
out << "Undefined"; out << "Undefined";
break; break;
......
...@@ -125,7 +125,7 @@ NdbColumnImpl::init(Type t) ...@@ -125,7 +125,7 @@ NdbColumnImpl::init(Type t)
case Binary: case Binary:
case Varbinary: case Varbinary:
case Datetime: case Datetime:
case Timespec: case Date:
m_precision = 0; m_precision = 0;
m_scale = 0; m_scale = 0;
m_length = 1; m_length = 1;
...@@ -143,6 +143,12 @@ NdbColumnImpl::init(Type t) ...@@ -143,6 +143,12 @@ NdbColumnImpl::init(Type t)
m_length = 4; m_length = 4;
m_cs = default_cs; m_cs = default_cs;
break; break;
case Time:
m_precision = 0;
m_scale = 0;
m_length = 1;
m_cs = NULL;
break;
case Undefined: case Undefined:
assert(false); assert(false);
break; break;
......
...@@ -576,7 +576,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type) ...@@ -576,7 +576,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
case NdbDictionary::Column::Varbinary: case NdbDictionary::Column::Varbinary:
return String; return String;
case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Datetime:
case NdbDictionary::Column::Timespec: case NdbDictionary::Column::Date:
case NdbDictionary::Column::Time:
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
default: default:
return NoAttrTypeDef; return NoAttrTypeDef;
......
...@@ -71,7 +71,10 @@ BackupConsumer::create_table_string(const TableS & table, ...@@ -71,7 +71,10 @@ BackupConsumer::create_table_string(const TableS & table,
case NdbDictionary::Column::Datetime: case NdbDictionary::Column::Datetime:
pos += sprintf(buf+pos, "%s", "datetime"); pos += sprintf(buf+pos, "%s", "datetime");
break; break;
case NdbDictionary::Column::Timespec: case NdbDictionary::Column::Date:
pos += sprintf(buf+pos, "%s", "date");
break;
case NdbDictionary::Column::Time:
pos += sprintf(buf+pos, "%s", "time"); pos += sprintf(buf+pos, "%s", "time");
break; break;
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
......
...@@ -1663,7 +1663,7 @@ pr_tag_type (p, name, id, kind) ...@@ -1663,7 +1663,7 @@ pr_tag_type (p, name, id, kind)
{ {
struct pr_handle *info = (struct pr_handle *) p; struct pr_handle *info = (struct pr_handle *) p;
const char *t, *tag; const char *t, *tag;
char idbuf[20]; char idbuf[30];
switch (kind) switch (kind)
{ {
......
...@@ -2361,13 +2361,15 @@ void ha_ndbcluster::print_results() ...@@ -2361,13 +2361,15 @@ void ha_ndbcluster::print_results()
break; break;
} }
case NdbDictionary::Column::Datetime: { case NdbDictionary::Column::Datetime: {
// todo my_snprintf(buf, sizeof(buf), "Datetime ?"); // fix-me
my_snprintf(buf, sizeof(buf), "Datetime ?");
break; break;
} }
case NdbDictionary::Column::Timespec: { case NdbDictionary::Column::Date: {
// todo my_snprintf(buf, sizeof(buf), "Date ?"); // fix-me
my_snprintf(buf, sizeof(buf), "Timespec ?"); break;
}
case NdbDictionary::Column::Time: {
my_snprintf(buf, sizeof(buf), "Time ?"); // fix-me
break; break;
} }
case NdbDictionary::Column::Blob: { case NdbDictionary::Column::Blob: {
...@@ -3446,9 +3448,15 @@ static int create_ndb_column(NDBCOL &col, ...@@ -3446,9 +3448,15 @@ static int create_ndb_column(NDBCOL &col,
col.setType(NDBCOL::Datetime); col.setType(NDBCOL::Datetime);
col.setLength(1); col.setLength(1);
break; break;
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_NEWDATE: case MYSQL_TYPE_NEWDATE:
col.setType(NDBCOL::Date);
col.setLength(1);
break;
case MYSQL_TYPE_TIME: case MYSQL_TYPE_TIME:
col.setType(NDBCOL::Time);
col.setLength(1);
break;
case MYSQL_TYPE_DATE: // ?
case MYSQL_TYPE_YEAR: case MYSQL_TYPE_YEAR:
col.setType(NDBCOL::Char); col.setType(NDBCOL::Char);
col.setLength(field->pack_length()); col.setLength(field->pack_length());
......
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