Skip to content

Commit

Permalink
- 修复 MySql 8.0 索引 DESC 的判断;#1664
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 14, 2023
1 parent a4dca34 commit 7180cdd
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ from information_schema.columns a
select
a.column_name,
a.index_name 'index_id',
0 'IsDesc',
case when a.collation = 'D' then 1 else 0 end 'IsDesc',
case when a.non_unique = 0 then 1 else 0 end 'IsUnique'
from information_schema.statistics a
where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRIMARY'", tboldname ?? tbname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ from information_schema.columns a
case when a.non_unique = 0 then 1 else 0 end 'IsUnique',
case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
0 'IsClustered',
0 'IsDesc'
case when a.collation = 'D' then 1 else 0 end 'IsDesc'
from information_schema.statistics a
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
";
Expand Down
2 changes: 1 addition & 1 deletion Providers/FreeSql.Provider.MySql/MySqlCodeFirst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ from information_schema.columns a
select
a.column_name,
a.index_name 'index_id',
0 'IsDesc',
case when a.collation = 'D' then 1 else 0 end 'IsDesc',
case when a.non_unique = 0 then 1 else 0 end 'IsUnique'
from information_schema.statistics a
where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRIMARY'", tboldname ?? tbname);
Expand Down
2 changes: 1 addition & 1 deletion Providers/FreeSql.Provider.MySql/MySqlDbFirst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ from information_schema.columns a
case when a.non_unique = 0 then 1 else 0 end 'IsUnique',
case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
0 'IsClustered',
0 'IsDesc'
case when a.collation = 'D' then 1 else 0 end 'IsDesc'
from information_schema.statistics a
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ from information_schema.columns a
select
a.column_name,
a.index_name 'index_id',
0 'IsDesc',
case when a.collation = 'D' then 1 else 0 end 'IsDesc',
case when a.non_unique = 0 then 1 else 0 end 'IsUnique'
from information_schema.statistics a
where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRIMARY'", tboldname ?? tbname);
Expand Down
2 changes: 1 addition & 1 deletion Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlDbFirst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ from information_schema.columns a
case when a.non_unique = 0 then 1 else 0 end 'IsUnique',
case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
0 'IsClustered',
0 'IsDesc'
case when a.collation = 'D' then 1 else 0 end 'IsDesc'
from information_schema.statistics a
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
";
Expand Down

0 comments on commit 7180cdd

Please sign in to comment.