mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 03:53:21 +08:00
- 修复 DbFirst mysql/pgsql/sqlserver 获取主键失败的 bug; 0.10.7 发布后的 bug #182
This commit is contained in:
parent
90101e2d22
commit
3fe4c54ee4
@ -287,7 +287,7 @@ case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
|
|||||||
0 'IsClustered',
|
0 'IsClustered',
|
||||||
0 'IsDesc'
|
0 'IsDesc'
|
||||||
from information_schema.statistics a
|
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);
|
", loc8, databaseIn);
|
||||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||||
if (ds == null) return loc1;
|
if (ds == null) return loc1;
|
||||||
|
@ -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_attribute c on c.attnum > 0 and c.attrelid = b.oid
|
||||||
inner join pg_namespace ns on ns.oid = b.relnamespace
|
inner join pg_namespace ns on ns.oid = b.relnamespace
|
||||||
inner join pg_class d on d.oid = a.indrelid
|
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);
|
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||||
if (ds == null) return loc1;
|
if (ds == null) return loc1;
|
||||||
|
@ -257,7 +257,7 @@ case when a.index_name = 'PRIMARY' then 1 else 0 end 'IsPrimaryKey',
|
|||||||
0 'IsClustered',
|
0 'IsClustered',
|
||||||
0 'IsDesc'
|
0 'IsDesc'
|
||||||
from information_schema.statistics a
|
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);
|
", loc8, databaseIn);
|
||||||
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||||
if (ds == null) return loc1;
|
if (ds == null) return loc1;
|
||||||
|
@ -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_attribute c on c.attnum > 0 and c.attrelid = b.oid
|
||||||
inner join pg_namespace ns on ns.oid = b.relnamespace
|
inner join pg_namespace ns on ns.oid = b.relnamespace
|
||||||
inner join pg_class d on d.oid = a.indrelid
|
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);
|
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||||
if (ds == null) return loc1;
|
if (ds == null) return loc1;
|
||||||
|
@ -305,7 +305,7 @@ select
|
|||||||
from sys.index_columns a
|
from sys.index_columns a
|
||||||
inner join sys.indexes b on b.object_id = a.object_id and b.index_id = a.index_id
|
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
|
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}];
|
use [{olddatabase}];
|
||||||
";
|
";
|
||||||
|
@ -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_attribute c on c.attnum > 0 and c.attrelid = b.oid
|
||||||
inner join pg_namespace ns on ns.oid = b.relnamespace
|
inner join pg_namespace ns on ns.oid = b.relnamespace
|
||||||
inner join pg_class d on d.oid = a.indrelid
|
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);
|
ds = _orm.Ado.ExecuteArray(CommandType.Text, sql);
|
||||||
if (ds == null) return loc1;
|
if (ds == null) return loc1;
|
||||||
|
@ -308,7 +308,7 @@ select
|
|||||||
from sys.index_columns a
|
from sys.index_columns a
|
||||||
inner join sys.indexes b on b.object_id = a.object_id and b.index_id = a.index_id
|
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
|
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}];
|
use [{olddatabase}];
|
||||||
";
|
";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user