public static void main(String [] args) { SQLFormatter formatter = new SQLFormatter(); for (int i = 0; i < args.length; i++) { // START - ALLOW PRINT STATEMENTS System.out.println(formatter.prettyPrint(args[i])); // STOP - ALLOW PRINT STATEMENTS } } }
/** * If set to <code>true</code>, pretty-print SQL by running it * through {@link SQLFormatter#prettyPrint}. If * <code>false</code>, don't pretty-print, and output SQL logs in * a single line. Pretty-printed SQL can be easier for a human to * read, but is harder to parse with tools like grep. */ public void setPrettyPrint(boolean prettyPrint) { _prettyPrint = prettyPrint; if (_formatter == null && _prettyPrint) { _formatter = new SQLFormatter(); _formatter.setLineLength(_prettyPrintLineLength); } else if (!_prettyPrint) _formatter = null; }
public Object prettyPrint(Object sqlObject) { if (!multiLine) { return prettyPrintLine(sqlObject); } else { StringBuilder sql = new StringBuilder(sqlObject.toString()); StringBuilder buf = new StringBuilder(sql.length()); while (sql.length() > 0) { String line = null; int index = Math.max(sql.toString().indexOf(";\n"), sql.toString().indexOf(";\r")); if (index == -1) line = sql.toString(); else line = sql.substring(0, index + 2); // remove the current line from the sql buffer sql.delete(0, line.length()); buf.append(prettyPrintLine(line)); for (int i = 0; i < 1 + (getDoubleSpace() ? 1 : 0); i++) buf.append(J2DoPrivHelper.getLineSeparator()); } return buf.toString(); } }
public void appendInfo(StringBuffer buf) { if (_sql != null) { buf.append(" "); if (_formatter != null) { buf.append(SEP); buf.append(_formatter.prettyPrint(_sql)); } else { buf.append(_sql); } } }
/** * The number of characters to print per line when * pretty-printing of SQL is enabled. Defaults to 60 to provide * some space for any ant-related characters on the left of a * standard 80-character display. */ public void setPrettyPrintLineLength(int length) { _prettyPrintLineLength = length; if (_formatter != null) _formatter.setLineLength(length); }
pp.append(wrapLine(iter.next().toString())); if (iter.hasNext()) pp.append(newline);
public Object prettyPrint(Object sqlObject) { if (!multiLine) { return prettyPrintLine(sqlObject); } else { StringBuilder sql = new StringBuilder(sqlObject.toString()); StringBuilder buf = new StringBuilder(sql.length()); while (sql.length() > 0) { String line = null; int index = Math.max(sql.toString().indexOf(";\n"), sql.toString().indexOf(";\r")); if (index == -1) line = sql.toString(); else line = sql.substring(0, index + 2); // remove the current line from the sql buffer sql.delete(0, line.length()); buf.append(prettyPrintLine(line)); for (int i = 0; i < 1 + (getDoubleSpace() ? 1 : 0); i++) buf.append(J2DoPrivHelper.getLineSeparator()); } return buf.toString(); } }
public void appendInfo(StringBuffer buf) { if (_sql != null) { buf.append(" "); if (_formatter != null) { buf.append(SEP); buf.append(_formatter.prettyPrint(_sql)); } else { buf.append(_sql); } } }
/** * The number of characters to print per line when * pretty-printing of SQL is enabled. Defaults to 60 to provide * some space for any ant-related characters on the left of a * standard 80-character display. */ public void setPrettyPrintLineLength(int length) { _prettyPrintLineLength = length; if (_formatter != null) _formatter.setLineLength(length); }
pp.append(wrapLine(iter.next().toString())); if (iter.hasNext()) pp.append(newline);
public static void main(String [] args) { SQLFormatter formatter = new SQLFormatter(); for (int i = 0; i < args.length; i++) { System.out.println(formatter.prettyPrint(args[i])); } } }
/** * If set to <code>true</code>, pretty-print SQL by running it * through {@link SQLFormatter#prettyPrint}. If * <code>false</code>, don't pretty-print, and output SQL logs in * a single line. Pretty-printed SQL can be easier for a human to * read, but is harder to parse with tools like grep. */ public void setPrettyPrint(boolean prettyPrint) { _prettyPrint = prettyPrint; if (_formatter == null && _prettyPrint) { _formatter = new SQLFormatter(); _formatter.setLineLength(_prettyPrintLineLength); } else if (!_prettyPrint) _formatter = null; }
public Object prettyPrint(Object sqlObject) { if (!multiLine) { return prettyPrintLine(sqlObject); } else { StringBuilder sql = new StringBuilder(sqlObject.toString()); StringBuilder buf = new StringBuilder(sql.length()); while (sql.length() > 0) { String line = null; int index = Math.max(sql.toString().indexOf(";\n"), sql.toString().indexOf(";\r")); if (index == -1) line = sql.toString(); else line = sql.substring(0, index + 2); // remove the current line from the sql buffer sql.delete(0, line.length()); buf.append(prettyPrintLine(line)); for (int i = 0; i < 1 + (getDoubleSpace() ? 1 : 0); i++) buf.append(J2DoPrivHelper.getLineSeparator()); } return buf.toString(); } }
public void appendInfo(StringBuffer buf) { if (_sql != null) { buf.append(" "); if (_formatter != null) { buf.append(SEP); buf.append(_formatter.prettyPrint(_sql)); } else { buf.append(_sql); } } }
/** * The number of characters to print per line when * pretty-printing of SQL is enabled. Defaults to 60 to provide * some space for any ant-related characters on the left of a * standard 80-character display. */ public void setPrettyPrintLineLength(int length) { _prettyPrintLineLength = length; if (_formatter != null) _formatter.setLineLength(length); }
pp.append(wrapLine(iter.next().toString())); if (iter.hasNext()) pp.append(newline);
public static void main(String [] args) { SQLFormatter formatter = new SQLFormatter(); for (int i = 0; i < args.length; i++) { // START - ALLOW PRINT STATEMENTS System.out.println(formatter.prettyPrint(args[i])); // STOP - ALLOW PRINT STATEMENTS } } }
/** * If set to <code>true</code>, pretty-print SQL by running it * through {@link SQLFormatter#prettyPrint}. If * <code>false</code>, don't pretty-print, and output SQL logs in * a single line. Pretty-printed SQL can be easier for a human to * read, but is harder to parse with tools like grep. */ public void setPrettyPrint(boolean prettyPrint) { _prettyPrint = prettyPrint; if (_formatter == null && _prettyPrint) { _formatter = new SQLFormatter(); _formatter.setLineLength(_prettyPrintLineLength); } else if (!_prettyPrint) _formatter = null; }
public Object prettyPrint(Object sqlObject) { if (!multiLine) { return prettyPrintLine(sqlObject); } else { StringBuffer sql = new StringBuffer(sqlObject.toString()); StringBuffer buf = new StringBuffer(sql.length()); while (sql.length() > 0) { String line = null; int index = Math.max(sql.toString().indexOf(";\n"), sql.toString().indexOf(";\r")); if (index == -1) line = sql.toString(); else line = sql.substring(0, index + 2); // remove the current line from the sql buffer sql.delete(0, line.length()); buf.append(prettyPrintLine(line)); for (int i = 0; i < 1 + (getDoubleSpace() ? 1 : 0); i++) buf.append(J2DoPrivHelper.getLineSeparator()); } return buf.toString(); } }
public void appendInfo(StringBuffer buf) { if (_sql != null) { buf.append(" "); if (_formatter != null) { buf.append(SEP); buf.append(_formatter.prettyPrint(_sql)); } else { buf.append(_sql); } } }