Esempio n. 1
0
 internal static string DataTypeDetail(SchemaDataSet.ColumnsRow columnsRow)
 {
     StringBuilder dataTypeStringBuilder = new StringBuilder();
     if (!c_fixedSizeDataTypes.Contains(columnsRow.DATA_TYPE.ToLowerInvariant()))
     {
         if (!columnsRow.IsCHARACTER_MAXIMUM_LENGTHNull())
         {
             dataTypeStringBuilder.AppendFormat("({0})", columnsRow.CHARACTER_MAXIMUM_LENGTH == -1 ? "MAX" : columnsRow.CHARACTER_MAXIMUM_LENGTH.ToString());
         }
         else
         {
             if (!columnsRow.IsNUMERIC_PRECISIONNull())
             {
                 if (!columnsRow.IsNUMERIC_SCALENull())
                 {
                     dataTypeStringBuilder.AppendFormat("({0}, {1})", columnsRow.NUMERIC_PRECISION, columnsRow.NUMERIC_SCALE);
                 }
                 else
                 {
                     dataTypeStringBuilder.AppendFormat("({0})", columnsRow.NUMERIC_PRECISION);
                 }
             }
             else
             {
                 throw new InvalidOperationException("Don't know how to create the detail for this data type");
             }
         }
     }
     return dataTypeStringBuilder.ToString();
 }
 private static bool ColumnsMatch(SchemaDataSet.ColumnsRow columnRow1, SchemaDataSet.ColumnsRow columnRow2)
 {
     if (columnRow1.IsDATA_TYPENull() != columnRow2.IsDATA_TYPENull()
         || (!columnRow1.IsDATA_TYPENull() && !columnRow2.IsDATA_TYPENull()
             && !columnRow1.DATA_TYPE.Equals(columnRow2.DATA_TYPE, StringComparison.OrdinalIgnoreCase))
         )
     {
         return false;
     }
     if (columnRow1.IsCHARACTER_MAXIMUM_LENGTHNull() != columnRow2.IsCHARACTER_MAXIMUM_LENGTHNull()
         || (!columnRow1.IsCHARACTER_MAXIMUM_LENGTHNull() && !columnRow2.IsCHARACTER_MAXIMUM_LENGTHNull()
             && columnRow1.CHARACTER_MAXIMUM_LENGTH != columnRow2.CHARACTER_MAXIMUM_LENGTH)
         )
     {
         return false;
     }
     if (columnRow1.IsNUMERIC_PRECISIONNull() != columnRow2.IsNUMERIC_PRECISIONNull()
         || (!columnRow1.IsNUMERIC_PRECISIONNull() && !columnRow2.IsNUMERIC_PRECISIONNull()
             && columnRow1.NUMERIC_PRECISION != columnRow2.NUMERIC_PRECISION)
         )
     {
         return false;
     }
     if (columnRow1.IsNUMERIC_PRECISION_RADIXNull() != columnRow2.IsNUMERIC_PRECISION_RADIXNull()
         || (!columnRow1.IsNUMERIC_PRECISION_RADIXNull() && !columnRow2.IsNUMERIC_PRECISION_RADIXNull()
             && columnRow1.NUMERIC_PRECISION_RADIX != columnRow2.NUMERIC_PRECISION_RADIX)
         )
     {
         return false;
     }
     if (columnRow1.IsNUMERIC_SCALENull() != columnRow2.IsNUMERIC_SCALENull()
         || (!columnRow1.IsNUMERIC_SCALENull() && !columnRow2.IsNUMERIC_SCALENull()
             && columnRow1.NUMERIC_SCALE != columnRow2.NUMERIC_SCALE)
         )
     {
         return false;
     }
     if (columnRow1.IsDATETIME_PRECISIONNull() != columnRow2.IsDATETIME_PRECISIONNull()
         || (!columnRow1.IsDATETIME_PRECISIONNull() && !columnRow2.IsDATETIME_PRECISIONNull()
             && columnRow1.DATETIME_PRECISION != columnRow2.DATETIME_PRECISION)
         )
     {
         return false;
     }
     if (columnRow1.IsCHARACTER_OCTET_LENGTHNull() != columnRow2.IsCHARACTER_OCTET_LENGTHNull()
         || (!columnRow1.IsCHARACTER_OCTET_LENGTHNull() && !columnRow2.IsCHARACTER_OCTET_LENGTHNull()
             && columnRow1.CHARACTER_OCTET_LENGTH != columnRow2.CHARACTER_OCTET_LENGTH)
         )
     {
         return false;
     }
     return true;
 }