Loading mysql-test/r/ndb_index_ordered.result +110 −0 Original line number Diff line number Diff line Loading @@ -310,3 +310,113 @@ SubscrID SbclID 3 NULL drop table test1; 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 mysql-test/t/ndb_index_ordered.test +64 −0 Original line number Diff line number Diff line Loading @@ -172,3 +172,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; drop table test1; 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'; ndb/include/kernel/signaldata/DictTabInfo.hpp +10 −4 Original line number Diff line number Diff line Loading @@ -308,9 +308,10 @@ public: ExtBinary = NdbSqlUtil::Type::Binary, ExtVarbinary = NdbSqlUtil::Type::Varbinary, ExtDatetime = NdbSqlUtil::Type::Datetime, ExtTimespec = NdbSqlUtil::Type::Timespec, ExtDate = NdbSqlUtil::Type::Date, ExtBlob = NdbSqlUtil::Type::Blob, ExtText = NdbSqlUtil::Type::Text ExtText = NdbSqlUtil::Type::Text, ExtTime = NdbSqlUtil::Type::Time }; // Attribute data interpretation Loading Loading @@ -428,10 +429,10 @@ public: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 8 * AttributeExtLength; return true; case DictTabInfo::ExtTimespec: case DictTabInfo::ExtDate: AttributeType = DictTabInfo::StringType; AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 12 * AttributeExtLength; AttributeArraySize = 3 * AttributeExtLength; return true; case DictTabInfo::ExtBlob: case DictTabInfo::ExtText: Loading @@ -440,6 +441,11 @@ public: // head + inline part [ attr precision lower half ] AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); return true; case DictTabInfo::ExtTime: AttributeType = DictTabInfo::StringType; AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 3 * AttributeExtLength; return true; }; return false; } Loading ndb/include/ndbapi/NdbDictionary.hpp +3 −2 Original line number Diff line number Diff line Loading @@ -185,9 +185,10 @@ public: Binary, ///< Len Varbinary, ///< Max len Datetime, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes ) Timespec, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes ) Date, ///< Precision down to 1 day(sizeof(Date) == 4 bytes ) Blob, ///< Binary large object (see NdbBlob) Text ///< Text blob Text, ///< Text blob Time = 25 ///< Time without date }; /** Loading ndb/include/util/NdbSqlUtil.hpp +5 −3 Original line number Diff line number Diff line Loading @@ -81,9 +81,10 @@ public: Binary, // Len Varbinary, // Max len Datetime, // Precision down to 1 sec (size 8 bytes) Timespec, // Precision down to 1 nsec (size 12 bytes) Date, // Precision down to 1 day (size 4 bytes) Blob, // Blob Text // Text blob Text, // Text blob Time = 25 // Time without date }; Enum m_typeId; Cmp* m_cmp; // comparison method Loading Loading @@ -132,9 +133,10 @@ private: static Cmp cmpBinary; static Cmp cmpVarbinary; static Cmp cmpDatetime; static Cmp cmpTimespec; static Cmp cmpDate; static Cmp cmpBlob; static Cmp cmpText; static Cmp cmpTime; }; #endif Loading
mysql-test/r/ndb_index_ordered.result +110 −0 Original line number Diff line number Diff line Loading @@ -310,3 +310,113 @@ SubscrID SbclID 3 NULL drop table test1; 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
mysql-test/t/ndb_index_ordered.test +64 −0 Original line number Diff line number Diff line Loading @@ -172,3 +172,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; drop table test1; 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';
ndb/include/kernel/signaldata/DictTabInfo.hpp +10 −4 Original line number Diff line number Diff line Loading @@ -308,9 +308,10 @@ public: ExtBinary = NdbSqlUtil::Type::Binary, ExtVarbinary = NdbSqlUtil::Type::Varbinary, ExtDatetime = NdbSqlUtil::Type::Datetime, ExtTimespec = NdbSqlUtil::Type::Timespec, ExtDate = NdbSqlUtil::Type::Date, ExtBlob = NdbSqlUtil::Type::Blob, ExtText = NdbSqlUtil::Type::Text ExtText = NdbSqlUtil::Type::Text, ExtTime = NdbSqlUtil::Type::Time }; // Attribute data interpretation Loading Loading @@ -428,10 +429,10 @@ public: AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 8 * AttributeExtLength; return true; case DictTabInfo::ExtTimespec: case DictTabInfo::ExtDate: AttributeType = DictTabInfo::StringType; AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 12 * AttributeExtLength; AttributeArraySize = 3 * AttributeExtLength; return true; case DictTabInfo::ExtBlob: case DictTabInfo::ExtText: Loading @@ -440,6 +441,11 @@ public: // head + inline part [ attr precision lower half ] AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF); return true; case DictTabInfo::ExtTime: AttributeType = DictTabInfo::StringType; AttributeSize = DictTabInfo::an8Bit; AttributeArraySize = 3 * AttributeExtLength; return true; }; return false; } Loading
ndb/include/ndbapi/NdbDictionary.hpp +3 −2 Original line number Diff line number Diff line Loading @@ -185,9 +185,10 @@ public: Binary, ///< Len Varbinary, ///< Max len Datetime, ///< Precision down to 1 sec (sizeof(Datetime) == 8 bytes ) Timespec, ///< Precision down to 1 nsec(sizeof(Datetime) == 12 bytes ) Date, ///< Precision down to 1 day(sizeof(Date) == 4 bytes ) Blob, ///< Binary large object (see NdbBlob) Text ///< Text blob Text, ///< Text blob Time = 25 ///< Time without date }; /** Loading
ndb/include/util/NdbSqlUtil.hpp +5 −3 Original line number Diff line number Diff line Loading @@ -81,9 +81,10 @@ public: Binary, // Len Varbinary, // Max len Datetime, // Precision down to 1 sec (size 8 bytes) Timespec, // Precision down to 1 nsec (size 12 bytes) Date, // Precision down to 1 day (size 4 bytes) Blob, // Blob Text // Text blob Text, // Text blob Time = 25 // Time without date }; Enum m_typeId; Cmp* m_cmp; // comparison method Loading Loading @@ -132,9 +133,10 @@ private: static Cmp cmpBinary; static Cmp cmpVarbinary; static Cmp cmpDatetime; static Cmp cmpTimespec; static Cmp cmpDate; static Cmp cmpBlob; static Cmp cmpText; static Cmp cmpTime; }; #endif