Ejemplo n.º 1
0
 public virtual DbTypeInfo GetColumnDbTypeInfo(InfoRow columnRow) {
   var charSize = columnRow.GetAsLong("CHARACTER_MAXIMUM_LENGTH");
   var byteSize = columnRow.GetAsLong("CHARACTER_OCTET_LENGTH");
   long size = charSize != 0 ? charSize : byteSize; 
   var dataTypeString = columnRow.GetAsString("DATA_TYPE").ToLowerInvariant();
   var prec = (byte) columnRow.GetAsInt("NUMERIC_PRECISION");
   var scale = (byte) columnRow.GetAsInt("NUMERIC_SCALE");
   var DT_PREC = "DATETIME_PRECISION";
   if (columnRow.Table.HasColumn(DT_PREC) && columnRow[DT_PREC] != DBNull.Value) {
     var dateTimePrec = columnRow.GetAsInt(DT_PREC);
     if(prec == 0)
       prec = (byte)dateTimePrec;
   }
   var isNullStr = columnRow.GetAsString("IS_NULLABLE");
   var isNullable = (isNullStr == "YES" || isNullStr == "Y"); //Oracle->Y
   var typeInfo = Driver.TypeRegistry.GetDbTypeInfo(dataTypeString, size, prec, scale);
   return typeInfo;
 }
Ejemplo n.º 2
0
        public override DbTypeInfo GetColumnDbTypeInfo(InfoRow columnRow)
        {
            var  charSize       = columnRow.GetAsLong("CHARACTER_MAXIMUM_LENGTH");
            var  byteSize       = columnRow.GetAsLong("CHARACTER_OCTET_LENGTH");
            long size           = charSize != 0 ? charSize : byteSize;
            var  dataTypeString = columnRow.GetAsString("DATA_TYPE").ToLowerInvariant();
            var  prec           = (byte)columnRow.GetAsInt("NUMERIC_PRECISION");
            var  scale          = (byte)columnRow.GetAsInt("NUMERIC_SCALE");
            var  typeInfo       = Driver.TypeRegistry.GetDbTypeInfo(dataTypeString, size, prec, scale);

            return(typeInfo);
        }
Ejemplo n.º 3
0
        public override DbTypeInfo GetColumnDbTypeInfo(InfoRow columnRow)
        {
            // For 'unsigned' types, Data_type column does not show this attribute, but Column_type does.
            // We search matching by data_type column (and we register names with 'unsigned' included, like 'int unsigned').
            // So we just append the unsigned to data_type value, so lookup works.
            var columnType = columnRow.GetAsString("COLUMN_TYPE").ToLowerInvariant();

            if (columnType.EndsWith(" unsigned"))
            {
                columnRow["DATA_TYPE"] += " unsigned";
            }
            //auto-set memo
            var dbTypeInfo = base.GetColumnDbTypeInfo(columnRow);

            if (dbTypeInfo != null && dbTypeInfo.ClrType == typeof(string) && dbTypeInfo.Size > 100 * 1000)
            {
                dbTypeInfo.Size = -1;
            }
            return(dbTypeInfo);
        }