Overview | Package | Class | Use | Tree | Help
| HEADER
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ru.biosoft.access
Interface SqlTransformer

All Known Implementing Classes:
  SqlTransformerSupport

public interface SqlTransformer

Adapter for storing/extracting data elements to/from SQL DBMS.

See Also: SqlDataCollection

Method Summary
`void` | `addDeleteCommands(Statement statement, String name)` Adds set of SQL commands to the statement to remove data element from the table.
`void` | `addInsertCommands(Statement statement, DataElement de)` Adds set of SQL commands to the statement to insert data element into the table.
`void` | `addUpdateCommands(Statement statement, DataElement de)` Adds set of SQL commands to the statement to update data element in the table.
`DataElement` | `create(ResultSet resultSet, Connection connection)` Extracts all needed fields from resultSet, and create instance of DataElement.
`String` | `getCountQuery()` Creates SQL query for extracting count of data elements in the table.
`String` | `getElementExistsQuery(String name)` Creates SQL query for test is data element with specified name exists in the table.
`String` | `getElementQuery(String name)` Creates SQL query for extracting data element with specified name from table.
`String` | `getNameListQuery()` Creates SQL query for extracting names for all data elements.
`String` | `getSelectQuery()` Creates SQL query for extracting all data elements from table.
`String` | `getTable()` Returns main database table used by this transformer.
`Class` | `getTemplateClass()` Returns class of object.
`boolean` | `init(DataCollection owner)` Initialize transformer.

Method Detail

### addDeleteCommands

    public void addDeleteCommands(Statement statement, String name)
                            throws java.lang.Exception

  Adds set of SQL commands to the statement to remove data element from the table.
  Parameters:
    statement - - statement to which SQL commands should be added.
    de - - object for which DELETE statements will be generated.

### addInsertCommands

    public void addInsertCommands(Statement statement, DataElement de)
                            throws java.lang.Exception

  Adds set of SQL commands to the statement to insert data element into the table.
  Parameters:
    statement - - statement to which SQL commands should be added.
    de - - object for which INSERT statements will be generated.

### addUpdateCommands

    public void addUpdateCommands(Statement statement, DataElement de)
                            throws java.lang.Exception

  Adds set of SQL commands to the statement to update data element in the table.
  Parameters:
    statement - - statement to which SQL commands should be added.
    de - - object for which UPDATE statements will be generated.

### create

    public DataElement create(ResultSet resultSet, Connection connection)
                        throws java.lang.Exception

  Extracts all needed fields from resultSet, and create instance of DataElement. If necessary the method can use additional queries to get needed data using the specified connection.
  Parameters:
    resultSet - ResultSet from DBMS.
    connection - to be used if additional query is needed.
  Returns: created data element.
  See Also:
    getTemplateClass()

### getCountQuery

    public String getCountQuery()

  Creates SQL query for extracting count of data elements in the table.
  Returns: SQL query for extracting count of data elements in the table.

### getElementExistsQuery

    public String getElementExistsQuery(String name)

  Creates SQL query for test is data element with specified name exists in the table.
  Parameters:
    name - Name (PK) of needed data element.
  Returns: SQL query for testing data element with specified name in the table.

### getElementQuery

    public String getElementQuery(String name)

  Creates SQL query for extracting data element with specified name from table.
  Parameters:
    name - Name (PK) of needed data element.
  Returns: SQL query for extracting data element with specified name from table.

### getNameListQuery

    public String getNameListQuery()

  Creates SQL query for extracting names for all data elements. Data element names should be sorted alphabetically.
  Returns: SQL query for extracting count of data elements in the table.

### getSelectQuery

    public String getSelectQuery()

  Creates SQL query for extracting all data elements from table.
  Returns: SQL query for extracting all data elements from table.

### getTable

    public String getTable()

  Returns main database table used by this transformer. Generally main table is table that is used in FROM clause.

### getTemplateClass

    public Class getTemplateClass()

  Returns class of object.
  Returns: Class of transformed object.
  See Also:
    #create(java.sql.ResultSet)

### init

    public boolean init(DataCollection owner)

  Initialize transformer. Must be called by client after SqlTransformer's constructor, and before using instance of SqlTransformer.
  Returns: `true` - if succeeded, `false` - otherwise.

Overview | Package | Class | Use | Tree | Help
| FOOTER
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

BOTTOM