|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.dataset.DataCommand
org.jdesktop.dataset.provider.sql.AbstractSqlCommand
org.jdesktop.dataset.provider.sql.SQLCommand
org.jdesktop.dataset.provider.sql.TableCommand
public class TableCommand
A simplified SQLCommand for use with an SQLDataProvider, which acts against all of the columns in a given RDBMS table. No joins are used. Because this is a simple table-based DataCommand, it can infer the INSERT, UPDATE, and DELETE SQL statements to use when working with the table.
If you desire custom SQL, you may supply it to any of the Select SQL methods.
If you later want to revert to the autogenerated SQL statements, then simply
pass null to the setXXX methods. For example, assuming can_delete is a column
on the customer table:
TableCommand cmd = new TableCommand("customer");
//sets a custom delete SQL statement
cmd.setDeleteSQL("delete from customer where id=:id and can_delete=true");
//... later, reset the delete SQL statement to the autogenerated one
cmd.setDeleteSQL(null);
Constructor Summary | |
---|---|
TableCommand()
Creates a new instance of TableCommand |
|
TableCommand(java.lang.String tableName)
|
|
TableCommand(java.lang.String tableName,
java.lang.String whereClause)
|
Method Summary | |
---|---|
protected java.sql.PreparedStatement |
getDeleteStatement(JDBCDataConnection conn,
DataRow row)
|
protected java.sql.PreparedStatement |
getInsertStatement(JDBCDataConnection conn,
DataRow row)
|
java.lang.String[] |
getParameterNames()
Returns an array containing all of the parameter names for this DataCommand |
protected java.sql.PreparedStatement |
getSelectStatement(JDBCDataConnection conn)
|
protected java.sql.PreparedStatement |
getUpdateStatement(JDBCDataConnection conn,
DataRow row)
|
void |
setHavingClause(java.lang.String clause)
|
void |
setOrderByClause(java.lang.String clause)
|
void |
setTableName(java.lang.String tableName)
Sets the name of the table in the Database from which to load/save data |
void |
setWhereClause(java.lang.String clause)
Sets the where clause to use in the query. |
Methods inherited from class org.jdesktop.dataset.provider.sql.SQLCommand |
---|
createPreparedStatement, getDeleteSQL, getInsertSQL, getSelectSQL, getUpdateSQL, setDeleteSQL, setInsertSQL, setSelectSQL, setUpdateSQL |
Methods inherited from class org.jdesktop.dataset.provider.sql.AbstractSqlCommand |
---|
constructSql, getParameterNames, prepareStatement |
Methods inherited from class org.jdesktop.dataset.DataCommand |
---|
addPropertyChangeListener, addPropertyChangeListener, clearParameter, clearParameters, firePropertyChange, getParameter, getParameterValues, getShortDescription, removePropertyChangeListener, setParameter, setShortDescription |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableCommand()
public TableCommand(java.lang.String tableName)
public TableCommand(java.lang.String tableName, java.lang.String whereClause)
Method Detail |
---|
public void setTableName(java.lang.String tableName)
public void setWhereClause(java.lang.String clause)
public void setOrderByClause(java.lang.String clause)
public void setHavingClause(java.lang.String clause)
public java.lang.String[] getParameterNames()
DataCommand
getParameterNames
in class SQLCommand
protected java.sql.PreparedStatement getSelectStatement(JDBCDataConnection conn) throws java.lang.Exception
getSelectStatement
in class SQLCommand
conn
- An active JDBCDataConnection to use to prepare the statement
java.lang.Exception
protected java.sql.PreparedStatement getUpdateStatement(JDBCDataConnection conn, DataRow row) throws java.lang.Exception
getUpdateStatement
in class SQLCommand
conn
- An active JDBCDataConnection to use to prepare the statementrow
- The DataRow
that will be updated
java.lang.Exception
protected java.sql.PreparedStatement getInsertStatement(JDBCDataConnection conn, DataRow row) throws java.lang.Exception
getInsertStatement
in class SQLCommand
conn
- An active JDBCDataConnection to use to prepare the statementrow
- The DataRow
that will be inserted
java.lang.Exception
protected java.sql.PreparedStatement getDeleteStatement(JDBCDataConnection conn, DataRow row) throws java.lang.Exception
getDeleteStatement
in class SQLCommand
conn
- An active JDBCDataConnection to use to prepare the statementrow
- The DataRow
that will be deleted
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |