Skip to content

Commit 39e9527

Browse files
- Interface change.
1 parent a939236 commit 39e9527

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
"replace /*+ AWAIT */ google.compute.firewalls set data__disabled = 'true' where project = 'mutable-project' and firewall = 'replacable-firewall' returning *;",
183183
"delete from aws.transfer.servers where data__ServerId = 's-0000000001' and region = 'ap-southeast-2';",
184184
"replace google.compute.firewalls set data__disabled = 'true' where project = 'mutable-project' and firewall = 'replacable-firewall' returning *;",
185+
"replace /*+ AWAIT */ google.compute.firewalls set data__disabled = 'true' where project = 'mutable-project' and firewall = 'replacable-firewall' returning *;",
185186
],
186187
"default": "show providers;"
187188
},

internal/stackql/dependencyplanner/dependencyplanner.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,7 @@ func (dp *standardDependencyPlanner) processOrphan(
408408
} else {
409409
// Persist SQL mirror table here prior to generating insert DML
410410
drmCfg := dp.handlerCtx.GetDrmConfig()
411-
// TODO: extract isAwait somehow
412-
ddl, ddlErr := drmCfg.GenerateDDL(anTab, nil, nil, nil, opStore, false, 0, false, false)
411+
ddl, ddlErr := drmCfg.GenerateDDL(anTab, nil, nil, nil, opStore, annotationCtx.IsAwait(), 0, false, false)
413412
if ddlErr != nil {
414413
return nil, nil, ddlErr
415414
}
@@ -418,7 +417,13 @@ func (dp *standardDependencyPlanner) processOrphan(
418417
return nil, nil, err
419418
}
420419
}
421-
insPsc, err := dp.primitiveComposer.GetDRMConfig().GenerateInsertDML(anTab, opStore, tcc, false)
420+
insPsc, err := dp.primitiveComposer.GetDRMConfig().GenerateInsertDML(
421+
anTab,
422+
opStore,
423+
tcc,
424+
false,
425+
annotationCtx.IsAwait(),
426+
)
422427
return insPsc, tcc, err
423428
}
424429

internal/stackql/drm/drm_cfg.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ type Config interface {
6262
anysdk.OperationStore,
6363
internaldto.TxnControlCounters,
6464
bool,
65+
bool,
6566
) (PreparedStatementCtx, error)
6667
GenerateSelectDML(
6768
util.AnnotatedTabulation,
6869
internaldto.TxnControlCounters,
6970
string,
7071
string,
72+
bool,
7173
) (PreparedStatementCtx, error)
7274
ExecuteInsertDML(sqlengine.SQLEngine, PreparedStatementCtx, map[string]interface{}, string) (sql.Result, error)
7375
OpenapiColumnsToRelationalColumns(cols []anysdk.ColumnDescriptor) []typing.RelationalColumn
@@ -542,6 +544,7 @@ func (dc *staticDRMConfig) GenerateInsertDML(
542544
method anysdk.OperationStore,
543545
tcc internaldto.TxnControlCounters,
544546
isNilResponseAlloed bool,
547+
isAsync bool,
545548
) (PreparedStatementCtx, error) {
546549
var columns []typing.ColumnMetadata
547550
_, isSQLDataSource := tabAnnotated.GetSQLDataSource()
@@ -636,6 +639,7 @@ func (dc *staticDRMConfig) GenerateSelectDML(
636639
txnCtrlCtrs internaldto.TxnControlCounters,
637640
selectSuffix,
638641
rewrittenWhere string,
642+
isAwait bool,
639643
) (PreparedStatementCtx, error) {
640644
var quotedColNames []string
641645
var columns []typing.ColumnMetadata

internal/stackql/primitivegenerator/unary_selection.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ func (pb *standardPrimitiveGenerator) assembleUnarySelectionBuilder(
7373
}
7474
ctrs := pbi.GetTxnCtrlCtrs()
7575
insPsc, err := pb.PrimitiveComposer.GetDRMConfig().GenerateInsertDML(
76-
annotatedInsertTabulation, method, ctrs, methodAnalysisOutput.IsNilResponseAllowed())
76+
annotatedInsertTabulation,
77+
method,
78+
ctrs,
79+
methodAnalysisOutput.IsNilResponseAllowed(),
80+
methodAnalysisOutput.IsAwait(),
81+
)
7782
if err != nil {
7883
return err
7984
}
@@ -117,6 +122,7 @@ func (pb *standardPrimitiveGenerator) assembleUnarySelectionBuilder(
117122
handlerCtx.GetSQLSystem(),
118123
handlerCtx.GetASTFormatter(),
119124
handlerCtx.GetNamespaceCollection()),
125+
methodAnalysisOutput.IsAwait(),
120126
)
121127
if err != nil {
122128
return err
@@ -233,13 +239,6 @@ func (pb *standardPrimitiveGenerator) analyzeUnaryAction(
233239
hIDs := internaldto.NewHeirarchyIdentifiers(
234240
rawhIDs.GetProviderStr(), rawhIDs.GetServiceStr(), itemSchemaName, strings.ToLower(publishedMethodKey))
235241

236-
// annotatedInsertTabulation := util.NewAnnotatedTabulation(insertTabulation, hIDs, inputTableName, "")
237-
238-
// ctrs := pbi.GetTxnCtrlCtrs()
239-
// insPsc, err := pb.PrimitiveComposer.GetDRMConfig().GenerateInsertDML(annotatedInsertTabulation, method, ctrs)
240-
// if err != nil {
241-
// return err
242-
// }
243242
schema, _, err := tbl.GetResponseSchemaAndMediaType()
244243
if err != nil && !methodAnalysisOutput.IsNilResponseAllowed() {
245244
return err

0 commit comments

Comments
 (0)