@Override public void visit(Column expression) { Term term = getVariable(expression); if (term != null) { /* * If the termName is not null, create a variable */ result = term; } else { // Constructs constant // if the columns contains a boolean value String columnName = expression.getColumnName(); // check whether it is an SQL boolean value String lowerCase = columnName.toLowerCase(); if (lowerCase.equals("true")) { result = fac.getBooleanConstant(true); } else if (lowerCase.equals("false")) { result = fac.getBooleanConstant(false); } else throw new RuntimeException( "Unable to find column name for variable: " + columnName); } }
@Override public void visit(IsNullExpression expression) { Column column = (Column)expression.getLeftExpression(); Term var = getVariable(column); if (var == null) { throw new RuntimeException( "Unable to find column name for variable: " + column + " in context " + expression); } if (!expression.isNot()) { result = fac.getFunctionIsNull(var); } else { result = fac.getFunctionIsNotNull(var); } }