[SQL Generator] add some operations
This commit is contained in:
parent
7a1a943f66
commit
cf088e27cc
1 changed files with 4 additions and 0 deletions
|
@ -49,12 +49,16 @@ public class MySQLRequestBuilder{
|
||||||
BiValue bool = (BiValue)value;
|
BiValue bool = (BiValue)value;
|
||||||
String action = bool.getAction();
|
String action = bool.getAction();
|
||||||
if(action.equals("||")) return toStringCondition(bool.left())+" OR "+toStringCondition(bool.right());
|
if(action.equals("||")) return toStringCondition(bool.left())+" OR "+toStringCondition(bool.right());
|
||||||
|
if(action.equals("&&")) return toStringCondition(bool.left())+" AND "+toStringCondition(bool.right());
|
||||||
|
if(action.equals("==")) return toStringCondition(bool.left())+" = "+toStringCondition(bool.right());
|
||||||
throw new RuntimeException("unsuported operation "+action);
|
throw new RuntimeException("unsuported operation "+action);
|
||||||
}
|
}
|
||||||
if(value instanceof MethodCallValue){ //take method call instead of value
|
if(value instanceof MethodCallValue){ //take method call instead of value
|
||||||
MethodCallValue call = (MethodCallValue)value;
|
MethodCallValue call = (MethodCallValue)value;
|
||||||
String action = call.getToken().getValue();
|
String action = call.getToken().getValue();
|
||||||
if(action.equals("contains()")) return call.base().getToken().getValue()+" LIKE \"%?%\"";
|
if(action.equals("contains()")) return call.base().getToken().getValue()+" LIKE \"%?%\"";
|
||||||
|
if(action.equals("startsWith()")) return call.base().getToken().getValue()+" LIKE \"?%\"";
|
||||||
|
if(action.equals("endsWith()")) return call.base().getToken().getValue()+" LIKE \"%?\"";
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
return "default "+value.getClass();
|
return "default "+value.getClass();
|
||||||
|
|
Loading…
Add table
Reference in a new issue