use of io.jans.orm.cloud.spanner.model.ValueWithStructField in project jans by JanssenProject.
the class SpannerOperationServiceImpl method applyParametersBinding.
private void applyParametersBinding(Statement.Builder builder, ConvertedExpression expression) throws IncompatibleTypeException {
if (expression == null) {
return;
}
Map<String, ValueWithStructField> queryParameters = expression.queryParameters();
for (Entry<String, ValueWithStructField> queryParameterEntry : queryParameters.entrySet()) {
String attributeName = queryParameterEntry.getKey();
ValueWithStructField valueWithStructField = queryParameterEntry.getValue();
ValueBinder<Builder> valueBinder = builder.bind(attributeName);
setMutationBuilderValue(valueBinder, valueWithStructField.getStructField(), true, valueWithStructField.getValue());
}
}
use of io.jans.orm.cloud.spanner.model.ValueWithStructField in project jans by JanssenProject.
the class SpannerFilterConverter method buildVariableExpression.
private Expression buildVariableExpression(TableMapping tableMapping, String attributeName, Object attribyteValue, Map<String, ValueWithStructField> queryParameters) throws SearchException {
StructField structField = getStructField(tableMapping, attributeName);
String usedAttributeName = attributeName;
int idx = 0;
while (queryParameters.containsKey(usedAttributeName) && (idx < 100)) {
usedAttributeName = attributeName + Integer.toString(idx++);
}
queryParameters.put(usedAttributeName, new ValueWithStructField(attribyteValue, structField));
return new UserVariable(usedAttributeName);
}
use of io.jans.orm.cloud.spanner.model.ValueWithStructField in project jans by JanssenProject.
the class SpannerFilterConverter method convertToSqlFilter.
public ConvertedExpression convertToSqlFilter(TableMapping tableMapping, Filter genericFilter, Map<String, PropertyAnnotation> propertiesAnnotationsMap, Function<? super Filter, Boolean> processor, boolean skipAlias) throws SearchException {
Map<String, ValueWithStructField> queryParameters = new HashMap<>();
Map<String, Join> joinTables = new HashMap<>();
ConvertedExpression convertedExpression = convertToSqlFilterImpl(tableMapping, genericFilter, propertiesAnnotationsMap, queryParameters, joinTables, processor, skipAlias);
return convertedExpression;
}
Aggregations