@Test public void testDiscoverTablespaceFromTruncateTable() { String defaultTableSpace = TableSpace.DEFAULT; String theTableSpace = "myts"; assertEquals(defaultTableSpace, QueryUtils.discoverTablespace(defaultTableSpace, "truncate table test")); assertEquals(theTableSpace, QueryUtils.discoverTablespace(defaultTableSpace, "truncate table myts.test")); }
public static String discoverTablespace(String defaultTableSpace, String query) { if (query == null) { return defaultTableSpace; } final Matcher matcher = TABLE_SPACE_NAME_PATTERN.matcher(query); if (matcher.find()) { final String tableSpace = matcher.group("tablespace"); if (tableSpace != null) { return tableSpace.substring(0, tableSpace.length() - 1); } } return defaultTableSpace; }
QueryUtils { public static String discoverTablespace(String defaultTableSpace, String query) { if (query == null) { return defaultTableSpace; } final Matcher matcher = TABLE_SPACE_NAME_PATTERN.matcher(query); if (matcher.find()) { final String tableSpace = matcher.group("tablespace"); if (tableSpace != null) { return tableSpace.substring(0, tableSpace.length() - 1); } } return defaultTableSpace; } }
QueryUtils { public static String discoverTablespace(String defaultTableSpace, String query) { if (query == null) { return defaultTableSpace; } final Matcher matcher = TABLE_SPACE_NAME_PATTERN.matcher(query); if (matcher.find()) { final String tableSpace = matcher.group("tablespace"); if (tableSpace != null) { return tableSpace.substring(0, tableSpace.length() - 1); } } return defaultTableSpace; }  }
QueryUtils { public static String discoverTablespace(String defaultTableSpace, String query) { if (query == null) { return defaultTableSpace; } final Matcher matcher = TABLE_SPACE_NAME_PATTERN.matcher(query); if (matcher.find()) { final String tableSpace = matcher.group("tablespace"); if (tableSpace != null) { return tableSpace.substring(0, tableSpace.length() - 1); } } return defaultTableSpace; }  static String discoverTablespace(String defaultTableSpace, String query); }
QueryUtils { public static String discoverTablespace(String defaultTableSpace, String query) { if (query == null) { return defaultTableSpace; } final Matcher matcher = TABLE_SPACE_NAME_PATTERN.matcher(query); if (matcher.find()) { final String tableSpace = matcher.group("tablespace"); if (tableSpace != null) { return tableSpace.substring(0, tableSpace.length() - 1); } } return defaultTableSpace; }  static String discoverTablespace(String defaultTableSpace, String query);  }