예제 #1
0
        public override TableField TableField(ResultRow field)
        {
            TableField tableField = new TableField()
            {
                Name    = field.GetString("COLUMN_NAME"),
                Type    = ParseType(field.GetString("DATA_TYPE")),
                NotNull = !field.GetString("IS_NULLABLE").Equals("YES"),
                //Key = ParseKey(field.GetString("Key")),  ???
                DefaultValue = field["COLUMN_DEFAULT"],
                //Unsigned = field.GetString("Type").Split(' ').Contains("unsigned"),
                //Zerofill = field.GetString("Type").Split(' ').Contains("zerofill"),
                //AutoIncrement = field.GetString("Extra").Split(' ').Contains("auto_increment"),
                Length = field.GetInteger("CHARACTER_MAXIMUM_LENGTH", 0)
            };

            return(tableField);
        }
예제 #2
0
        public override TableField TableField(ResultRow field)
        {
            TableField tableField = new TableField()
            {
                Name          = field.GetString("name"),
                Type          = ParseType(field.GetString("type")),
                NotNull       = field.GetInteger("notnull") != 0,
                Key           = field.GetInteger("pk") == 1 ? KeyType.Primary : KeyType.None,
                DefaultValue  = field["dflt_value"],
                Unsigned      = field.GetString("type").Split(' ').Contains("unsigned"),
                Zerofill      = field.GetString("type").Split(' ').Contains("zerofill"),
                AutoIncrement = false
            };

            if (field.GetString("type").Split('(').Length > 1)
            {
                int closingPar = field.GetString("type").Split('(')[1].IndexOf(')');
                tableField.Length = int.Parse(field.GetString("type").Split('(')[1].Substring(0, closingPar));
            }

            return(tableField);
        }