public static void getSchemaObjectMonikers( SqlValidatorCatalogReader catalogReader, List<String> names, List<SqlMoniker> hints) { // Assume that the last name is 'dummy' or similar. List<String> subNames = Util.skipLast(names); hints.addAll(catalogReader.getAllSchemaObjectNames(subNames)); // If the name has length 0, try prepending the name of the default // schema. So, the empty name would yield a list of tables in the // default schema, as well as a list of schemas from the above code. if (subNames.size() == 0) { hints.addAll( catalogReader.getAllSchemaObjectNames( Collections.singletonList(catalogReader.getSchemaName()))); } }
public static void getSchemaObjectMonikers( SqlValidatorCatalogReader catalogReader, List<String> names, List<SqlMoniker> hints) { // Assume that the last name is 'dummy' or similar. List<String> subNames = Util.skipLast(names); // Try successively with catalog.schema, catalog and no prefix List<String> x = catalogReader.getSchemaName(); for (; ; ) { final List<String> names2 = ImmutableList.<String>builder().addAll(x).addAll(subNames).build(); hints.addAll(catalogReader.getAllSchemaObjectNames(names2)); if (x.isEmpty()) { break; } x = Util.skipLast(x); } }