@Test public void testBuildSql() { ColumnDesc columnDesc1 = new ColumnDesc(); columnDesc1.setName("foo"); ColumnDesc columnDesc2 = new ColumnDesc(); columnDesc2.setName("BAR"); TableDesc tableDesc = new TableDesc(); tableDesc.setCatalogName("AAA"); tableDesc.setSchemaName("BBB"); tableDesc.setName("HOGE"); tableDesc.addColumnDesc(columnDesc1); tableDesc.addColumnDesc(columnDesc2); String sql = loader.buildSql(tableDesc, Arrays.asList("FOO", "BAR")); assertEquals("insert into AAA.BBB.HOGE (FOO, BAR) values (?, ?)", sql); }
protected String buildSql(TableDesc tableDesc, List<String> columnNameList) { StringBuilder buf = new StringBuilder(); buf.append("insert into "); buf.append(tableDesc.getFullName()); buf.append(" ("); for (String columnName : columnNameList) { buf.append(columnName); buf.append(", "); } buf.setLength(buf.length() - 2); buf.append(") values ("); for (int i = 0; i < columnNameList.size(); i++) { buf.append("?, "); } buf.setLength(buf.length() - 2); buf.append(")"); return buf.toString(); }
LoaderImpl implements Loader { protected String buildSql(TableDesc tableDesc, List<String> columnNameList) { StringBuilder buf = new StringBuilder(); buf.append("insert into "); buf.append(tableDesc.getFullName()); buf.append(" ("); for (String columnName : columnNameList) { buf.append(columnName); buf.append(", "); } buf.setLength(buf.length() - 2); buf.append(") values ("); for (int i = 0; i < columnNameList.size(); i++) { buf.append("?, "); } buf.setLength(buf.length() - 2); buf.append(")"); return buf.toString(); } }
LoaderImpl implements Loader { protected String buildSql(TableDesc tableDesc, List<String> columnNameList) { StringBuilder buf = new StringBuilder(); buf.append("insert into "); buf.append(tableDesc.getFullName()); buf.append(" ("); for (String columnName : columnNameList) { buf.append(columnName); buf.append(", "); } buf.setLength(buf.length() - 2); buf.append(") values ("); for (int i = 0; i < columnNameList.size(); i++) { buf.append("?, "); } buf.setLength(buf.length() - 2); buf.append(")"); return buf.toString(); } LoaderImpl(GenDialect dialect, String dumpFileEncoding,
            int batchSize, boolean delete); }
LoaderImpl implements Loader { protected String buildSql(TableDesc tableDesc, List<String> columnNameList) { StringBuilder buf = new StringBuilder(); buf.append("insert into "); buf.append(tableDesc.getFullName()); buf.append(" ("); for (String columnName : columnNameList) { buf.append(columnName); buf.append(", "); } buf.setLength(buf.length() - 2); buf.append(") values ("); for (int i = 0; i < columnNameList.size(); i++) { buf.append("?, "); } buf.setLength(buf.length() - 2); buf.append(")"); return buf.toString(); } LoaderImpl(GenDialect dialect, String dumpFileEncoding,
            int batchSize, boolean delete); void load(SqlExecutionContext sqlExecutionContext,
            DatabaseDesc databaseDesc, File dumpFile); boolean isTarget(DatabaseDesc databaseDesc, File file); }
LoaderImpl implements Loader { protected String buildSql(TableDesc tableDesc, List<String> columnNameList) { StringBuilder buf = new StringBuilder(); buf.append("insert into "); buf.append(tableDesc.getFullName()); buf.append(" ("); for (String columnName : columnNameList) { buf.append(columnName); buf.append(", "); } buf.setLength(buf.length() - 2); buf.append(") values ("); for (int i = 0; i < columnNameList.size(); i++) { buf.append("?, "); } buf.setLength(buf.length() - 2); buf.append(")"); return buf.toString(); } LoaderImpl(GenDialect dialect, String dumpFileEncoding,
            int batchSize, boolean delete); void load(SqlExecutionContext sqlExecutionContext,
            DatabaseDesc databaseDesc, File dumpFile); boolean isTarget(DatabaseDesc databaseDesc, File file);  }