Beispiel #1
0
        protected static bool IsTrueOrNonZero(InfoRow row, string columnName)
        {
            var value = row[columnName];

            if (value == null || value == DBNull.Value)
            {
                return(false);
            }
            var t = value.GetType();

            if (t == typeof(bool))
            {
                return((bool)value);
            }
            if (t.IsInt())
            {
                var iv = Convert.ToInt32(value);
                return(iv != 0);
            }
            if (t == typeof(string))
            {
                var sv = ((string)value).ToUpperInvariant();
                if (sv == "Y" || sv == "YES")
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        public DefectTreeNode AddChild(InfoRow child)
        {
            var childNode = new DefectTreeNode(child)
            {
                Parent = this
            };

            Children.Add(childNode);
            return(childNode);
        }
        public override DbTypeInfo GetColumnDbTypeInfo(InfoRow columnRow)
        {
            var typeInfo = base.GetColumnDbTypeInfo(columnRow);

            if (typeInfo != null && typeInfo.DbTypeSpec == "text")
            {
                typeInfo.Size = -1;
            }
            return(typeInfo);
        }
Beispiel #4
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);
        }
 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;
 }
        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);
        }
Beispiel #7
0
    //
    // Private Methods
    //

    private void Add(string key, string value)
    {
        InfoRow row;

        if (currentRow < infoRows.Count)
        {
            row = infoRows[currentRow];
            row.key.gameObject.SetActive(true);
            row.value.gameObject.SetActive(true);
        }
        else
        {
            var container = panel.transform;
            var k         = Instantiate(keyPrefab, container, false);
            var v         = Instantiate(valuePrefab, container, false);
            row = new InfoRow(k, v);
            infoRows.Add(row);
        }

        row.key.text   = key;
        row.value.text = value;

        currentRow++;
    }
Beispiel #8
0
 public DefectTreeNode(InfoRow data)
 {
     Data     = data;
     Children = new List <DefectTreeNode>();
 }
    // A chance for a driver to add vendor-specific information to the loaded column. 
    public virtual void OnColumnLoaded(DbColumnInfo column, InfoRow columnRow) {

    }