|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.persist.sqlConstruction.SQLObject | +--com.objectwave.persist.sqlConstruction.SQLModifier | +--com.objectwave.persist.sqlConstruction.SQLUpdate
A class that handles the creation of SQL Update statements. For example:
SQLUpdate sql = new SQLUpdate(); sql.setTableName("TABLENAME");
com.objectwave.persist.SQLAssembler
,
com.objectwave.persist.RDBBroker
Field Summary |
Fields inherited from class com.objectwave.persist.sqlConstruction.SQLModifier |
columnList, sqlTypes, valueCount, valueList |
Fields inherited from class com.objectwave.persist.sqlConstruction.SQLObject |
availableForPool, table |
Constructor Summary | |
SQLUpdate()
Abstract the issues with an SQL update statement. |
|
SQLUpdate(java.lang.String tableName)
|
Method Summary | |
void |
bindValues(java.sql.PreparedStatement stmt,
java.lang.Class persistenceClass,
boolean verbose)
Bind data to a prepared statement. |
void |
clean()
We pool these objects for reuse. |
void |
copyValuesFrom(SQLModifier sql)
We have one cached SQLModifier object for prepared statements. |
protected void |
formatColumnList(java.lang.StringBuffer buf)
|
protected void |
formatTable(java.lang.StringBuffer buf)
Simply place the table name upon the provided StringBuffer. |
protected void |
formatWhereClause(java.lang.StringBuffer buf)
Add the required where clause elements for this update. |
protected void |
formatWhereClauseElement(Pair clause,
java.lang.StringBuffer buf)
Format the where clause to be like 'columnName = objectValue'. |
java.lang.String |
getPreparedString()
As with the getSqlStatement() method, this method trusts that there's an ordered, 1-1 mapping between the columns list and the values list. |
java.lang.StringBuffer |
getSqlStatement()
Gets the SqlStatement attribute of the SQLModifier object |
java.util.ArrayList |
getWhereClause()
|
void |
insertWhereClause(java.lang.String column,
java.lang.Object value)
|
void |
setWhereClause(java.util.ArrayList v)
|
Methods inherited from class com.objectwave.persist.sqlConstruction.SQLModifier |
addColumnList, addColumnValue, addValueList, bindValue, getBroker, getColumnList, getValueList, growLists, setBroker, setValues |
Methods inherited from class com.objectwave.persist.sqlConstruction.SQLObject |
formatValue, getDefaultFormatter, getObjectFormatter, isAvailableForPool, setAvailableForPool, setObjectFormatter, setTableName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SQLUpdate()
SQLObject.setTableName(String )
public SQLUpdate(java.lang.String tableName)
tableName
- String The table name for which this statement will insert values.Method Detail |
public void clean()
SQLModifier
clean
in class SQLModifier
public void bindValues(java.sql.PreparedStatement stmt, java.lang.Class persistenceClass, boolean verbose) throws java.sql.SQLException, QueryException
SQLModifier
bindValues
in class SQLModifier
stmt
- java.sql.PreparedStatement The statement to which data values are to be bound.persistenceClass
- The persistent class we are updating. Used for a query to determine sql types.verbose
- boolean Should we be verbose about this effort?
java.sql.SQLException
- An unexcepted database exception.
QueryException
- An exception generated by JGrinder.public void copyValuesFrom(SQLModifier sql)
copyValuesFrom
in class SQLModifier
sql
- The source of the new data values.protected void formatColumnList(java.lang.StringBuffer buf)
protected void formatTable(java.lang.StringBuffer buf)
buf
- StringBuffer being built that will contain the full sql statement.The user of this method.
protected void formatWhereClause(java.lang.StringBuffer buf)
buf
- StringBuffer being built that will contain the full sql statement.The user of this method.
protected void formatWhereClauseElement(Pair clause, java.lang.StringBuffer buf)
clause
- com.objectwave.utility.Pair The first element is the column name, the second is the where clause value.buf
- java.lang.StringBufferThe user of this method.
public java.lang.String getPreparedString()
getPreparedString
in class SQLModifier
public java.lang.StringBuffer getSqlStatement()
SQLModifier
getSqlStatement
in interface SQLAssembler
getSqlStatement
in class SQLModifier
public java.util.ArrayList getWhereClause()
public void insertWhereClause(java.lang.String column, java.lang.Object value)
insertWhereClause
in class SQLObject
column
- value
- public void setWhereClause(java.util.ArrayList v)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |