public SqlRexConvertlet get(SqlCall call) { SqlRexConvertlet convertlet; final SqlOperator op = call.getOperator(); // Is there a convertlet for this operator // (e.g. SqlStdOperatorTable.plusOperator)? convertlet = (SqlRexConvertlet) map.get(op); if (convertlet != null) { return convertlet; } // Is there a convertlet for this class of operator // (e.g. SqlBinaryOperator)? Class<? extends Object> clazz = op.getClass(); while (clazz != null) { convertlet = (SqlRexConvertlet) map.get(clazz); if (convertlet != null) { return convertlet; } clazz = clazz.getSuperclass(); } // Is there a convertlet for this class of expression // (e.g. SqlCall)? clazz = call.getClass(); while (clazz != null) { convertlet = (SqlRexConvertlet) map.get(clazz); if (convertlet != null) { return convertlet; } clazz = clazz.getSuperclass(); } return null; }
public List<SqlMoniker> getAllSchemaObjectNames(List<String> names) { List<SqlMoniker> result; switch (names.size()) { case 0: // looking for schema names result = new ArrayList<SqlMoniker>(); for (MockSchema schema : schemas.values()) { result.add(new SqlMonikerImpl(schema.name, SqlMonikerType.Schema)); } return result; case 1: // looking for table names in the given schema MockSchema schema = schemas.get(names.get(0)); if (schema == null) { return Collections.emptyList(); } result = new ArrayList<SqlMoniker>(); for (String tableName : schema.tableNames) { result.add(new SqlMonikerImpl(tableName, SqlMonikerType.Table)); } return result; default: return Collections.emptyList(); } }