public override DateTime GetDateTime(int ordinal) { return(UTCStart.AddMilliseconds(set.getDate(ordinal).getTime())); }
static H2Helper() { jdbc2dbtype = new Dictionary <int, DbType>(); dbtype2jdbc = new Dictionary <DbType, int>(); converters2java = new Dictionary <DbType, Converter>(); converters2clr = new Dictionary <int, Converter>(); jdbc2type = new Dictionary <int, Type>(); Converter id = x => x; map(Types.VARCHAR, DbType.AnsiString, typeof(string), id, id); map(Types.CHAR, DbType.AnsiStringFixedLength, typeof(string), id, id); map(Types.LONGVARBINARY, DbType.Binary, typeof(byte[]), id, id); map(Types.BINARY, DbType.Binary, typeof(byte[]), id, id); map(Types.BOOLEAN, DbType.Boolean, typeof(bool), x => new java.lang.Boolean((bool)x), x => ((java.lang.Boolean)x).booleanValue() ); map(Types.TINYINT, DbType.Byte, typeof(byte), x => new java.lang.Byte((byte)x), x => ((java.lang.Byte)x).byteValue() ); map(Types.DATE, DbType.Date, typeof(DateTime), x => new java.sql.Date((long)(((DateTime)x) - UTCStart).TotalMilliseconds), x => UTCStart.AddMilliseconds(((java.sql.Date)x).getTime()) ); map(Types.TIMESTAMP, DbType.DateTime, typeof(DateTime), x => new java.sql.Timestamp((long)(((DateTime)x) - UTCStart).TotalMilliseconds), x => UTCStart.AddMilliseconds(((java.util.Date)x).getTime()) ); map(Types.TIMESTAMP, DbType.DateTime2, typeof(DateTime), x => new java.sql.Timestamp((long)(((DateTime)x) - UTCStart).TotalMilliseconds), x => UTCStart.AddMilliseconds(((java.sql.Date)x).getTime()) ); map(Types.TIMESTAMP, DbType.DateTimeOffset, typeof(DateTimeOffset), x => new java.sql.Timestamp((long)(((DateTimeOffset)x) - UTCStart).TotalMilliseconds), x => (DateTimeOffset)UTCStart.AddMilliseconds(((java.sql.Date)x).getTime()) ); map(Types.DECIMAL, DbType.Decimal, typeof(decimal), //TODO: test me ! x => new java.math.BigDecimal(((decimal)x).ToString()), x => decimal.Parse(((java.math.BigDecimal)x).toString()) ); map(Types.DOUBLE, DbType.Double, typeof(double), x => new java.lang.Double((double)x), x => ((java.lang.Double)x).doubleValue() ); map(Types.SMALLINT, DbType.Int16, typeof(short), x => new java.lang.Short((short)x), x => ((java.lang.Short)x).shortValue() ); map(Types.INTEGER, DbType.Int32, typeof(int), x => new java.lang.Integer((int)x), x => ((java.lang.Integer)x).intValue() ); map(Types.BIGINT, DbType.Int64, typeof(long), x => new java.lang.Long((long)x), x => ((java.lang.Long)x).longValue() ); map(Types.SMALLINT, DbType.UInt16, typeof(ushort), x => new java.lang.Short((short)(ushort)x), x => (ushort)((java.lang.Short)x).shortValue() ); map(Types.INTEGER, DbType.UInt32, typeof(uint), x => new java.lang.Integer((int)(uint)x), x => (uint)((java.lang.Integer)x).intValue() ); map(Types.BIGINT, DbType.UInt64, typeof(ulong), x => new java.lang.Long((long)(ulong)x), x => (ulong)((java.lang.Long)x).longValue() ); map(Types.JAVA_OBJECT, DbType.Object, typeof(Object), id, id); map(Types.TINYINT, DbType.SByte, typeof(byte), x => new java.lang.Byte((byte)x), x => ((java.lang.Byte)x).byteValue() ); map(Types.FLOAT, DbType.Single, typeof(float), x => new java.lang.Float((float)x), x => ((java.lang.Float)x).floatValue() ); map(Types.NVARCHAR, DbType.String, typeof(string), id, id); map(Types.NCHAR, DbType.StringFixedLength, typeof(string), id, id); map(Types.TIME, DbType.Time, typeof(DateTime), x => new java.sql.Timestamp((long)(((DateTime)x) - UTCStart).TotalMilliseconds), x => UTCStart.AddMilliseconds(((java.sql.Date)x).getTime()) ); map(Types.ARRAY, DbType.VarNumeric, null, id, id); //DbType.Guid: //DbType.Currency: }
public override DateTime GetDateTime(int ordinal) => UTCStart.AddMilliseconds(_set.getDate(ordinal).getTime());