Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/Runtime/XSharp.Core/RDD/DbcSupport.prg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System.Collections.Generic
USING System.Diagnostics
USING XSharp.RDD.Support
Expand Down Expand Up @@ -310,7 +311,24 @@ BEGIN NAMESPACE XSharp.RDD

/// <include file="XSharp.Core.Docs.xml" path="doc/DbcDatabase.FindTable/*" />
PUBLIC METHOD FindTable(cTable as STRING) AS DbcTable
RETURN SELF:FindObject(SELF:_tables, cTable)
// Primary lookup by OBJECTNAME (logical alias)
IF _tables:TryGetValue(cTable, OUT VAR oTable)
oTable:GetData()
RETURN oTable
ENDIF
// Fallback: match by physical filename from the Path property.
// Handles cases where the logical name (OBJECTNAME) differs from the filename,
// e.g. "tblstorage_area" (OBJECTNAME) vs "tblstorage area.dbf" (real file).
FOREACH VAR t IN _tables:Values
VAR path := t:Path
IF ! String.IsNullOrEmpty(path)
IF String.Compare(System.IO.Path.GetFileNameWithoutExtension(path), cTable, TRUE) == 0
t:GetData()
RETURN t
ENDIF
ENDIF
NEXT
RETURN NULL

/// <include file="XSharp.Core.Docs.xml" path="doc/DbcDatabase.FindView/*" />
PUBLIC METHOD FindView(cView as STRING) AS DbcView
Expand Down
Loading