@Test void createTableMySQLStringTestSmall() { String expected = "CREATE TABLE `table1` (`column1_1` INTEGER, `column1_2` DOUBLE, `column1_3` VARCHAR(100));"; TableCreationBuilder tableCreationBuilder = new TableCreationBuilder(new MySQLOptions()); assertThat(tableCreationBuilder.buildQueries(pathsSmall.get(0)).get(0)).isEqualTo(expected); }
@Override public List<String> buildQueries(Path path) { return path.getFixture().getTables().stream().map(table -> { StringBuilder createBuilder = new StringBuilder(); createBuilder.append("CREATE TABLE "); createBuilder.append(getVendorOptions().escapeIdentifier(table.getSchema().getName())); createBuilder.append(" ("); List<String> columnsWithTypes = table.getSchema().getColumns().stream() .map(c -> getVendorOptions().escapeIdentifier(c.getName()) + " " + c.getType()) .collect(Collectors.toList()); createBuilder.append(String.join(", ", columnsWithTypes)); createBuilder.append(");"); return createBuilder.toString(); }).collect(Collectors.toList()); }
TableCreationBuilder extends QueryBuilder { @Override public List<String> buildQueries(Path path) { return path.getFixture().getTables().stream().map(table -> { StringBuilder createBuilder = new StringBuilder(); createBuilder.append("CREATE TABLE "); createBuilder.append(getVendorOptions().escapeIdentifier(table.getSchema().getName())); createBuilder.append(" ("); List<String> columnsWithTypes = table.getSchema().getColumns().stream() .map(c -> getVendorOptions().escapeIdentifier(c.getName()) + " " + c.getType()) .collect(Collectors.toList()); createBuilder.append(String.join(", ", columnsWithTypes)); createBuilder.append(");"); return createBuilder.toString(); }).collect(Collectors.toList()); } }
TableCreationBuilder extends QueryBuilder { @Override public List<String> buildQueries(Path path) { return path.getFixture().getTables().stream().map(table -> { StringBuilder createBuilder = new StringBuilder(); createBuilder.append("CREATE TABLE "); createBuilder.append(getVendorOptions().escapeIdentifier(table.getSchema().getName())); createBuilder.append(" ("); List<String> columnsWithTypes = table.getSchema().getColumns().stream() .map(c -> getVendorOptions().escapeIdentifier(c.getName()) + " " + c.getType()) .collect(Collectors.toList()); createBuilder.append(String.join(", ", columnsWithTypes)); createBuilder.append(");"); return createBuilder.toString(); }).collect(Collectors.toList()); } TableCreationBuilder(VendorOptions vendorOptions); }
TableCreationBuilder extends QueryBuilder { @Override public List<String> buildQueries(Path path) { return path.getFixture().getTables().stream().map(table -> { StringBuilder createBuilder = new StringBuilder(); createBuilder.append("CREATE TABLE "); createBuilder.append(getVendorOptions().escapeIdentifier(table.getSchema().getName())); createBuilder.append(" ("); List<String> columnsWithTypes = table.getSchema().getColumns().stream() .map(c -> getVendorOptions().escapeIdentifier(c.getName()) + " " + c.getType()) .collect(Collectors.toList()); createBuilder.append(String.join(", ", columnsWithTypes)); createBuilder.append(");"); return createBuilder.toString(); }).collect(Collectors.toList()); } TableCreationBuilder(VendorOptions vendorOptions); @Override List<String> buildQueries(Path path); }
TableCreationBuilder extends QueryBuilder { @Override public List<String> buildQueries(Path path) { return path.getFixture().getTables().stream().map(table -> { StringBuilder createBuilder = new StringBuilder(); createBuilder.append("CREATE TABLE "); createBuilder.append(getVendorOptions().escapeIdentifier(table.getSchema().getName())); createBuilder.append(" ("); List<String> columnsWithTypes = table.getSchema().getColumns().stream() .map(c -> getVendorOptions().escapeIdentifier(c.getName()) + " " + c.getType()) .collect(Collectors.toList()); createBuilder.append(String.join(", ", columnsWithTypes)); createBuilder.append(");"); return createBuilder.toString(); }).collect(Collectors.toList()); } TableCreationBuilder(VendorOptions vendorOptions); @Override List<String> buildQueries(Path path);  }