mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 修复 MySql DbFirst 获取字段未排序的问题;
This commit is contained in:
		@@ -278,14 +278,14 @@ a.column_type,
 | 
				
			|||||||
case when a.is_nullable = 'YES' then 1 else 0 end 'is_nullable',
 | 
					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',
 | 
					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'
 | 
					a.column_default 'default_value',
 | 
				
			||||||
 | 
					a.ordinal_position
 | 
				
			||||||
from information_schema.columns a
 | 
					from information_schema.columns a
 | 
				
			||||||
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
 | 
					where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
 | 
				
			||||||
";
 | 
					";
 | 
				
			||||||
            ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
 | 
					            ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
 | 
				
			||||||
            if (ds == null) return loc1;
 | 
					            if (ds == null) return loc1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var position = 0;
 | 
					 | 
				
			||||||
            foreach (var row in ds)
 | 
					            foreach (var row in ds)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                string table_id = string.Concat(row[0]);
 | 
					                string table_id = string.Concat(row[0]);
 | 
				
			||||||
@@ -299,6 +299,8 @@ where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseI
 | 
				
			|||||||
                bool is_identity = string.Concat(row[6]) == "1";
 | 
					                bool is_identity = string.Concat(row[6]) == "1";
 | 
				
			||||||
                string comment = string.Concat(row[7]);
 | 
					                string comment = string.Concat(row[7]);
 | 
				
			||||||
                string defaultValue = string.Concat(row[8]);
 | 
					                string defaultValue = string.Concat(row[8]);
 | 
				
			||||||
 | 
					                var position = int.Parse(string.Concat(row[9]));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (max_length == 0) max_length = -1;
 | 
					                if (max_length == 0) max_length = -1;
 | 
				
			||||||
                if (database.Length == 1)
 | 
					                if (database.Length == 1)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -316,7 +318,7 @@ where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseI
 | 
				
			|||||||
                    Table = loc2[table_id],
 | 
					                    Table = loc2[table_id],
 | 
				
			||||||
                    Comment = comment,
 | 
					                    Comment = comment,
 | 
				
			||||||
                    DefaultValue = defaultValue,
 | 
					                    DefaultValue = defaultValue,
 | 
				
			||||||
                    Position = ++position
 | 
					                    Position = position
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
 | 
					                loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
 | 
				
			||||||
                loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
 | 
					                loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -244,14 +244,14 @@ a.column_type,
 | 
				
			|||||||
case when a.is_nullable = 'YES' then 1 else 0 end 'is_nullable',
 | 
					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',
 | 
					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'
 | 
					a.column_default 'default_value',
 | 
				
			||||||
 | 
					a.ordinal_position
 | 
				
			||||||
from information_schema.columns a
 | 
					from information_schema.columns a
 | 
				
			||||||
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
 | 
					where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
 | 
				
			||||||
";
 | 
					";
 | 
				
			||||||
            ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
 | 
					            ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
 | 
				
			||||||
            if (ds == null) return loc1;
 | 
					            if (ds == null) return loc1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var position = 0;
 | 
					 | 
				
			||||||
            foreach (var row in ds)
 | 
					            foreach (var row in ds)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                string table_id = string.Concat(row[0]);
 | 
					                string table_id = string.Concat(row[0]);
 | 
				
			||||||
@@ -265,6 +265,8 @@ where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseI
 | 
				
			|||||||
                bool is_identity = string.Concat(row[6]) == "1";
 | 
					                bool is_identity = string.Concat(row[6]) == "1";
 | 
				
			||||||
                string comment = string.Concat(row[7]);
 | 
					                string comment = string.Concat(row[7]);
 | 
				
			||||||
                string defaultValue = string.Concat(row[8]);
 | 
					                string defaultValue = string.Concat(row[8]);
 | 
				
			||||||
 | 
					                var position = int.Parse(string.Concat(row[9]));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (max_length == 0) max_length = -1;
 | 
					                if (max_length == 0) max_length = -1;
 | 
				
			||||||
                if (database.Length == 1)
 | 
					                if (database.Length == 1)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@@ -282,7 +284,7 @@ where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseI
 | 
				
			|||||||
                    Table = loc2[table_id],
 | 
					                    Table = loc2[table_id],
 | 
				
			||||||
                    Comment = comment,
 | 
					                    Comment = comment,
 | 
				
			||||||
                    DefaultValue = defaultValue,
 | 
					                    DefaultValue = defaultValue,
 | 
				
			||||||
                    Position = ++position
 | 
					                    Position = position
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
 | 
					                loc3[table_id][column].DbType = this.GetDbType(loc3[table_id][column]);
 | 
				
			||||||
                loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
 | 
					                loc3[table_id][column].CsType = this.GetCsTypeInfo(loc3[table_id][column]);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user