|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.primix.tapestry.util.jdbc.StatementAssembly
Class for creating and executing JDBC statements.
Constructor Summary | |
StatementAssembly()
Default constructor; uses a maximum line length of 80 and an indent of 5. |
|
StatementAssembly(int maxLineLength,
int indent)
|
Method Summary | |
void |
add(boolean value)
Adds a boolean value as either '0' or '1'. |
void |
add(double value)
|
void |
add(float value)
|
void |
add(int value)
|
void |
add(long value)
|
void |
add(java.lang.Object value)
Adds an arbitrary object to the SQL by invoking Object.toString() . |
void |
add(short value)
|
void |
add(java.lang.String text)
Adds text to the current line, unless that would make the line too long, in which case a new line is started (and indented) before adding the text. |
void |
addList(int[] items,
java.lang.String seperator)
|
void |
addList(java.lang.Object[] items,
java.lang.String seperator)
|
void |
addList(java.lang.String[] items,
java.lang.String seperator)
|
void |
addParameter(java.lang.Object value)
Adds a parameter to the statement. |
void |
addParameter(java.lang.String text,
java.lang.Object value)
Adds a parameter with some associated text, which should include the question mark used to represent the parameter in the SQL. |
void |
addSep(java.lang.String text)
Adds a seperator (usually a comma and a space) to the current line, regardless of line length. |
IStatement |
createStatement(java.sql.Connection connection)
Creates and returns a IStatement based on the SQL and parameters
acquired. |
int |
getIndent()
Number of spaces to indent continuation lines by. |
int |
getMaxLineLength()
Maximum length of a line. |
void |
newLine()
Starts a new line, without indenting. |
void |
newLine(java.lang.String text)
Starts a new line, then adds the given text. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StatementAssembly()
public StatementAssembly(int maxLineLength, int indent)
Method Detail |
public int getMaxLineLength()
public int getIndent()
public void add(java.lang.String text)
Text is added as-is, with no concept of quoting. To add arbitrary strings (such as in a where clause), use addParameter().
public void add(int value)
public void add(short value)
public void add(float value)
public void add(double value)
public void add(long value)
public void add(java.lang.Object value)
Object.toString()
.
This is typically used with Integer
, Double
, etc. Note that
this will not work well with Boolean
... invoke add(boolean)
instead.public void add(boolean value)
public void addSep(java.lang.String text)
public void newLine()
public void newLine(java.lang.String text)
public void addList(java.lang.String[] items, java.lang.String seperator)
public void addList(java.lang.Object[] items, java.lang.String seperator)
public void addList(int[] items, java.lang.String seperator)
public void addParameter(java.lang.Object value)
public void addParameter(java.lang.String text, java.lang.Object value)
public IStatement createStatement(java.sql.Connection connection) throws java.sql.SQLException
IStatement
based on the SQL and parameters
acquired.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |