dotnetcore / dotnetcore/FreeSql

Oracle 数据库,DbFirst.GetTableByName() 没有返回字段信息

Open
#2,074 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.4k
Forks
910
PR merge metrics
No merged PRs in 30d

Description

#### 问题描述及重现代码:

Oracle 下 DbFirst.GetTableByName() 没有返回 Columns
```c#
IFreeSql fsql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.Oracle, "Data Source=//127.0.0.1:11521/XEPDB1;User Id=qadmin;Password=123456;Pooling=true;Min Pool Size=1")
.UseMonitorCommand(cmd => Console.WriteLine($"-- sql@{DateTime.Now:HH:mm:ss.fff} --\n{cmd.CommandText}\n---------\n"))
.Build();
var tbInfo = fsql.DbFirst.GetTableByName("qsys_user", true);
Console.WriteLine($"tbInfo.Columns.Count: {tbInfo.Columns.Count}"); // tbInfo.Columns.Count 为 0
Console.ReadLine();
```

#### 数据库版本
oracle 11gR2、oracle 21c

#### 安装的Nuget包
FreeSql.Provider.Oracle 3.5.206

#### .net framework/. net core? 及具体版本
.net 8.0

下了源码调试,定位在 **Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs** 方法 `GetTables(string[] database, string tablename, bool ignoreCase)` 图示位置:

Image

`loc2.ContainsKey(table_id)` 返回了 false。
(table_id 含有schema: "QADMIN.QSYS_USER", loc2 里存的则是 “QSYS_USER”)

(方法前侧代码有移除 schema 的操作,还没看明白)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs and the GetTables(string[] database, string tablename, bool ignoreCase) method, then run the supplied DbFirst.GetTableByName("qsys_user", true) reproduction against Oracle. Trace the table_id and loc2 values around the reported ContainsKey check; done means tbInfo.Columns contains the table’s fields for the reported Oracle versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.