private void formatCodeIfNeeded() { String nonFormattedSqlCode; if (getSelectedQuery() != null) { nonFormattedSqlCode = getSelectedQuery().getSqlTranslation(); if (formattedSqlCodeCheck.isSelected()) { if (nonFormattedSqlCode.length() > 0) { // Format SQL Code sqlCodeEditor.setText(new BasicFormatterImpl().format(nonFormattedSqlCode)); } } else { sqlCodeEditor.setText(nonFormattedSqlCode); } } }
@Override public String toString() { final String format = sql.replaceAll("\\?", "%s"); final Object[] parametersConverted = parameters.stream().map(p -> p instanceof String ? "'" + p + "'" : p).collect(Collectors.toList()).toArray(); return new BasicFormatterImpl().format(String.format(format, parametersConverted)); }
public BasicFormatterImpl getSqlFormatter() { return sqlFormatter; }
public void setSqlFormatter(BasicFormatterImpl sqlFormatter) { this.sqlFormatter = sqlFormatter; }
public void format() throws IOException { String original = readSql(); String formatted = new BasicFormatterImpl().format(original); writer.write(formatted); writer.flush(); }
public String getPrettySQL() { String formattedSQL = new BasicFormatterImpl().format(query.query); return formattedSQL; }