Exemplo n.º 1
0
        private static string GetTypeName(SqlTypeCode typeCode)
        {
            if (!IsPrimitive(typeCode))
            {
                throw new ArgumentException($"The type with code {typeCode} is not primitive");
            }

            switch (typeCode)
            {
            case SqlTypeCode.LongVarChar:
                return("LONG VARCHAR");

            case SqlTypeCode.LongVarBinary:
                return("LONG VARBINARY");

            case SqlTypeCode.YearToMonth:
                return("YEAR TO MONTH");

            case SqlTypeCode.DayToSecond:
                return("DAY TO SECOND");

            default:
                return(typeCode.ToString().ToUpperInvariant());
            }
        }
Exemplo n.º 2
0
 private string DateErrorMessage(string str, SqlTypeCode sqlType, string[] formats)
 {
     return(String.Format("The input string {0} of type {1} is not compatible with any of the formats for SQL Type {2} ( {3} )",
                          str,
                          TypeCode.ToString().ToUpperInvariant(),
                          sqlType.ToString().ToUpperInvariant(),
                          String.Join(", ", formats)));
 }
Exemplo n.º 3
0
 public TypeResolveContext(SqlTypeCode typeCode)
     : this(typeCode, typeCode.ToString().ToUpperInvariant())
 {
 }
Exemplo n.º 4
0
 private static void AssertIsInterval(SqlTypeCode sqlType)
 {
     if (!IsIntervalType(sqlType))
     {
         throw new ArgumentException(String.Format("SQL Type {0} is not a valid INTERVAL.", sqlType.ToString().ToUpperInvariant()));
     }
 }
Exemplo n.º 5
0
 public TypeResolveContext(SqlTypeCode typeCode)
     : this(typeCode, typeCode.ToString().ToUpperInvariant())
 {
 }
Exemplo n.º 6
0
 private static void AssertIsInterval(SqlTypeCode sqlType)
 {
     if (!IsIntervalType(sqlType))
         throw new ArgumentException(String.Format("SQL Type {0} is not a valid INTERVAL.", sqlType.ToString().ToUpperInvariant()));
 }
Exemplo n.º 7
0
 private string DateErrorMessage(string str, SqlTypeCode sqlType, string[] formats)
 {
     return String.Format("The input string {0} of type {1} is not compatible with any of the formats for SQL Type {2} ( {3} )",
         str,
         TypeCode.ToString().ToUpperInvariant(),
         sqlType.ToString().ToUpperInvariant(),
         String.Join(", ", formats));
 }
Exemplo n.º 8
0
 public static SqlType Resolve(SqlTypeCode typeCode, DataTypeMeta[] meta, ITypeResolver resolver)
 {
     return(Resolve(typeCode, typeCode.ToString().ToUpperInvariant(), meta, resolver));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructs the <see cref="SqlType"/> for the given specific
 /// <see cref="SqlTypeCode">SQL TYPE</see>.
 /// </summary>
 /// <remarks>
 /// This constructor will set the <see cref="Name"/> value to the equivalent
 /// of the SQL Type specified.
 /// </remarks>
 /// <param name="sqlType">The code of the SQL Type this object will represent.</param>
 protected SqlType(SqlTypeCode sqlType)
     : this(sqlType.ToString().ToUpperInvariant(), sqlType)
 {
 }