- 增加 DbFirst 获取字段的默认值信息;

This commit is contained in:
28810
2020-04-13 19:00:22 +08:00
parent 44638a1e97
commit 5e336a0173
13 changed files with 110 additions and 26 deletions

View File

@ -238,7 +238,8 @@ ifnull(a.character_maximum_length, 0) 'len',
a.column_type,
case when a.is_nullable = 'YES' then 1 else 0 end 'is_nullable',
case when locate('auto_increment', a.extra) > 0 then 1 else 0 end 'is_identity',
a.column_comment 'comment'
a.column_comment 'comment',
a.column_default 'default_value'
from information_schema.columns a
where a.table_schema in ({1}) and {0}
", loc8, databaseIn);
@ -257,6 +258,7 @@ where a.table_schema in ({1}) and {0}
bool is_nullable = string.Concat(row[5]) == "1";
bool is_identity = string.Concat(row[6]) == "1";
string comment = string.Concat(row[7]);
string defaultValue = string.Concat(row[8]);
if (max_length == 0) max_length = -1;
if (database.Length == 1)
{
@ -272,7 +274,8 @@ where a.table_schema in ({1}) and {0}
DbTypeText = type,
DbTypeTextFull = sqlType,
Table = loc2[table_id],
Coment = comment
Coment = comment,
DefaultValue = defaultValue
});
loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);