private String getMainColumnForSELECT(Term ht, AliasIndex index, COL_TYPE castDataType) { String column = getSQLString(ht, index, false); if (column.charAt(0) != '\'' && column.charAt(0) != '(' && castDataType != null) { // a column that still needs a CAST to VARCHAR return sqladapter.sqlCast(column, jdbcTypeMapper.getSQLType(castDataType)); } return column; }
private String getMainColumnForSELECT(Term ht, AliasIndex index, TermType castDataType) { String column = getSQLString(ht, index, false); if (column.charAt(0) != '\'' && column.charAt(0) != '(' && castDataType != null) { // a column that still needs a CAST to VARCHAR return sqladapter.sqlCast(column, jdbcTypeMapper.getSQLType(castDataType)); } return column; }
private int getVariableDataType(Term term, QueryAliasIndex idx) { if (term instanceof Function){ Function f = (Function) term; if (f.isDataTypeFunction()) { Predicate p = f.getFunctionSymbol(); COL_TYPE type = TYPE_FACTORY.getDatatype(p.toString()); return jdbcTypeMapper.getSQLType(type); } // Return varchar for unknown return Types.VARCHAR; }else if (term instanceof Variable){ throw new RuntimeException("Cannot return the SQL type for: " + term.toString()); } /** * Boolean constant */ else if (term.equals(TermConstants.FALSE) || term.equals(TermConstants.TRUE)) { return Types.BOOLEAN; } return Types.VARCHAR; }
private int getDataType(Term term) { if (term instanceof Function) { Function f = (Function) term; if (f.isDataTypeFunction()) { Predicate p = f.getFunctionSymbol(); COL_TYPE type = TYPE_FACTORY.getDatatype(p.getName()).get(); return jdbcTypeMapper.getSQLType(type); } // return varchar for unknown return Types.VARCHAR; } else if (term instanceof Variable) { throw new RuntimeException("Cannot return the SQL type for: " + term); } else if (term.equals(TermConstants.FALSE) || term.equals(TermConstants.TRUE)) { return Types.BOOLEAN; } return Types.VARCHAR; }
private int getDataType(Term term) { /* * TODO: refactor! */ if (term instanceof Function){ Function f = (Function) term; Predicate p = f.getFunctionSymbol(); if (p instanceof DatatypePredicate) { RDFDatatype type = ((DatatypePredicate) p).getReturnedType(); return jdbcTypeMapper.getSQLType(type); } // return varchar for unknown return Types.VARCHAR; } else if (term instanceof Variable) { throw new RuntimeException("Cannot return the SQL type for: " + term); } /* * Boolean constant */ else if (term.equals(termFactory.getBooleanConstant(false)) || term.equals(termFactory.getBooleanConstant(true))) { return Types.BOOLEAN; } return Types.VARCHAR; }
mainColumn = sqladapter.sqlCast(mainColumn, jdbcTypeMapper.getSQLType(castDataType));