@Test public void getSqlInsert() throws JAXBException, FileNotFoundException { XmlLoadType loader; XmlLoader xmlLoader; loader = ObjectFactoryUtil.getLoadTypeBySrcXml(L1X).getXml(); xmlLoader = new XmlLoader(loader, DomUtil.srcToDocument(D1X)); assertThat(xmlLoader.getSqlInsert(loader), is(SQL)); loader = ObjectFactoryUtil.getLoadTypeBySrcXml(L2X).getXml(); xmlLoader = new XmlLoader(loader, DomUtil.srcToDocument(D2X)); assertThat(xmlLoader.getSqlInsert(loader), is(SQL)); }
public final String getSqlInsert(final XmlLoadType loader) { String query = "insert into " + loader.getTable() + " ("; String values = ") values ("; for (Column column : loader.getColumn()) { query += column.getName() + ","; values += "?,"; } return StringUtils.removeEnd(query, ",") + StringUtils.removeEnd(values, ",") + ")"; }
XmlLoader extends Loader { public final String getSqlInsert(final XmlLoadType loader) { String query = "insert into " + loader.getTable() + " ("; String values = ") values ("; for (Column column : loader.getColumn()) { query += column.getName() + ","; values += "?,"; } return StringUtils.removeEnd(query, ",") + StringUtils.removeEnd(values, ",") + ")"; } }
XmlLoader extends Loader { public final String getSqlInsert(final XmlLoadType loader) { String query = "insert into " + loader.getTable() + " ("; String values = ") values ("; for (Column column : loader.getColumn()) { query += column.getName() + ","; values += "?,"; } return StringUtils.removeEnd(query, ",") + StringUtils.removeEnd(values, ",") + ")"; } XmlLoader(final XmlLoadType loader, final Document document); }
XmlLoader extends Loader { public final String getSqlInsert(final XmlLoadType loader) { String query = "insert into " + loader.getTable() + " ("; String values = ") values ("; for (Column column : loader.getColumn()) { query += column.getName() + ","; values += "?,"; } return StringUtils.removeEnd(query, ",") + StringUtils.removeEnd(values, ",") + ")"; } XmlLoader(final XmlLoadType loader, final Document document); final String getSqlInsert(final XmlLoadType loader); @Override final void dataInsert(final JdlConnection jdlConnection); }
XmlLoader extends Loader { public final String getSqlInsert(final XmlLoadType loader) { String query = "insert into " + loader.getTable() + " ("; String values = ") values ("; for (Column column : loader.getColumn()) { query += column.getName() + ","; values += "?,"; } return StringUtils.removeEnd(query, ",") + StringUtils.removeEnd(values, ",") + ")"; } XmlLoader(final XmlLoadType loader, final Document document); final String getSqlInsert(final XmlLoadType loader); @Override final void dataInsert(final JdlConnection jdlConnection);  }