// 获取 Time 类型的 SQL 片断 protected override string GetSqlValueByTime(object value, object dbType, int?precision) { // https://docs.oracle.com/en/database/oracle/oracle-database/12.2/nlspg/datetime-data-types-and-time-zone-support.html#GUID-FD8C41B7-8CDC-4D02-8E6B-5250416BC17D // throw new NotImplementedException("Oracle [Time] must map to .NET [DateTime] type."); DbTypeUtils.IsTime(dbType); return(null); }
// 获取 Time 类型的 SQL 片断 protected override string GetSqlValueByTime(object value, object dbType, int?precision) { // 默认精度6 string format = @"hh\:mm\:ss\.ffffff"; if (DbTypeUtils.IsTime(dbType)) { string pad = string.Empty; if (precision != null && precision.Value > 0) { pad = "f".PadLeft(precision.Value > 6 ? 6 : precision.Value, 'f'); } if (!string.IsNullOrEmpty(pad)) { format = string.Format(@"hh\:mm\:ss\.{0}", pad); } } string result = this.EscapeQuote(((TimeSpan)value).ToString(format), false, false); return(result); }