de.vc.report.sources.db

## Class DBSelection

- java.lang.Object
- - de.vc.report.sources.db.DBSelection

-     public final class DBSelection
      extends java.lang.Object

  The db-selection holds a SQL-mask and mapping from table-column to report keyword. To embed a parameter in the SQL-mask you have to enclose it with '$'. Example:
  select * from table where id>$min_id$
  Remember: If your SQL-mask has paramters you have to define them either by using the setParameter-Method of DBDataSource or for report-tables of a report with the select of report-data.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `XML_ATTR_ALIAS`
    `static java.lang.String` | `XML_ATTR_COLUMN`
    `static java.lang.String` | `XML_TAG`
    `static java.lang.String` | `XML_TAG_COL_ALIAS`
    `static java.lang.String` | `XML_TAG_QUERY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DBSelection()`
    `DBSelection(de.vc.config.Configuration config)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendToSQLMask(java.lang.String string)` Appends a string to SQL-mask.
    `void` | `clearMapping()` Deprecated. Use removeAliases().
    `void` | `configure(de.vc.config.Configuration configuration)` Configures this selection.
    `java.util.Set` | `getColumnAliases(java.lang.String columnName)` Gets a set of all aliases for a column.
    `java.lang.String` | `getColumnName(java.lang.String alias)` Gets the table column name of an alias.
    `java.lang.String` | `getSQLMask()` Gets the SQL-mask of this selection.
    `void` | `mapColumn(java.lang.String fillInName, java.lang.String dbColumnName)` Deprecated. Use setColumnAlias
    `void` | `removeAliases()` Removes all aliases.
    `void` | `setColumnAlias(java.lang.String columnName, java.lang.String alias)` Set an alias for a table column.
    `void` | `setSQLMask(java.lang.String selectSql)` Sets the SQL-mask of this selection.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### XML_ATTR_ALIAS

          public static final java.lang.String XML_ATTR_ALIAS

      See Also:
        Constant Field Values

    - #### XML_ATTR_COLUMN

          public static final java.lang.String XML_ATTR_COLUMN

      See Also:
        Constant Field Values

    - #### XML_TAG

          public static final java.lang.String XML_TAG

      See Also:
        Constant Field Values

    - #### XML_TAG_COL_ALIAS

          public static final java.lang.String XML_TAG_COL_ALIAS

      See Also:
        Constant Field Values

    - #### XML_TAG_QUERY

          public static final java.lang.String XML_TAG_QUERY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DBSelection

          public DBSelection()

    - #### DBSelection

          public DBSelection(de.vc.config.Configuration config)
                      throws de.vc.config.ConfigurationException

      Throws:
        `de.vc.config.ConfigurationException`

  - ### Method Detail

    - #### appendToSQLMask

          public void appendToSQLMask(java.lang.String string)

      Appends a string to SQL-mask.
      Parameters:
        `string` - String.

    - #### clearMapping

          public void clearMapping()

      Deprecated. Use removeAliases().
      Clears the mapping of column-name to fillin-name.

    - #### configure

          public void configure(de.vc.config.Configuration configuration)
                         throws de.vc.config.ConfigurationException

      Configures this selection.
      Parameters:
        `configuration` - Config.
      Throws:
        `de.vc.config.ConfigurationException`

    - #### mapColumn

          public void mapColumn(java.lang.String fillInName,
                       java.lang.String dbColumnName)

      Deprecated. Use setColumnAlias
      Set the mapping of a column.
      Parameters:
        `fillInName` - Name of column in report table model.
        `dbColumnName` - Name of column in database table.

    - #### removeAliases

          public void removeAliases()

      Removes all aliases.

    - #### getColumnAliases

          public java.util.Set getColumnAliases(java.lang.String columnName)

      Gets a set of all aliases for a column.
      Parameters:
        `columnName` - Table column.
      Returns:
        Set of aliases (String).

    - #### getColumnName

          public java.lang.String getColumnName(java.lang.String alias)

      Gets the table column name of an alias.
      Parameters:
        `alias` - Alias.
      Returns:
        Column name.

    - #### getSQLMask

          public java.lang.String getSQLMask()

      Gets the SQL-mask of this selection. Parameters are NOT replaced with their values.
      Returns:
        SQL-mask of this selection.

    - #### setColumnAlias

          public void setColumnAlias(java.lang.String columnName,
                            java.lang.String alias)

      Set an alias for a table column.
      Parameters:
        `columnName` - Name of column.
        `alias` - Alias of column.

    - #### setSQLMask

          public void setSQLMask(java.lang.String selectSql)

      Sets the SQL-mask of this selection.
      Parameters:
        `selectSql` - SQL-mask of this selection.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.