Skip to content

Commit

Permalink
Add CompiledValueTable to QsiDatainsertActionNode
Browse files Browse the repository at this point in the history
  • Loading branch information
irwin-chequer committed Apr 12, 2024
1 parent 2aeaf93 commit 12bf6ee
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Qsi.PostgreSql/Analyzers/PgActionAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ protected override ColumnTarget[] ResolveColumnTargetsFromDataInsertAction(IAnal
if (!ListUtility.IsNullOrEmpty(action.Columns) || !ListUtility.IsNullOrEmpty(action.SetValues))
return base.ResolveColumnTargetsFromDataInsertAction(context, table, action);

return ResolveColumnTargetsFromTable(context, table, (PgDerivedTableNode)action.ValueTable);
return ResolveColumnTargetsFromTable(context, table, ((QsiDataInsertActionNode)action).CompiledValueTable);
}

protected ColumnTarget[] ResolveColumnTargetsFromTable(IAnalyzerContext context, QsiTableStructure table, PgDerivedTableNode valueTable)
protected ColumnTarget[] ResolveColumnTargetsFromTable(IAnalyzerContext context, QsiTableStructure table, QsiTableStructure valueTable)
{
return ResolveColumnTargetsFromTable(context, table)
.Take(valueTable.Columns.Value.Count)
.Take(valueTable.Columns.Count)
.ToArray();
}
}
1 change: 1 addition & 0 deletions Qsi/Analyzers/Action/QsiActionAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ protected virtual async ValueTask<IQsiAnalysisResult[]> ExecuteDataInsertAction(
using (var tableContext = new TableCompileContext(context))
{
table = (await tableAnalyzer.BuildTableStructure(tableContext, action.Target)).CloneVisibleOnly();
((QsiDataInsertActionNode)action).CompiledValueTable = (await tableAnalyzer.BuildTableStructure(tableContext, action.ValueTable)).CloneVisibleOnly();
}

ColumnTarget[] columnTargets = ResolveColumnTargetsFromDataInsertAction(context, table, action);
Expand Down
4 changes: 3 additions & 1 deletion Qsi/Tree.Base/Actions/QsiDataInsertActionNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class QsiDataInsertActionNode : QsiActionNode, IQsiDataInsertActionNode

public QsiTreeNodeProperty<QsiTableNode> ValueTable { get; }

public QsiTableStructure CompiledValueTable { get; set; }

public QsiDataConflictBehavior ConflictBehavior { get; set; }

public QsiTreeNodeProperty<QsiDataConflictActionNode> ConflictAction { get; }
Expand Down Expand Up @@ -54,4 +56,4 @@ public QsiDataInsertActionNode()
ValueTable = new QsiTreeNodeProperty<QsiTableNode>(this);
ConflictAction = new QsiTreeNodeProperty<QsiDataConflictActionNode>(this);
}
}
}

0 comments on commit 12bf6ee

Please sign in to comment.