diff --git a/src/dev/peerat/mapping/providers/mysql/MySQLRequestBuilder.java b/src/dev/peerat/mapping/providers/mysql/MySQLRequestBuilder.java index f454d64..94cd4a7 100644 --- a/src/dev/peerat/mapping/providers/mysql/MySQLRequestBuilder.java +++ b/src/dev/peerat/mapping/providers/mysql/MySQLRequestBuilder.java @@ -49,12 +49,16 @@ public class MySQLRequestBuilder{ BiValue bool = (BiValue)value; String action = bool.getAction(); 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); } if(value instanceof MethodCallValue){ //take method call instead of value MethodCallValue call = (MethodCallValue)value; String action = call.getToken().getValue(); 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 "default "+value.getClass();