pt.moredata.dao.core
Class SQLDeleteBuilder

java.lang.Object
  extended bypt.moredata.dao.core.AbstractSQLStatementBuilder
      extended bypt.moredata.dao.core.SQLDeleteBuilder
All Implemented Interfaces:
SQLStatementBuilder

public class SQLDeleteBuilder
extends AbstractSQLStatementBuilder
implements SQLStatementBuilder

This class is responsible for building SQL delete commands. The commans are build from a DataAccessObject. Company MoreData

Version:
$Revision: 1.8 $
Author:
pcarmo

Field Summary
 
Fields inherited from class pt.moredata.dao.core.AbstractSQLStatementBuilder
_fieldsInfo, _info, _recordSet
 
Constructor Summary
SQLDeleteBuilder(DAOFieldsInfo fieldsInfo, RecordSet recordSet)
          Creates a new instance of AbstractSQLStatementBuilder
 
Method Summary
protected  java.lang.String getSQLStatement()
          Builds an SQL delete command for interacting with a table of a relational database repository.
 void loadData(java.sql.ResultSet resultSet)
          Load data from a ResultSet into the RecordSet.
protected  void setRecordValueForDelete(java.sql.PreparedStatement statement, java.lang.String tableName, int rowNumber)
          Set the values of the update statement parameters.
 void setStatementParameters(java.sql.PreparedStatement statement, SQLInformation info)
          Set the values of a statement parameters.
 
Methods inherited from class pt.moredata.dao.core.AbstractSQLStatementBuilder
getSQLStatement, getStringObjectWithSpaceAtEnd, setDAOFieldsInfo, setRecordSet, setRecordValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.moredata.dao.SQLStatementBuilder
getSQLStatement, setDAOFieldsInfo, setRecordSet
 

Constructor Detail

SQLDeleteBuilder

public SQLDeleteBuilder(DAOFieldsInfo fieldsInfo,
                        RecordSet recordSet)
Creates a new instance of AbstractSQLStatementBuilder

Parameters:
fieldsInfo - The DAO fields information object.
recordSet - The DAO RecordSet object witch contains the DAO data.
Method Detail

getSQLStatement

protected java.lang.String getSQLStatement()
Builds an SQL delete command for interacting with a table of a relational database repository.

Specified by:
getSQLStatement in class AbstractSQLStatementBuilder
Returns:
A string with the SQL command for interacting with a table of a relational database repository.

setRecordValueForDelete

protected void setRecordValueForDelete(java.sql.PreparedStatement statement,
                                       java.lang.String tableName,
                                       int rowNumber)
                                throws java.sql.SQLException,
                                       WriterException
Set the values of the update statement parameters.

Parameters:
statement - The update statement.
tableName - The table Name of the update statement.
rowNumber - The row number of the update statement.
Throws:
java.sql.SQLException - If there is a database error.
WriterException - If the primary key value is null for the table and row specified.

setStatementParameters

public void setStatementParameters(java.sql.PreparedStatement statement,
                                   SQLInformation info)
                            throws WriterException
Set the values of a statement parameters.

Specified by:
setStatementParameters in interface SQLStatementBuilder
Parameters:
statement - The prepared statement.
info - Adicional information to help building the sql statement.
Throws:
WriteException - If an error occur will setting the statement parameters.
WriterException

loadData

public void loadData(java.sql.ResultSet resultSet)
              throws ReaderException
Description copied from interface: SQLStatementBuilder
Load data from a ResultSet into the RecordSet. This method could and probably would use state build during the execution of the getSQLStatement() method.

Specified by:
loadData in interface SQLStatementBuilder
Parameters:
resultSet - A resultSet with the data to be loaded into the RecordSet.
Throws:
ReaderException