Package org.apache.openjpa.lib.jdbc
Class SQLFormatter
java.lang.Object
org.apache.openjpa.lib.jdbc.SQLFormatter
Converts single-line SQL strings into nicely-formatted
multi-line, indented statements.
Example: from PERSON t0, COMPANY t1 WHERE t0.ID = 10 AND \
t0.COMPANY_ID = t1.ID AND t1.NAME = 'OpenJPA' becomes
SELECT * FROM PERSON t0, COMPANY t1
WHERE t0.ID = 10 AND t0.COMPANY_ID = t1.ID AND t1.NAME = 'OpenJPA'\
and
INSERT INTO PERSON VALUES('Patrick', 'Linskey', 'OpenJPA', \
'202 595 2064 x1111')
becomes
INSERT INTO PERSON VALUES('Patrick', 'Linskey', 'OpenJPA', '202
595 2064 x1111')
etc.- Author:
- Patrick Linskey
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
If true, then output two lines after multi-line statements.int
boolean
If true, then try to parse multi-line SQL statements.static void
prettyPrint
(Object sqlObject) void
setClauseIndent
(String val) void
setDoubleSpace
(boolean doubleSpace) If true, then output two lines after multi-line statements.void
setLineLength
(int val) void
setMultiLine
(boolean multiLine) If true, then try to parse multi-line SQL statements.void
setNewline
(String val) void
setWrapIndent
(String val)
-
Constructor Details
-
SQLFormatter
public SQLFormatter()
-
-
Method Details
-
setNewline
-
getNewline
-
setLineLength
public void setLineLength(int val) -
getLineLength
public int getLineLength() -
setWrapIndent
-
getWrapIndent
-
setClauseIndent
-
getClauseIndent
-
setMultiLine
public void setMultiLine(boolean multiLine) If true, then try to parse multi-line SQL statements. -
getMultiLine
public boolean getMultiLine()If true, then try to parse multi-line SQL statements. -
setDoubleSpace
public void setDoubleSpace(boolean doubleSpace) If true, then output two lines after multi-line statements. -
getDoubleSpace
public boolean getDoubleSpace()If true, then output two lines after multi-line statements. -
prettyPrint
-
main
-