Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | 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(java.sql.Statement statement, java.lang.String name)` Adds set of SQL commands to the statement to remove data element from the table.
`void` | `addInsertCommands(java.sql.Statement statement, DataElement de)` Adds set of SQL commands to the statement to insert data element into the table.
`void` | `addUpdateCommands(java.sql.Statement statement, DataElement de)` Adds set of SQL commands to the statement to update data element in the table.
`DataElement` | `create(java.sql.ResultSet resultSet, java.sql.Connection connection)` Extracts all needed fields from resultSet, and create instance of DataElement.
`java.lang.String` | `getCountQuery()` Creates SQL query for extracting count of data elements in the table.
`java.lang.String` | `getElementExistsQuery(java.lang.String name)` Creates SQL query for test is data element with specified name exists in the table.
`java.lang.String` | `getElementQuery(java.lang.String name)` Creates SQL query for extracting data element with specified name from table.
`java.lang.String` | `getNameListQuery()` Creates SQL query for extracting names for all data elements.
`java.lang.String` | `getSelectQuery()` Creates SQL query for extracting all data elements from table.
`java.lang.String` | `getTable()` Returns main database table used by this transformer.
`java.lang.Class` | `getTemplateClass()` Returns class of object.
`boolean` | `init(DataCollection owner)` Initialize transformer.

Method Detail

### 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.

### getTemplateClass

    public java.lang.Class getTemplateClass()

  Returns class of object.

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

### getTable

    public java.lang.String getTable()

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

### create

    public DataElement create(java.sql.ResultSet resultSet,
                              java.sql.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.
  Throws:
    `java.lang.Exception`
  See Also:
    `getTemplateClass()`

### getSelectQuery

    public java.lang.String getSelectQuery()

  Creates SQL query for extracting all data elements from table.

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

### getCountQuery

    public java.lang.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.

### getNameListQuery

    public java.lang.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.

### getElementQuery

    public java.lang.String getElementQuery(java.lang.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.

### getElementExistsQuery

    public java.lang.String getElementExistsQuery(java.lang.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.

### addInsertCommands

    public void addInsertCommands(java.sql.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.
  Throws:
    `java.lang.Exception`

### addUpdateCommands

    public void addUpdateCommands(java.sql.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.
  Throws:
    `java.lang.Exception`

### addDeleteCommands

    public void addDeleteCommands(java.sql.Statement statement,
                                  java.lang.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.
  Throws:
    `java.lang.Exception`

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

Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.