-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
# 개요 - Row에 서브쿼리가 포함될 경우, 서브쿼리 정보를 `QsiTableStructure`에 담아 `IAnalysisResult`에서 제공합니다. # 변경사항 ## 주요 변경사항 - `ITableStructureCache` 인터페이스를 통해, 키에 해당하는 `QsiTableStructure` 리스트를 반환합니다. - `QsiDataManipulationResult` 및 `QsiExplainDataManipulationResult`에 `TablesInRows`를 추가합니다. - 해당 프로퍼티를 통해 Row에 존재하는 서브쿼리 정보를 전달하게 됩니다. - `QsiActionAnalyzer`에서 Row 내에 서브쿼리가 존재할 경우, 이를 습득하여 `QsiTableStructure`로 전환하고 이를 결과로 제공합니다. - Insert 문의 경우, 모든 Row를 순회하며 서브쿼리를 해당 컨텍스트의 cache에 담습니다. - 이후 결과를 반환할 때 cache에 담긴 모든 테이블을 반환합니다. - Update 문의 경우, 역시 Row를 순회하며 서브쿼리를 임시 리스트에 저장 후 결과 반환 시 리스트의 테이블들을 반환합니다. ## 기타 변경사항 - 추가: 디버거에서 `QsiExplainDanaManipulationResult`의 `TablesInRows` 프로퍼티에 존재하는 테이블들을 볼 수 있도록 기능을 추가했습니다. - 수정: Expression 내에 존재하는 서브쿼리들을 리스트로 flatten하여 가져오는 CollectSubqueries 함수를 inner function에서 private 메서드로 변경했습니다. # 스크린샷 <img width="2672" alt="image" src="https://github.com/chequer-io/qsi/assets/43464986/568c4e40-0d80-4670-a147-5769eeff35e1"> <img width="2672" alt="image" src="https://github.com/chequer-io/qsi/assets/43464986/738318a8-7f33-4d22-a8b5-f2eb76035e36"> # 이슈 QP-6629
- Loading branch information
1 parent
59d0f2a
commit 95d8ca0
Showing
8 changed files
with
219 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Collections.Generic; | ||
using Qsi.Analyzers.Action.Models; | ||
using Qsi.Data; | ||
|
||
namespace Qsi.Analyzers.Action.Cache; | ||
|
||
public class DmlTableStructureCache : ITableStructureCache<DataManipulationTarget> | ||
{ | ||
private readonly Dictionary<DataManipulationTarget, List<QsiTableStructure>> _cache = new(); | ||
|
||
public void Add(DataManipulationTarget key, QsiTableStructure table) | ||
{ | ||
if (_cache.TryGetValue(key, out List<QsiTableStructure> value)) | ||
{ | ||
value.Add(table); | ||
return; | ||
} | ||
|
||
_cache[key] = new List<QsiTableStructure> { table }; | ||
} | ||
|
||
public void AddRange(DataManipulationTarget key, IEnumerable<QsiTableStructure> tables) | ||
{ | ||
if (_cache.TryGetValue(key, out List<QsiTableStructure> value)) | ||
{ | ||
value.AddRange(tables); | ||
return; | ||
} | ||
|
||
_cache[key] = new List<QsiTableStructure>(tables); | ||
} | ||
|
||
public ICollection<QsiTableStructure> Get(DataManipulationTarget key) | ||
{ | ||
return _cache[key]; | ||
} | ||
|
||
public void Clear() | ||
{ | ||
_cache.Clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Generic; | ||
using Qsi.Data; | ||
|
||
namespace Qsi.Analyzers.Action.Cache; | ||
|
||
/// <summary> | ||
/// 사용된 서브쿼리를 분석한 Table Structure 리스트를 캐싱하는 인터페이스입니다. | ||
/// </summary> | ||
public interface ITableStructureCache<in T> | ||
{ | ||
/// <summary> | ||
/// T에 해당하는 Table Structure를 추가합니다. | ||
/// </summary> | ||
/// <param name="key">캐시를 저장할 키 값입니다.</param> | ||
/// <param name="table">캐싱할 테이블입니다.</param> | ||
void Add(T key, QsiTableStructure table); | ||
|
||
/// <summary> | ||
/// T에 해당하는 Table Structure 목록을 추가합니다. | ||
/// </summary> | ||
/// <param name="key">캐시를 저장할 키 값입니다.</param> | ||
/// <param name="tables">캐싱할 테이블 목록입니다.</param> | ||
void AddRange(T key, IEnumerable<QsiTableStructure> tables); | ||
|
||
/// <summary> | ||
/// T에 해당하는 Table Structure 목록을 가져옵니다. | ||
/// </summary> | ||
/// <param name="key">목록을 식별할 수 있는 키 값입니다.</param> | ||
/// <returns>Table Structure 목록입니다.</returns> | ||
ICollection<QsiTableStructure> Get(T key); | ||
|
||
/// <summary> | ||
/// 캐시를 초기화합니다. | ||
/// </summary> | ||
void Clear(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters