Skip to content

Commit

Permalink
Merge pull request #3597 from DedunuKarunarathne/ds-sql
Browse files Browse the repository at this point in the history
Add the original SQL query to the data service OMElement
  • Loading branch information
DedunuKarunarathne authored Sep 10, 2024
2 parents 2fab2c2 + c2e13eb commit ff9b535
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public abstract class ExpressionQuery extends Query {

private String query;

private String originalQuery;

private List<String> namedParamNames;

private int paramCount;
Expand All @@ -57,12 +59,17 @@ public ExpressionQuery(DataService dataService, String queryId, List<QueryParam>
super(dataService, queryId, queryParams, result, configId, inputEventTrigger, outputEventTrigger,
advancedProperties, inputNamespace);
this.query = query;
this.originalQuery = query;
}

public String getQuery() {
return query;
}

public String getOriginalQuery() {
return originalQuery;
}

public int getParamCount() {
return paramCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static void serializeAdvancedProps(Query query, OMElement queryEl, OMFac

private static void serializeSQLQueryProps(SQLQuery sqlQuery, OMElement queryEl, OMFactory fac) {
OMElement sqlEl = fac.createOMElement(new QName(DBSFields.SQL));
sqlEl.setText(sqlQuery.getQuery());
sqlEl.setText(sqlQuery.getOriginalQuery());
queryEl.addChild(sqlEl);
if (sqlQuery.isReturnGeneratedKeys()) {
queryEl.addAttribute(DBSFields.RETURN_GENERATED_KEYS, Boolean.TRUE.toString(), null);
Expand Down Expand Up @@ -310,7 +310,7 @@ private static void serializeQueryParams(List<QueryParam> queryParams,
}
defaultValue = queryParam.getDefaultValue();
if (defaultValue != null && defaultValue.getScalarValue() != null) {
queryParamEl.addAttribute(DBSFields.ORDINAL, defaultValue.getScalarValue(), null);
queryParamEl.addAttribute(DBSFields.DEFAULT_VALUE, defaultValue.getScalarValue(), null);
}
/* add validators */
serializeValidators(queryParam.getValidators(), queryParamEl, fac);
Expand Down

0 comments on commit ff9b535

Please sign in to comment.