Commit c3dec835 authored by unknown's avatar unknown
Browse files

Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/space/pekka/ndb/version/my41-1.2154.30.2

parents 0d4ef3a3 dbff1150
Loading
Loading
Loading
Loading
+83 −0
Original line number Diff line number Diff line
@@ -445,6 +445,89 @@ 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,
s decimal(12),
t decimal(12, 5),
u decimal(12) unsigned,
v decimal(12, 5) unsigned,
key (s),
key (t),
key (u),
key (v)
) engine=ndb;
insert into t1 values
( 0, -000000000007, -0000061.00003,  000000000061,  0000965.00042),
( 1, -000000000007, -0000061.00042,  000000000061,  0000965.00003),
( 2, -071006035767,  4210253.00024,  000000000001,  0000001.84488),
( 3,  000000007115,  0000000.77607,  000077350625,  0000018.00013),
( 4, -000000068391, -0346486.00000,  000000005071,  0005334.00002),
( 5, -521579890459, -1936874.00001,  000000000154,  0000003.00018),
( 6, -521579890459, -1936874.00018,  000000000154,  0000003.00001),
( 7,  000000000333,  0000051.39140,  000000907958,  0788643.08374),
( 8,  000042731229,  0000009.00000,  000000000009,  6428667.00000),
( 9, -000008159769,  0000918.00004,  000096951421,  7607730.00008);
select count(*)- 5 from t1 use index (s) where s  < -000000000007;
count(*)- 5
0
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
count(*)- 7
0
select count(*)- 2 from t1 use index (s) where s  = -000000000007;
count(*)- 2
0
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
count(*)- 5
0
select count(*)- 3 from t1 use index (s) where s  > -000000000007;
count(*)- 3
0
select count(*)- 4 from t1 use index (t) where t  < -0000061.00003;
count(*)- 4
0
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
count(*)- 5
0
select count(*)- 1 from t1 use index (t) where t  = -0000061.00003;
count(*)- 1
0
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
count(*)- 6
0
select count(*)- 5 from t1 use index (t) where t  > -0000061.00003;
count(*)- 5
0
select count(*)- 2 from t1 use index (u) where u  <  000000000061;
count(*)- 2
0
select count(*)- 4 from t1 use index (u) where u <=  000000000061;
count(*)- 4
0
select count(*)- 2 from t1 use index (u) where u  =  000000000061;
count(*)- 2
0
select count(*)- 8 from t1 use index (u) where u >=  000000000061;
count(*)- 8
0
select count(*)- 6 from t1 use index (u) where u  >  000000000061;
count(*)- 6
0
select count(*)- 5 from t1 use index (v) where v  <  0000965.00042;
count(*)- 5
0
select count(*)- 6 from t1 use index (v) where v <=  0000965.00042;
count(*)- 6
0
select count(*)- 1 from t1 use index (v) where v  =  0000965.00042;
count(*)- 1
0
select count(*)- 5 from t1 use index (v) where v >=  0000965.00042;
count(*)- 5
0
select count(*)- 4 from t1 use index (v) where v  >  0000965.00042;
count(*)- 4
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);
set autocommit=0;
+52 −0
Original line number Diff line number Diff line
@@ -249,6 +249,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';

drop table t1;

# decimal (not the new 5.0 thing)

create table t1 (
  a int primary key,
  s decimal(12),
  t decimal(12, 5),
  u decimal(12) unsigned,
  v decimal(12, 5) unsigned,
  key (s),
  key (t),
  key (u),
  key (v)
) engine=ndb;
#
insert into t1 values
  ( 0, -000000000007, -0000061.00003,  000000000061,  0000965.00042),
  ( 1, -000000000007, -0000061.00042,  000000000061,  0000965.00003),
  ( 2, -071006035767,  4210253.00024,  000000000001,  0000001.84488),
  ( 3,  000000007115,  0000000.77607,  000077350625,  0000018.00013),
  ( 4, -000000068391, -0346486.00000,  000000005071,  0005334.00002),
  ( 5, -521579890459, -1936874.00001,  000000000154,  0000003.00018),
  ( 6, -521579890459, -1936874.00018,  000000000154,  0000003.00001),
  ( 7,  000000000333,  0000051.39140,  000000907958,  0788643.08374),
  ( 8,  000042731229,  0000009.00000,  000000000009,  6428667.00000),
  ( 9, -000008159769,  0000918.00004,  000096951421,  7607730.00008);
#
select count(*)- 5 from t1 use index (s) where s  < -000000000007;
select count(*)- 7 from t1 use index (s) where s <= -000000000007;
select count(*)- 2 from t1 use index (s) where s  = -000000000007;
select count(*)- 5 from t1 use index (s) where s >= -000000000007;
select count(*)- 3 from t1 use index (s) where s  > -000000000007;
#
select count(*)- 4 from t1 use index (t) where t  < -0000061.00003;
select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
select count(*)- 1 from t1 use index (t) where t  = -0000061.00003;
select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
select count(*)- 5 from t1 use index (t) where t  > -0000061.00003;
#
select count(*)- 2 from t1 use index (u) where u  <  000000000061;
select count(*)- 4 from t1 use index (u) where u <=  000000000061;
select count(*)- 2 from t1 use index (u) where u  =  000000000061;
select count(*)- 8 from t1 use index (u) where u >=  000000000061;
select count(*)- 6 from t1 use index (u) where u  >  000000000061;
#
select count(*)- 5 from t1 use index (v) where v  <  0000965.00042;
select count(*)- 6 from t1 use index (v) where v <=  0000965.00042;
select count(*)- 1 from t1 use index (v) where v  =  0000965.00042;
select count(*)- 5 from t1 use index (v) where v >=  0000965.00042;
select count(*)- 4 from t1 use index (v) where v  >  0000965.00042;

drop table t1;

# bug#7798
create table t1(a int primary key, b int not null, index(b));
insert into t1 values (1,1), (2,2);
+16 −4
Original line number Diff line number Diff line
@@ -302,7 +302,8 @@ public:
    ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned,
    ExtFloat = NdbSqlUtil::Type::Float,
    ExtDouble = NdbSqlUtil::Type::Double,
    ExtDecimal = NdbSqlUtil::Type::Decimal,
    ExtOlddecimal = NdbSqlUtil::Type::Olddecimal,
    ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned,
    ExtChar = NdbSqlUtil::Type::Char,
    ExtVarchar = NdbSqlUtil::Type::Varchar,
    ExtBinary = NdbSqlUtil::Type::Binary,
@@ -411,9 +412,20 @@ public:
        AttributeSize = DictTabInfo::a64Bit;
        AttributeArraySize = AttributeExtLength;
        return true;
      case DictTabInfo::ExtDecimal:
        // not yet implemented anywhere
        break;
      case DictTabInfo::ExtOlddecimal:
        AttributeType = DictTabInfo::StringType;
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize =
          (1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
          AttributeExtLength;
        return true;
      case DictTabInfo::ExtOlddecimalunsigned:
        AttributeType = DictTabInfo::StringType;
        AttributeSize = DictTabInfo::an8Bit;
        AttributeArraySize =
          (0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) *
          AttributeExtLength;
        return true;
      case DictTabInfo::ExtChar:
      case DictTabInfo::ExtBinary:
        AttributeType = DictTabInfo::StringType;
+7 −6
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ public:
      Bigunsigned,   ///< 64 Bit. 8 byte signed integer, can be used in array
      Float,         ///< 32-bit float. 4 bytes float, can be used in array
      Double,        ///< 64-bit float. 8 byte float, can be used in array
      Decimal,       ///< Precision, Scale are applicable
      Olddecimal,    ///< MySQL < 5.0 signed decimal,  Precision, Scale
      Char,          ///< Len. A fixed array of 1-byte chars
      Varchar,       ///< Max len
      Binary,        ///< Len
@@ -190,7 +190,8 @@ public:
      Text,        ///< Text blob
      Time = 25,   ///< Time without date
      Year = 26,   ///< Year 1901-2155 (1 byte)
      Timestamp = 27  ///< Unix time
      Timestamp = 27, ///< Unix time
      Olddecimalunsigned = 28
    };

    /** 
@@ -276,25 +277,25 @@ public:

    /**
     * Set precision of column.
     * @note Only applicable for builtin type Decimal
     * @note Only applicable for decimal types
     */
    void setPrecision(int);

    /**
     * Get precision of column.
     * @note Only applicable for builtin type Decimal
     * @note Only applicable for decimal types
     */
    int getPrecision() const;

    /**
     * Set scale of column.
     * @note Only applicable for builtin type Decimal
     * @note Only applicable for decimal types
     */
    void setScale(int);

    /**
     * Get scale of column.
     * @note Only applicable for builtin type Decimal
     * @note Only applicable for decimal types
     */
    int getScale() const;

+10 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public:
      Bigunsigned,      // 64 Bit
      Float,            // 32-bit float
      Double,           // 64-bit float
      Decimal,          // Precision, Scale
      Olddecimal,       // Precision, Scale
      Char,             // Len
      Varchar,          // Max len
      Binary,           // Len
@@ -86,7 +86,8 @@ public:
      Text,             // Text blob
      Time = 25,        // Time without date
      Year = 26,        // Year (size 1 byte)
      Timestamp = 27    // Unix seconds (uint32)
      Timestamp = 27,   // Unix seconds (uint32)
      Olddecimalunsigned = 28
    };
    Enum m_typeId;
    Cmp* m_cmp;         // comparison method
@@ -109,6 +110,11 @@ public:
  static bool usable_in_hash_index(Uint32 typeId, const void* cs);
  static bool usable_in_ordered_index(Uint32 typeId, const void* cs);

  /**
   * Compare decimal numbers.
   */
  static int cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n);

private:
  /**
   * List of all types.  Must match Type::Enum.
@@ -129,7 +135,7 @@ private:
  static Cmp cmpBigunsigned;
  static Cmp cmpFloat;
  static Cmp cmpDouble;
  static Cmp cmpDecimal;
  static Cmp cmpOlddecimal;
  static Cmp cmpChar;
  static Cmp cmpVarchar;
  static Cmp cmpBinary;
@@ -141,6 +147,7 @@ private:
  static Cmp cmpTime;
  static Cmp cmpYear;
  static Cmp cmpTimestamp;
  static Cmp cmpOlddecimalunsigned;
};

#endif
Loading