/// <summary>
        /// Convert to a postgresql timestamp.
        /// </summary>

        internal static String ToDateTime(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
        {
            if (!(NativeData is DateTime))
            {
                return(ExtendedNativeToBackendTypeConverter.ToTimeStamp(TypeInfo, NativeData, ForExtendedQuery));
            }
            if (DateTime.MaxValue.Equals(NativeData))
            {
                return("infinity");
            }
            if (DateTime.MinValue.Equals(NativeData))
            {
                return("-infinity");
            }
            return(((DateTime)NativeData).ToString("yyyy-MM-dd HH:mm:ss.ffffff", DateTimeFormatInfo.InvariantInfo));
        }
예제 #2
0
 /// <summary>
 /// Convert to a postgresql timestamp.
 /// </summary>
 internal static byte[] ToDateTime(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean forExtendedQuery, NativeToBackendTypeConverterOptions options, bool arrayElement)
 {
     if (!(NativeData is DateTime))
     {
         return(ExtendedNativeToBackendTypeConverter.ToTimeStamp(TypeInfo, NativeData, forExtendedQuery, options, arrayElement));
     }
     if (DateTime.MaxValue.Equals(NativeData))
     {
         return(ASCIIByteArrays.INFINITY);
     }
     if (DateTime.MinValue.Equals(NativeData))
     {
         return(ASCIIByteArrays.NEG_INFINITY);
     }
     return(BackendEncoding.UTF8Encoding.GetBytes((((DateTime)NativeData).ToString("yyyy-MM-dd HH:mm:ss.ffffff", DateTimeFormatInfo.InvariantInfo))));
 }