Package org.apache.openjpa.lib.jdbc
Class SQLFormatter
- java.lang.Object
-
- org.apache.openjpa.lib.jdbc.SQLFormatter
-
public class SQLFormatter extends java.lang.Object
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' becomesSELECT * FROM PERSON t0, COMPANY t1 WHERE t0.ID = 10 AND t0.COMPANY_ID = t1.ID AND t1.NAME = 'OpenJPA'\
andINSERT INTO PERSON VALUES('Patrick', 'Linskey', 'OpenJPA', \ '202 595 2064 x1111')
becomesINSERT INTO PERSON VALUES('Patrick', 'Linskey', 'OpenJPA', '202 595 2064 x1111')
etc.- Author:
- Patrick Linskey
-
-
Constructor Summary
Constructors Constructor Description SQLFormatter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getClauseIndent()
boolean
getDoubleSpace()
If true, then output two lines after multi-line statements.int
getLineLength()
boolean
getMultiLine()
If true, then try to parse multi-line SQL statements.java.lang.String
getNewline()
java.lang.String
getWrapIndent()
static void
main(java.lang.String[] args)
java.lang.Object
prettyPrint(java.lang.Object sqlObject)
void
setClauseIndent(java.lang.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(java.lang.String val)
void
setWrapIndent(java.lang.String val)
-
-
-
Method Detail
-
setNewline
public void setNewline(java.lang.String val)
-
getNewline
public java.lang.String getNewline()
-
setLineLength
public void setLineLength(int val)
-
getLineLength
public int getLineLength()
-
setWrapIndent
public void setWrapIndent(java.lang.String val)
-
getWrapIndent
public java.lang.String getWrapIndent()
-
setClauseIndent
public void setClauseIndent(java.lang.String val)
-
getClauseIndent
public java.lang.String 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
public java.lang.Object prettyPrint(java.lang.Object sqlObject)
-
main
public static void main(java.lang.String[] args)
-
-