Commit 1ed40339 authored by unknown's avatar unknown
Browse files

ndb - make YEAR and TIMESTAMP into ndb types


mysql-test/r/ndb_index_ordered.result:
  make YEAR and TIMESTAMP into ndb types
mysql-test/t/ndb_index_ordered.test:
  make YEAR and TIMESTAMP into ndb types
ndb/include/kernel/signaldata/DictTabInfo.hpp:
  make YEAR and TIMESTAMP into ndb types
ndb/include/ndbapi/NdbDictionary.hpp:
  make YEAR and TIMESTAMP into ndb types
ndb/include/util/NdbSqlUtil.hpp:
  make YEAR and TIMESTAMP into ndb types
ndb/src/common/util/NdbSqlUtil.cpp:
  make YEAR and TIMESTAMP into ndb types
ndb/src/ndbapi/NdbDictionary.cpp:
  make YEAR and TIMESTAMP into ndb types
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  make YEAR and TIMESTAMP into ndb types
ndb/src/ndbapi/NdbRecAttr.cpp:
  make YEAR and TIMESTAMP into ndb types
ndb/test/include/NdbSchemaOp.hpp:
  make YEAR and TIMESTAMP into ndb types
sql/ha_ndbcluster.cc:
  make YEAR and TIMESTAMP into ndb types
parent 4e5a513c
Loading
Loading
Loading
Loading
+34 −10
Original line number Diff line number Diff line
@@ -323,16 +323,16 @@ 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');
insert into t1 (pk,dt,da,ye,ti,ts) values
(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59', '2001-01-01 23:00:59'),
(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59', '2001-01-01 13:00:59'),
(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00', '2001-01-01 00:00:00'),
(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00', '2001-01-01 00:00:00'),
(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06', '2001-01-01 06:06:06'),
(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06', '2001-01-01 06:06:06'),
(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10', '2001-01-01 10:11:10'),
(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11', '2001-01-01 10:11:11'),
(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59', '2001-01-01 23:59:59');
select count(*)-9 from t1 use index (dt) where dt >  '1900-01-01 00:00:00';
count(*)-9
0
@@ -420,6 +420,30 @@ count(*)-8
select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
count(*)-9
0
select count(*)-9 from t1 use index (ts) where ts >= '2001-01-01 00:00:00';
count(*)-9
0
select count(*)-7 from t1 use index (ts) where ts >  '2001-01-01 00:00:00';
count(*)-7
0
select count(*)-7 from t1 use index (ts) where ts >  '2001-01-01 05:05:05';
count(*)-7
0
select count(*)-5 from t1 use index (ts) where ts >  '2001-01-01 06:06:06';
count(*)-5
0
select count(*)-5 from t1 use index (ts) where ts <  '2001-01-01 10:11:11';
count(*)-5
0
select count(*)-6 from t1 use index (ts) where ts <= '2001-01-01 10:11:11';
count(*)-6
0
select count(*)-8 from t1 use index (ts) where ts <  '2001-01-01 23:59:59';
count(*)-8
0
select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
count(*)-9
0
drop table t1;
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
+20 −10
Original line number Diff line number Diff line
@@ -189,16 +189,16 @@ create table t1 (
  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');
insert into t1 (pk,dt,da,ye,ti,ts) values
  (1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59', '2001-01-01 23:00:59'),
  (2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59', '2001-01-01 13:00:59'),
  (3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00', '2001-01-01 00:00:00'),
  (4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00', '2001-01-01 00:00:00'),
  (5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06', '2001-01-01 06:06:06'),
  (6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06', '2001-01-01 06:06:06'),
  (7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10', '2001-01-01 10:11:10'),
  (8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11', '2001-01-01 10:11:11'),
  (9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59', '2001-01-01 23:59:59');

# datetime
select count(*)-9 from t1 use index (dt) where dt >  '1900-01-01 00:00:00';
@@ -237,6 +237,16 @@ 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';

# timestamp
select count(*)-9 from t1 use index (ts) where ts >= '2001-01-01 00:00:00';
select count(*)-7 from t1 use index (ts) where ts >  '2001-01-01 00:00:00';
select count(*)-7 from t1 use index (ts) where ts >  '2001-01-01 05:05:05';
select count(*)-5 from t1 use index (ts) where ts >  '2001-01-01 06:06:06';
select count(*)-5 from t1 use index (ts) where ts <  '2001-01-01 10:11:11';
select count(*)-6 from t1 use index (ts) where ts <= '2001-01-01 10:11:11';
select count(*)-8 from t1 use index (ts) where ts <  '2001-01-01 23:59:59';
select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';

drop table t1;

# bug#7798
+13 −1
Original line number Diff line number Diff line
@@ -311,7 +311,9 @@ public:
    ExtDate = NdbSqlUtil::Type::Date,
    ExtBlob = NdbSqlUtil::Type::Blob,
    ExtText = NdbSqlUtil::Type::Text,
    ExtTime = NdbSqlUtil::Type::Time
    ExtTime = NdbSqlUtil::Type::Time,
    ExtYear = NdbSqlUtil::Type::Year,
    ExtTimestamp = NdbSqlUtil::Type::Timestamp
  };

  // Attribute data interpretation
@@ -446,6 +448,16 @@ public:
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize = 3 * AttributeExtLength;
        return true;
      case DictTabInfo::ExtYear:
        AttributeType = DictTabInfo::StringType;
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize = 1 * AttributeExtLength;
        return true;
      case DictTabInfo::ExtTimestamp:
        AttributeType = DictTabInfo::StringType;
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize = 4 * AttributeExtLength;
        return true;
      };
      return false;
    }
+3 −1
Original line number Diff line number Diff line
@@ -188,7 +188,9 @@ public:
      Date,        ///< Precision down to 1 day(sizeof(Date) == 4 bytes )
      Blob,        ///< Binary large object (see NdbBlob)
      Text,        ///< Text blob
      Time = 25    ///< Time without date
      Time = 25,   ///< Time without date
      Year = 26,   ///< Year 1901-2155 (1 byte)
      Timestamp = 27  ///< Unix time
    };

    /** 
+5 −1
Original line number Diff line number Diff line
@@ -84,7 +84,9 @@ public:
      Date,             // Precision down to 1 day (size 4 bytes)
      Blob,             // Blob
      Text,             // Text blob
      Time = 25         // Time without date
      Time = 25,        // Time without date
      Year = 26,        // Year (size 1 byte)
      Timestamp = 27    // Unix seconds (uint32)
    };
    Enum m_typeId;
    Cmp* m_cmp;         // comparison method
@@ -137,6 +139,8 @@ private:
  static Cmp cmpBlob;
  static Cmp cmpText;
  static Cmp cmpTime;
  static Cmp cmpYear;
  static Cmp cmpTimestamp;
};

#endif
Loading