- 修复 Oracle DbFirst.GetTableByName() 没有返回字段信息;#2074

This commit is contained in:
28810
2025-07-17 16:57:05 +08:00
parent 69ef7b1add
commit 58bf5c1fda
4 changed files with 39 additions and 47 deletions

View File

@@ -339,9 +339,10 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Coun
foreach (var row in ds)
{
var table_id = string.Concat(row[0]);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
var ds2item = new object[9];
ds2item[0] = row[0];
ds2item[0] = table_id;
ds2item[1] = row[1];
ds2item[2] = Regex.Replace(string.Concat(row[2]), @"\(\d+\)", "");
ds2item[4] = CustomOracleCodeFirst.GetOracleSqlTypeFullName(new object[] { row[1], row[2], row[3], row[4], row[5], row[6] });
@@ -366,10 +367,6 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Coun
string comment = string.Concat(row[7]);
string defaultValue = string.Concat(row[8]);
if (max_length == 0) max_length = -1;
if (database.Length == 1)
{
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
}
loc3[table_id].Add(column, new DbColumnInfo
{
Name = column,
@@ -414,15 +411,14 @@ and {(ignoreCase ? "lower(a.table_owner)" : "a.table_owner")} in ({databaseIn}){
foreach (var row in ds)
{
string table_id = string.Concat(row[0]);
if (!loc2.ContainsKey(table_id)) continue;
string column = string.Concat(row[1]).Trim('"');
string index_id = string.Concat(row[2]);
bool is_unique = string.Concat(row[3]) == "1";
bool is_primary_key = string.Concat(row[4]) == "1";
bool is_clustered = string.Concat(row[5]) == "1";
bool is_desc = string.Concat(row[6]) == "1";
if (database.Length == 1)
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc9.IsPrimary == false && is_primary_key) loc9.IsPrimary = is_primary_key;
@@ -503,7 +499,6 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Count
foreach (var row in ds)
{
string table_id = string.Concat(row[0]);
if (!loc2.ContainsKey(table_id)) continue;
string column = string.Concat(row[1]);
string fk_id = string.Concat(row[2]);
string ref_table_id = string.Concat(row[3]);
@@ -514,9 +509,11 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Count
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
ref_table_id = ref_table_id.Substring(ref_table_id.IndexOf('.') + 1);
}
if (!loc2.ContainsKey(table_id)) continue;
if (!loc2.ContainsKey(ref_table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
if (loc3.ContainsKey(ref_table_id) == false || loc3[ref_table_id].ContainsKey(referenced_column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc2.ContainsKey(ref_table_id) == false) continue;
var loc10 = loc2[ref_table_id];
var loc11 = loc3[ref_table_id][referenced_column];

View File

@@ -371,8 +371,11 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}) and {loc8}
var ds2 = new List<object[]>();
foreach (var row in ds)
{
var table_id = string.Concat(row[0]);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
var ds2item = new object[9];
ds2item[0] = row[0];
ds2item[0] = table_id;
ds2item[1] = row[1];
ds2item[2] = Regex.Replace(string.Concat(row[2]), @"\(\d+\)", "");
ds2item[4] = DamengCodeFirst.GetDamengSqlTypeFullName(new object[] { row[1], row[2], row[3], row[4], row[5], row[6] });
@@ -397,10 +400,6 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}) and {loc8}
string comment = string.Concat(row[7]);
string defaultValue = string.Concat(row[8]);
if (max_length == 0) max_length = -1;
if (database.Length == 1)
{
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
}
loc3[table_id].Add(column, new DbColumnInfo
{
Name = column,
@@ -450,8 +449,8 @@ and {(ignoreCase ? "lower(a.table_owner)" : "a.table_owner")} in ({databaseIn})
bool is_primary_key = string.Concat(row[4]) == "1";
bool is_clustered = string.Concat(row[5]) == "1";
bool is_desc = string.Concat(row[6]) == "1";
if (database.Length == 1)
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc9.IsPrimary == false && is_primary_key) loc9.IsPrimary = is_primary_key;
@@ -513,15 +512,15 @@ all_constraints b,
all_cons_columns c, --外键表
all_cons_columns d --主键表
where
a.r_constraint_name = b.constraint_name
and a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_owner = b.owner
and a.constraint_name = c.constraint_name
and b.constraint_name = d.constraint_name
and a.owner = c.owner
and a.table_name = c.table_name
and b.owner = d.owner
a.r_constraint_name = b.constraint_name   
and a.constraint_type = 'R'   
and b.constraint_type = 'P'   
and a.r_owner = b.owner   
and a.constraint_name = c.constraint_name   
and b.constraint_name = d.constraint_name   
and a.owner = c.owner   
and a.table_name = c.table_name   
and b.owner = d.owner   
and b.table_name = d.table_name
and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}) and {loc8}
";
@@ -542,9 +541,11 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}) and {loc8}
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
ref_table_id = ref_table_id.Substring(ref_table_id.IndexOf('.') + 1);
}
if (!loc2.ContainsKey(table_id)) continue;
if (!loc2.ContainsKey(ref_table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
if (loc3.ContainsKey(ref_table_id) == false || loc3[ref_table_id].ContainsKey(referenced_column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc2.ContainsKey(ref_table_id) == false) continue;
var loc10 = loc2[ref_table_id];
var loc11 = loc3[ref_table_id][referenced_column];

View File

@@ -340,9 +340,10 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Coun
foreach (var row in ds)
{
var table_id = string.Concat(row[0]);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
var ds2item = new object[9];
ds2item[0] = row[0];
ds2item[0] = table_id;
ds2item[1] = row[1];
ds2item[2] = Regex.Replace(string.Concat(row[2]), @"\(\d+\)", "");
ds2item[4] = OdbcOracleCodeFirst.GetOracleSqlTypeFullName(new object[] { row[1], row[2], row[3], row[4], row[5], row[6] });
@@ -367,10 +368,6 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Coun
string comment = string.Concat(row[7]);
string defaultValue = string.Concat(row[8]);
if (max_length == 0) max_length = -1;
if (database.Length == 1)
{
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
}
loc3[table_id].Add(column, new DbColumnInfo
{
Name = column,
@@ -415,15 +412,14 @@ and {(ignoreCase ? "lower(a.table_owner)" : "a.table_owner")} in ({databaseIn}){
foreach (var row in ds)
{
string table_id = string.Concat(row[0]);
if (!loc2.ContainsKey(table_id)) continue;
string column = string.Concat(row[1]).Trim('"');
string index_id = string.Concat(row[2]);
bool is_unique = string.Concat(row[3]) == "1";
bool is_primary_key = string.Concat(row[4]) == "1";
bool is_clustered = string.Concat(row[5]) == "1";
bool is_desc = string.Concat(row[6]) == "1";
if (database.Length == 1)
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc9.IsPrimary == false && is_primary_key) loc9.IsPrimary = is_primary_key;
@@ -504,7 +500,6 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Count
foreach (var row in ds)
{
string table_id = string.Concat(row[0]);
if (!loc2.ContainsKey(table_id)) continue;
string column = string.Concat(row[1]);
string fk_id = string.Concat(row[2]);
string ref_table_id = string.Concat(row[3]);
@@ -515,9 +510,11 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Count
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
ref_table_id = ref_table_id.Substring(ref_table_id.IndexOf('.') + 1);
}
if (!loc2.ContainsKey(table_id)) continue;
if (!loc2.ContainsKey(ref_table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
if (loc3.ContainsKey(ref_table_id) == false || loc3[ref_table_id].ContainsKey(referenced_column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc2.ContainsKey(ref_table_id) == false) continue;
var loc10 = loc2[ref_table_id];
var loc11 = loc3[ref_table_id][referenced_column];

View File

@@ -437,9 +437,10 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Coun
foreach (var row in ds)
{
var table_id = string.Concat(row[0]);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
var ds2item = new object[9];
ds2item[0] = row[0];
ds2item[0] = table_id;
ds2item[1] = row[1];
ds2item[2] = Regex.Replace(string.Concat(row[2]), @"\(\d+\)", "");
ds2item[4] = OracleCodeFirst.GetOracleSqlTypeFullName(new object[] { row[1], row[2], row[3], row[4], row[5], row[6] });
@@ -464,10 +465,6 @@ where {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Coun
string comment = string.Concat(row[7]);
string defaultValue = string.Concat(row[8]);
if (max_length == 0) max_length = -1;
if (database.Length == 1)
{
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
}
loc3[table_id].Add(column, new DbColumnInfo
{
Name = column,
@@ -512,15 +509,14 @@ and {(ignoreCase ? "lower(a.table_owner)" : "a.table_owner")} in ({databaseIn}){
foreach (var row in ds)
{
string table_id = string.Concat(row[0]);
if (!loc2.ContainsKey(table_id)) continue;
string column = string.Concat(row[1]).Trim('"');
string index_id = string.Concat(row[2]);
bool is_unique = string.Concat(row[3]) == "1";
bool is_primary_key = string.Concat(row[4]) == "1";
bool is_clustered = string.Concat(row[5]) == "1";
bool is_desc = string.Concat(row[6]) == "1";
if (database.Length == 1)
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (database.Length == 1) table_id = table_id.Substring(table_id.IndexOf('.') + 1);
if (!loc2.ContainsKey(table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc9.IsPrimary == false && is_primary_key) loc9.IsPrimary = is_primary_key;
@@ -601,7 +597,6 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Count
foreach (var row in ds)
{
string table_id = string.Concat(row[0]);
if (!loc2.ContainsKey(table_id)) continue;
string column = string.Concat(row[1]);
string fk_id = string.Concat(row[2]);
string ref_table_id = string.Concat(row[3]);
@@ -612,9 +607,11 @@ and {(ignoreCase ? "lower(a.owner)" : "a.owner")} in ({databaseIn}){(loc2.Count
table_id = table_id.Substring(table_id.IndexOf('.') + 1);
ref_table_id = ref_table_id.Substring(ref_table_id.IndexOf('.') + 1);
}
if (!loc2.ContainsKey(table_id)) continue;
if (!loc2.ContainsKey(ref_table_id)) continue;
if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue;
if (loc3.ContainsKey(ref_table_id) == false || loc3[ref_table_id].ContainsKey(referenced_column) == false) continue;
var loc9 = loc3[table_id][column];
if (loc2.ContainsKey(ref_table_id) == false) continue;
var loc10 = loc2[ref_table_id];
var loc11 = loc3[ref_table_id][referenced_column];