@Test public void testGenerateFromClause() throws Exception { Assert.assertTrue("from myCatalog.mySchema.myTable".equals( generator.generateFromClause(topic, DefaultSqlGenerator.LockIntent.NONE))); topic.setSchemaName(null); Assert.assertTrue("from myCatalog..myTable".equals( generator.generateFromClause(topic, DefaultSqlGenerator.LockIntent.NONE))); topic.setCatalogName(null); Assert.assertTrue("from myTable".equals( generator.generateFromClause(topic, DefaultSqlGenerator.LockIntent.NONE))); topic.setSchemaName("mySchema"); Assert.assertTrue("from mySchema.myTable".equals( generator.generateFromClause(topic, DefaultSqlGenerator.LockIntent.NONE))); }
protected String generateFromClause(Topic topic, LockIntent lockIntent) { StringBuilder builder = new StringBuilder("from "); if ( !StringUtils.isEmpty(topic.getCatalogName())) { builder.append(this.formatCatalogName(topic.getCatalogName())); builder.append("."); } if ( !StringUtils.isEmpty(topic.getSchemaName())) { builder.append(this.formatSchemaName(topic.getSchemaName())); builder.append("."); } else if (!StringUtils.isEmpty(topic.getCatalogName())) { builder.append("."); } builder.append(this.formatTableName(topic.getTableName(), lockIntent)); return builder.toString(); }
DefaultSqlGenerator implements SqlGenerator { protected String generateFromClause(Topic topic, LockIntent lockIntent) { StringBuilder builder = new StringBuilder("from "); if ( !StringUtils.isEmpty(topic.getCatalogName())) { builder.append(this.formatCatalogName(topic.getCatalogName())); builder.append("."); } if ( !StringUtils.isEmpty(topic.getSchemaName())) { builder.append(this.formatSchemaName(topic.getSchemaName())); builder.append("."); } else if (!StringUtils.isEmpty(topic.getCatalogName())) { builder.append("."); } builder.append(this.formatTableName(topic.getTableName(), lockIntent)); return builder.toString(); } }
DefaultSqlGenerator implements SqlGenerator { protected String generateFromClause(Topic topic, LockIntent lockIntent) { StringBuilder builder = new StringBuilder("from "); if ( !StringUtils.isEmpty(topic.getCatalogName())) { builder.append(this.formatCatalogName(topic.getCatalogName())); builder.append("."); } if ( !StringUtils.isEmpty(topic.getSchemaName())) { builder.append(this.formatSchemaName(topic.getSchemaName())); builder.append("."); } else if (!StringUtils.isEmpty(topic.getCatalogName())) { builder.append("."); } builder.append(this.formatTableName(topic.getTableName(), lockIntent)); return builder.toString(); } DefaultSqlGenerator(); }
DefaultSqlGenerator implements SqlGenerator { protected String generateFromClause(Topic topic, LockIntent lockIntent) { StringBuilder builder = new StringBuilder("from "); if ( !StringUtils.isEmpty(topic.getCatalogName())) { builder.append(this.formatCatalogName(topic.getCatalogName())); builder.append("."); } if ( !StringUtils.isEmpty(topic.getSchemaName())) { builder.append(this.formatSchemaName(topic.getSchemaName())); builder.append("."); } else if (!StringUtils.isEmpty(topic.getCatalogName())) { builder.append("."); } builder.append(this.formatTableName(topic.getTableName(), lockIntent)); return builder.toString(); } DefaultSqlGenerator(); SqlStatement generateSelect(Topic topic, CompositeCriteria searchCriteria,
			String[] fieldNames); }
DefaultSqlGenerator implements SqlGenerator { protected String generateFromClause(Topic topic, LockIntent lockIntent) { StringBuilder builder = new StringBuilder("from "); if ( !StringUtils.isEmpty(topic.getCatalogName())) { builder.append(this.formatCatalogName(topic.getCatalogName())); builder.append("."); } if ( !StringUtils.isEmpty(topic.getSchemaName())) { builder.append(this.formatSchemaName(topic.getSchemaName())); builder.append("."); } else if (!StringUtils.isEmpty(topic.getCatalogName())) { builder.append("."); } builder.append(this.formatTableName(topic.getTableName(), lockIntent)); return builder.toString(); } DefaultSqlGenerator(); SqlStatement generateSelect(Topic topic, CompositeCriteria searchCriteria,
			String[] fieldNames);  }