Merge branch 'foc-imports'

This commit is contained in:
rob bygrave
2020-02-01 13:18:55 +13:00
6 changed files with 12 additions and 8 deletions
@@ -13,6 +13,9 @@ import java.io.IOException;
*/
public interface SpiExpression extends Expression {
static final String SQL_TRUE = "1=1";
static final String SQL_FALSE = "1=0";
/**
* Simplify nested expressions if possible.
*/
@@ -202,7 +202,7 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
public void addSql(SpiExpressionRequest request) {
if (list.isEmpty()) {
request.append("1=1");
request.append(SQL_TRUE);
} else {
request.append("(");
for (int i = 0; i < list.size(); i++) {
@@ -74,7 +74,9 @@ public class IdInExpression extends NonPrepareExpression {
@Override
public void addBindValues(SpiExpressionRequest request) {
if (idCollection.isEmpty()) {
return;
}
// Bind the Id values including EmbeddedId and multiple Id
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
@@ -92,7 +94,7 @@ public class IdInExpression extends NonPrepareExpression {
BeanDescriptor<?> descriptor = r.getBeanDescriptor();
IdBinder idBinder = descriptor.getIdBinder();
if (idCollection.isEmpty()) {
request.append("1=0"); // append false for this stage
request.append(SQL_FALSE); // append false for this stage
} else {
request.append(descriptor.getIdBinder().getBindIdInSql(null));
String inClause = idBinder.getIdInValueExpr(false, idCollection.size());
@@ -107,7 +109,7 @@ public class IdInExpression extends NonPrepareExpression {
BeanDescriptor<?> descriptor = r.getBeanDescriptor();
IdBinder idBinder = descriptor.getIdBinder();
if (idCollection.isEmpty()) {
request.append("1=0"); // append false for this stage
request.append(SQL_FALSE); // append false for this stage
} else {
request.append(descriptor.getIdBinderInLHSSql());
String inClause = idBinder.getIdInValueExpr(false, idCollection.size());
@@ -17,8 +17,7 @@ import java.util.List;
class InExpression extends AbstractExpression {
private static final String SQL_TRUE = "1=1";
private static final String SQL_FALSE = "1=0";
private final boolean not;
@@ -93,7 +93,7 @@ class InPairsExpression extends AbstractExpression {
public void addSql(SpiExpressionRequest request) {
if (entries.isEmpty()) {
String expr = not ? "1=1" : "1=0";
String expr = not ? SQL_TRUE : SQL_FALSE;
request.append(expr);
return;
}
@@ -76,7 +76,7 @@ class NoopExpression implements SpiExpression {
@Override
public void addSql(SpiExpressionRequest request) {
request.append("1=1");
request.append(SQL_TRUE);
}
@Override