|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j256.ormlite.stmt.StatementBuilder<T,ID>
com.j256.ormlite.stmt.UpdateBuilder<T,ID>
public class UpdateBuilder<T,ID>
Assists in building sql UPDATE statements for a particular table in a particular database.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.j256.ormlite.stmt.StatementBuilder |
---|
StatementBuilder.StatementType |
Field Summary |
---|
Fields inherited from class com.j256.ormlite.stmt.StatementBuilder |
---|
databaseType, limit, tableInfo |
Constructor Summary | |
---|---|
UpdateBuilder(DatabaseType databaseType,
TableInfo<T> tableInfo)
|
Method Summary | |
---|---|
protected void |
appendStatementEnd(StringBuilder sb)
Append the end of our statement string to the StringBuilder. |
protected void |
appendStatementStart(StringBuilder sb,
List<FieldType> resultFieldTypeList)
Append the start of our statement string to the StringBuilder. |
String |
escapeColumnName(String columnName)
Same as escapeColumnName(StringBuilder, String) but it will return the escaped string. |
void |
escapeColumnName(StringBuilder sb,
String columnName)
When you are building the expression for updateColumnExpression(String, String) , you may need to escape
column names since they may be reserved words to the database. |
String |
escapeValue(String value)
Same as escapeValue(StringBuilder, String) but it will return the escaped string. |
void |
escapeValue(StringBuilder sb,
String value)
When you are building the expression for updateColumnExpression(String, String) , you may need to escape
values since they may be reserved words to the database. |
PreparedUpdate<T> |
prepare()
Build and return a prepared update that can be used by Dao.update(PreparedUpdate) method. |
StatementBuilder<T,ID> |
updateColumnExpression(String columnName,
String expression)
Add a column to be set to a value for UPDATE statements. |
StatementBuilder<T,ID> |
updateColumnValue(String columnName,
Object value)
Add a column to be set to a value for UPDATE statements. |
Methods inherited from class com.j256.ormlite.stmt.StatementBuilder |
---|
buildStatementString, prepareStatement, prepareStatementString, setWhere, verifyColumnName, where |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UpdateBuilder(DatabaseType databaseType, TableInfo<T> tableInfo)
Method Detail |
---|
public PreparedUpdate<T> prepare() throws SQLException
Dao.update(PreparedUpdate)
method. If you change
the where or make other calls you will need to re-call this method to re-prepare the statement for execution.
SQLException
public StatementBuilder<T,ID> updateColumnValue(String columnName, Object value) throws SQLException
SQLException
public StatementBuilder<T,ID> updateColumnExpression(String columnName, String expression) throws SQLException
The expression should have any strings escaped using the escapeValue(String)
or
escapeValue(StringBuilder, String)
methods and should have any column names escaped using the
escapeColumnName(String)
or escapeColumnName(StringBuilder, String)
methods.
SQLException
public void escapeColumnName(StringBuilder sb, String columnName)
updateColumnExpression(String, String)
, you may need to escape
column names since they may be reserved words to the database. This will help you by adding escape characters
around the word.
public String escapeColumnName(String columnName)
escapeColumnName(StringBuilder, String)
but it will return the escaped string. The StringBuilder
method is more efficient since this method creates a StatementBuilder
internally.
public void escapeValue(StringBuilder sb, String value)
updateColumnExpression(String, String)
, you may need to escape
values since they may be reserved words to the database. Numbers should not be escaped. This will help you by
adding escape characters around the word.
public String escapeValue(String value)
escapeValue(StringBuilder, String)
but it will return the escaped string. Numbers should not be
escaped. The StringBuilder method is more efficient since this method creates a StatementBuilder
internally.
protected void appendStatementStart(StringBuilder sb, List<FieldType> resultFieldTypeList) throws SQLException
StatementBuilder
appendStatementStart
in class StatementBuilder<T,ID>
SQLException
protected void appendStatementEnd(StringBuilder sb)
StatementBuilder
appendStatementEnd
in class StatementBuilder<T,ID>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |