- 修复 DbFirst mysql/pgsql/sqlserver 获取主键失败的 bug; 0.10.7 发布后的 bug #182

This commit is contained in:
28810 2020-01-10 22:03:47 +08:00
parent 90101e2d22
commit 3fe4c54ee4
7 changed files with 7 additions and 7 deletions

View File

@ -287,7 +287,7 @@ case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
0 'IsClustered',
0 'IsDesc'
from information_schema.statistics a
where a.table_schema in ({1}) and {0} and a.index_name <> 'PRIMARY'
where a.table_schema in ({1}) and {0}
", loc8, databaseIn);
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
if (ds == null) return loc1;

View File

@ -294,7 +294,7 @@ inner join pg_class b on b.oid = a.indexrelid
inner join pg_attribute c on c.attnum > 0 and c.attrelid = b.oid
inner join pg_namespace ns on ns.oid = b.relnamespace
inner join pg_class d on d.oid = a.indrelid
where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || d.relname")} and a.indisprimary = 'f'
where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || d.relname")}
";
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
if (ds == null) return loc1;

View File

@ -257,7 +257,7 @@ case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
0 'IsClustered',
0 'IsDesc'
from information_schema.statistics a
where a.table_schema in ({1}) and {0} and a.index_name <> 'PRIMARY'
where a.table_schema in ({1}) and {0}
", loc8, databaseIn);
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
if (ds == null) return loc1;

View File

@ -294,7 +294,7 @@ inner join pg_class b on b.oid = a.indexrelid
inner join pg_attribute c on c.attnum > 0 and c.attrelid = b.oid
inner join pg_namespace ns on ns.oid = b.relnamespace
inner join pg_class d on d.oid = a.indrelid
where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || d.relname")} and a.indisprimary = 'f'
where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || d.relname")}
";
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
if (ds == null) return loc1;

View File

@ -305,7 +305,7 @@ select
from sys.index_columns a
inner join sys.indexes b on b.object_id = a.object_id and b.index_id = a.index_id
left join sys.columns c on c.object_id = a.object_id and c.column_id = a.column_id
where {loc8.ToString().Replace("a.table_name", "a.object_id")} and b.is_primary_key = 0
where {loc8.ToString().Replace("a.table_name", "a.object_id")}
;
use [{olddatabase}];
";

View File

@ -405,7 +405,7 @@ inner join pg_class b on b.oid = a.indexrelid
inner join pg_attribute c on c.attnum > 0 and c.attrelid = b.oid
inner join pg_namespace ns on ns.oid = b.relnamespace
inner join pg_class d on d.oid = a.indrelid
where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || d.relname")} and a.indisprimary = 'f'
where {loc8.ToString().Replace("a.table_name", "ns.nspname || '.' || d.relname")}
";
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
if (ds == null) return loc1;

View File

@ -308,7 +308,7 @@ select
from sys.index_columns a
inner join sys.indexes b on b.object_id = a.object_id and b.index_id = a.index_id
left join sys.columns c on c.object_id = a.object_id and c.column_id = a.column_id
where {loc8.ToString().Replace("a.table_name", "a.object_id")} and b.is_primary_key = 0
where {loc8.ToString().Replace("a.table_name", "a.object_id")}
;
use [{olddatabase}];
";