Skip to content

Commit 7180cdd

Browse files
committed
- 修复 MySql 8.0 索引 DESC 的判断;#1664
1 parent a4dca34 commit 7180cdd

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

Providers/FreeSql.Provider.Custom/MySql/CustomMySqlCodeFirst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ from information_schema.columns a
256256
select
257257
a.column_name,
258258
a.index_name 'index_id',
259-
0 'IsDesc',
259+
case when a.collation = 'D' then 1 else 0 end 'IsDesc',
260260
case when a.non_unique = 0 then 1 else 0 end 'IsUnique'
261261
from information_schema.statistics a
262262
where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRIMARY'", tboldname ?? tbname);

Providers/FreeSql.Provider.Custom/MySql/CustomMySqlDbFirst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ from information_schema.columns a
299299
case when a.non_unique = 0 then 1 else 0 end 'IsUnique',
300300
case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
301301
0 'IsClustered',
302-
0 'IsDesc'
302+
case when a.collation = 'D' then 1 else 0 end 'IsDesc'
303303
from information_schema.statistics a
304304
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
305305
";

Providers/FreeSql.Provider.MySql/MySqlCodeFirst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ from information_schema.columns a
267267
select
268268
a.column_name,
269269
a.index_name 'index_id',
270-
0 'IsDesc',
270+
case when a.collation = 'D' then 1 else 0 end 'IsDesc',
271271
case when a.non_unique = 0 then 1 else 0 end 'IsUnique'
272272
from information_schema.statistics a
273273
where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRIMARY'", tboldname ?? tbname);

Providers/FreeSql.Provider.MySql/MySqlDbFirst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ from information_schema.columns a
332332
case when a.non_unique = 0 then 1 else 0 end 'IsUnique',
333333
case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
334334
0 'IsClustered',
335-
0 'IsDesc'
335+
case when a.collation = 'D' then 1 else 0 end 'IsDesc'
336336
from information_schema.statistics a
337337
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
338338
";

Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlCodeFirst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ from information_schema.columns a
257257
select
258258
a.column_name,
259259
a.index_name 'index_id',
260-
0 'IsDesc',
260+
case when a.collation = 'D' then 1 else 0 end 'IsDesc',
261261
case when a.non_unique = 0 then 1 else 0 end 'IsUnique'
262262
from information_schema.statistics a
263263
where a.table_schema IN ({0}) and a.table_name IN ({1}) and a.index_name <> 'PRIMARY'", tboldname ?? tbname);

Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlDbFirst.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ from information_schema.columns a
298298
case when a.non_unique = 0 then 1 else 0 end 'IsUnique',
299299
case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
300300
0 'IsClustered',
301-
0 'IsDesc'
301+
case when a.collation = 'D' then 1 else 0 end 'IsDesc'
302302
from information_schema.statistics a
303303
where {(ignoreCase ? "lower(a.table_schema)" : "a.table_schema")} in ({databaseIn}) and {loc8}
304304
";

0 commit comments

Comments
 (0)