protected abstract void WriteYearMonthInterval(IntervalMonthData o, SqlType type);
protected override void WriteYearMonthInterval(IntervalMonthData o, SqlType type) { this.WriteLong(o.Units); }
private void SetParameter(int i, UtlParameter param) { object o = param.Value; if ((o == null) || (o == DBNull.Value)) { this._parameterValues[i] = null; return; } ISessionInterface sessionProxy = this._command.Connection.InnerConnection.SessionProxy; SqlType type = this._parameterTypes[i]; int typeCode = type.TypeCode; if (typeCode <= 30) { if (typeCode > 0x15) { switch (typeCode) { case 0x19: case 30: goto Label_028B; } this._parameterValues[i] = o; return; } switch (typeCode) { case 0x15: { DataTable dataTable = o as DataTable; if (dataTable != null) { dataTable.TableName = this._parameterNames[i]; if (!((TableType)this._parameterTypes[i]).IsCompatible(dataTable)) { goto Label_0379; } goto Label_03AF; } DbDataReader reader = o as DbDataReader; if (reader == null) { goto Label_03AF; } dataTable = new DataTable(this._parameterNames[i]); UtlMetaData.PopulateDataTable(dataTable, reader); if (((TableType)this._parameterTypes[i]).IsCompatible(dataTable)) { o = dataTable; goto Label_03AF; } goto Label_0379; } } } else { if (typeCode <= 0x3d) { if (typeCode == 40) { this._parameterValues[i] = o; return; } if ((typeCode - 60) > 1) { goto Label_028B; } byte[] data = o as byte[]; if (data != null) { o = new BinaryData(data, !this._command.Connection.IsNetConnection); } else { try { if (o is string) { o = type.ConvertToDefaultType(sessionProxy, o); goto Label_03AF; } } catch (CoreException exception1) { UtlException.ThrowError(exception1); } UtlException.ThrowError(Error.GetError(0x15bd)); } goto Label_03AF; } switch (typeCode) { case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f: try { if (((param.UtlType == UtlType.Null) && (o is string)) || (((param.UtlType == UtlType.VarChar) || (param.UtlType == UtlType.Char)) || (param.UtlType == UtlType.VarCharIngnoreCase))) { o = type.ConvertToType(sessionProxy, o, SqlType.SqlVarchar); } else { o = type.ConvertCSharpToSQL(sessionProxy, o); } } catch (CoreException exception2) { UtlException.ThrowError(exception2); } goto Label_03AF; case 0x65: case 0x66: case 0x6b: { MonthSpan span = (MonthSpan)o; o = new IntervalMonthData((long)span.TotalMonths); goto Label_03AF; } case 0x67: case 0x68: case 0x69: case 0x6a: case 0x6c: case 0x6d: case 110: case 0x6f: case 0x70: case 0x71: { TimeSpan span2 = (TimeSpan)o; long totalSeconds = (long)span2.TotalSeconds; int nanos = (int)((span2.TotalSeconds - totalSeconds) * 1000000000.0); o = new IntervalSecondData(totalSeconds, nanos); goto Label_03AF; } case 0x457: try { if (o.GetType().IsSerializable) { o = new OtherData(o); goto Label_03AF; } } catch (CoreException exception3) { UtlException.ThrowError(exception3); } UtlException.ThrowError(Error.GetError(0x15bd)); goto Label_03AF; } } Label_028B :; try { if (((param.UtlType == UtlType.Null) && (o is string)) || (((param.UtlType == UtlType.VarChar) || (param.UtlType == UtlType.Char)) || (param.UtlType == UtlType.VarCharIngnoreCase))) { o = type.ConvertToType(sessionProxy, o, SqlType.SqlVarchar); } else if (param.UtlType == UtlType.Null) { o = type.ConvertToDefaultType(sessionProxy, o); } else { SqlType type2 = this.UtlType2SqlType(param.UtlType); o = type.ConvertToType(sessionProxy, o, type2); } } catch (CoreException exception4) { UtlException.ThrowError(exception4); } goto Label_03AF; Label_0379 :; try { if (param.UtlType == UtlType.Null) { o = type.ConvertToDefaultType(sessionProxy, o); } else { SqlType type3 = this.UtlType2SqlType(param.UtlType); o = type.ConvertToType(sessionProxy, o, type3); } } catch (CoreException exception5) { UtlException.ThrowError(exception5); } Label_03AF: this._parameterValues[i] = o; }
public void Add(Session session, object item) { if (item == null) { this._hasNull = true; } else if (!this._isDistinct || this._distinctValues.Add(item)) { this._count++; switch (this._setType) { case 0x47: return; case 0x48: case 0x4b: switch (this._dataType) { case -6: case 4: case 5: int num3; try { num3 = (int)item; } catch (Exception) { num3 = Convert.ToInt32(item); } this._currentLong += num3; return; case 2: case 3: decimal num4; try { num4 = (decimal)item; } catch (Exception) { num4 = Convert.ToDecimal(item); } this._currentBigDecimal += num4; return; case 6: case 7: case 8: double num5; try { num5 = (double)item; } catch (Exception) { num5 = Convert.ToDouble(item); } this._currentDouble += num5; return; case 10: { IntervalSecondData data = item as IntervalSecondData; if (data != null) { this._currentLong += data.Units; this._currentLong += data.Nanos; if (Math.Abs(this._currentLong) >= DTIType.NanoScaleFactors[0]) { this._currentLong += this._currentLong / ((long)DTIType.NanoScaleFactors[0]); this._currentLong = this._currentLong % ((long)DTIType.NanoScaleFactors[0]); return; } } else { IntervalMonthData data2 = item as IntervalMonthData; if (data2 != null) { this._currentLong += data2.Units; } } return; } case 0x19: long num6; try { num6 = (long)item; } catch (Exception) { num6 = Convert.ToInt64(item); } this._currentLong += num6; return; case 0x68: this._currentValue = item; return; } break; case 0x49: if (this._currentValue != null) { if (this._type.Compare(session, this._currentValue, item, this._type, false) > 0) { this._currentValue = item; } return; } this._currentValue = item; return; case 0x4a: if (this._currentValue != null) { if (this._type.Compare(session, this._currentValue, item, this._type, false) < 0) { this._currentValue = item; } return; } this._currentValue = item; return; case 0x4c: if (!(item is bool)) { throw Error.GetError(0x15bd); } this._every = this._every && ((bool)item); return; case 0x4d: if (!(item is bool)) { throw Error.GetError(0x15bd); } this._some = this._some || ((bool)item); return; case 0x4e: case 0x4f: case 80: case 0x51: this.AddDataPoint(item); return; default: throw Error.RuntimeError(0xc9, "SetFunction"); } throw Error.GetError(0x15bd); } }
public object GetValue(Session session) { if (this._hasNull) { session.AddWarning(Error.GetError(0x3eb)); } if (this._setType == 0x47) { return(this._count); } if (this._count == 0) { return(null); } int num = this._setType; switch (num) { case 0x48: { int num2 = this._dataType; switch (num2) { case -5: case -4: case -3: case -2: case -1: case 0: case 1: case 9: goto Label_0162; case 2: case 3: return(this._currentBigDecimal); case 6: case 7: case 8: return(this._currentDouble); case 10: { long result = this._currentLong; if (!NumberType.IsInLongLimits(result)) { throw Error.GetError(0xd6b); } if (((IntervalType)this._type).IsDaySecondIntervalType()) { return(new IntervalSecondData(result, this._currentLong, (IntervalType)this._type, true)); } return(IntervalMonthData.NewIntervalMonth(result, (IntervalType)this._type)); } } if (num2 != 0x19) { goto Label_0162; } break; } case 0x49: case 0x4a: return(this._currentValue); case 0x4b: { int num4 = this._dataType; switch (num4) { case -6: case 4: case 5: goto Label_027A; case -5: case -4: case -3: case -2: case -1: case 0: case 1: case 9: goto Label_0290; case 2: case 3: return(this._currentBigDecimal / this._count); case 6: case 7: case 8: return(this._currentDouble / ((double)this._count)); case 10: { long result = this._currentLong / ((long)this._count); if (!NumberType.IsInLongLimits(result)) { throw Error.GetError(0xd6b); } if (((IntervalType)this._type).IsDaySecondIntervalType()) { return(new IntervalSecondData(result, this._currentLong, (IntervalType)this._type, true)); } return(IntervalMonthData.NewIntervalMonth(result, (IntervalType)this._type)); } } if (num4 != 0x19) { goto Label_0290; } goto Label_027A; } case 0x4c: return(this._every); case 0x4d: return(this._some); case 0x4e: case 0x4f: return(this.GetStdDev()); case 80: case 0x51: return(this.GetVariance()); default: if (num != 0x68) { throw Error.RuntimeError(0xc9, "SetFunction"); } return(this._currentValue); } return(this._currentLong); Label_0162: throw Error.RuntimeError(0xc9, "SetFunction"); Label_027A: return(this._currentLong / ((long)this._count)); Label_0290: throw Error.RuntimeError(0xc9, "SetFunction"); }
protected override void WriteYearMonthInterval(IntervalMonthData o, SqlType type) { base.Write(0x27); base.WriteBytes(type.ConvertToString(o)); base.Write(0x27); }