public void Lessers() { // LessThan() Assert.True(!SqlDateTime.LessThan(_test2, _test3).Value); Assert.True(!SqlDateTime.LessThan(_test2, _test1).Value); Assert.True(SqlDateTime.LessThan(_test1, _test3).Value); // LessThanOrEqual () Assert.True(SqlDateTime.LessThanOrEqual(_test1, _test2).Value); Assert.True(!SqlDateTime.LessThanOrEqual(_test2, _test1).Value); Assert.True(SqlDateTime.LessThanOrEqual(_test3, _test2).Value); Assert.True(SqlDateTime.LessThanOrEqual(_test1, SqlDateTime.Null).IsNull); }
public void Lessers() { // LessThan() Assert.IsTrue(!SqlDateTime.LessThan(Test2, Test3).Value, "#I01"); Assert.IsTrue(!SqlDateTime.LessThan(Test2, Test1).Value, "#I02"); Assert.IsTrue(SqlDateTime.LessThan(Test1, Test3).Value, "#I03"); // LessThanOrEqual () Assert.IsTrue(SqlDateTime.LessThanOrEqual(Test1, Test2).Value, "#I04"); Assert.IsTrue(!SqlDateTime.LessThanOrEqual(Test2, Test1).Value, "#I05"); Assert.IsTrue(SqlDateTime.LessThanOrEqual(Test3, Test2).Value, "#I06"); Assert.IsTrue(SqlDateTime.LessThanOrEqual(Test1, SqlDateTime.Null).IsNull, "#I07"); }
public override object Aggregate(int[] records, AggregateType kind) { bool hasData = false; try { switch (kind) { case AggregateType.Min: SqlDateTime min = SqlDateTime.MaxValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } if ((SqlDateTime.LessThan(_values[record], min)).IsTrue) { min = _values[record]; } hasData = true; } if (hasData) { return(min); } return(_nullValue); case AggregateType.Max: SqlDateTime max = SqlDateTime.MinValue; for (int i = 0; i < records.Length; i++) { int record = records[i]; if (IsNull(record)) { continue; } if ((SqlDateTime.GreaterThan(_values[record], max)).IsTrue) { max = _values[record]; } hasData = true; } if (hasData) { return(max); } return(_nullValue); case AggregateType.First: // Does not seem to be implemented if (records.Length > 0) { return(_values[records[0]]); } return(null !); // no data => null case AggregateType.Count: int count = 0; for (int i = 0; i < records.Length; i++) { if (!IsNull(records[i])) { count++; } } return(count); } } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlDateTime)); } throw ExceptionBuilder.AggregateException(kind, _dataType); }
public override object Aggregate(int[] records, AggregateType kind) { bool flag = false; try { int num; int num2; int num3; int num4; int num5; SqlDateTime minValue; int num6; SqlDateTime maxValue; switch (kind) { case AggregateType.Min: maxValue = SqlDateTime.MaxValue; num3 = 0; goto Label_007D; case AggregateType.Max: minValue = SqlDateTime.MinValue; num2 = 0; goto Label_00F9; case AggregateType.First: if (records.Length <= 0) { return(null); } return(this.values[records[0]]); case AggregateType.Count: num4 = 0; num = 0; goto Label_015A; default: goto Label_017F; } Label_002F: num6 = records[num3]; if (!this.IsNull(num6)) { if (SqlDateTime.LessThan(this.values[num6], maxValue).IsTrue) { maxValue = this.values[num6]; } flag = true; } num3++; Label_007D: if (num3 < records.Length) { goto Label_002F; } if (flag) { return(maxValue); } return(base.NullValue); Label_00AB: num5 = records[num2]; if (!this.IsNull(num5)) { if (SqlDateTime.GreaterThan(this.values[num5], minValue).IsTrue) { minValue = this.values[num5]; } flag = true; } num2++; Label_00F9: if (num2 < records.Length) { goto Label_00AB; } if (flag) { return(minValue); } return(base.NullValue); Label_0145: if (!this.IsNull(records[num])) { num4++; } num++; Label_015A: if (num < records.Length) { goto Label_0145; } return(num4); } catch (OverflowException) { throw ExprException.Overflow(typeof(SqlDateTime)); } Label_017F: throw ExceptionBuilder.AggregateException(kind, base.DataType); }