# com.bea.control
DatabaseFilter Class

public class DatabaseFilter
extends `Object`
implements `Serializable`

The DatabaseFilter class is a helper class for SQL generation.
NOTE: Depending on the database, column names may be case-sensitive. The most reliable way to avoid column name mistakes is to use setResultSetMetaData(). SQL Generation helper class

Hierarchy
  `Object`
  `DatabaseFilter`

All Implemented Interfaces
  `Serializable`

## Nested Class Summary

`public static class` | `DatabaseFilter.FilterTerm`
`public static class` | `DatabaseFilter.SortTerm`

## Field Summary

`protected char` | `_chFilter` char
`protected `HashMap`` | `_columns` HashMap
`protected `DatabaseFilter.FilterTerm`` | `_filter` DatabaseFilter.FilterTerm
`protected int` | `_identifierOptions` int
`protected int` | `_maxSortCols` int
`protected `DatabaseMetaData`` | `_mdDatabase` DatabaseMetaData
`protected `ResultSetMetaData`` | `_mdResultSet` ResultSetMetaData
`protected `String`` | `_sIdentifierQuote` String
`protected `DatabaseFilter.SortTerm`` | `_sort` DatabaseFilter.SortTerm
`public static final int` | `IDENTIFIER_ASIS` int
`public static final int` | `IDENTIFIER_CHANGECASE` int
`public static final int` | `IDENTIFIER_DEFAULT` int
`public static final int` | `IDENTIFIER_QUOTE` int
`public static final int` | `IDENTIFIER_TOLOWER` int
`public static final int` | `IDENTIFIER_TOUPPER` int
`public static final int` | `opAsc` int
`public static final int` | `opContains` int
`public static final int` | `opDesc` int
`public static final int` | `opEmpty` int
`public static final int` | `opEqual` int
`public static final int` | `opGreater` int
`public static final int` | `opGreaterEqual` int
`public static final int` | `opIn` int
`public static final int` | `opInvalid` int
`public static final int` | `opIs` int
`public static final int` | `opIsNot` int
`public static final int` | `opLess` int
`public static final int` | `opLessEqual` int
`public static final int` | `opNotEqual` int
`public static final int` | `opStartsWith` int
`public static final `String`` | `sContains` String
`public static final `String`` | `sEmpty` String
`public static final `String`` | `sEquals` String
`public static final `String`` | `sFilterChar` String
`public static final `String`` | `sGreaterEqual` String
`public static final `String`` | `sGreaterThan` String
`public static final `String`` | `sIn` String
`public static final `String`` | `sIsEmpty` String
`public static final `String`` | `sIsNotEmpty` String
`public static final `String`` | `sLessEqual` String
`public static final `String`` | `sLessThan` String
`public static final `String`` | `sNotEqual` String
`public static final `String`` | `sStartsWith` String
`public static final `String`` | `sUnitDate` String
`public static final `String`` | `sUnitMonth` String
`public static final `String`` | `sUnitYear` String
`public static final int` | `unitDate` int
`public static final int` | `unitDefault` int
`public static final int` | `unitMonth` int
`public static final int` | `unitYear` int

## Constructor Summary

DatabaseFilter()
DatabaseFilter(`DatabaseFilter.FilterTerm` filter, `DatabaseFilter.SortTerm` sort)

## Method Summary

`public `DatabaseControl.SQLFragment`` | `getFilterExpression`()
`public `DatabaseControl.SQLFragment`` | `getOrderByClause`()
`public `DatabaseControl.SQLFragment`` | `getSortExpression`()
`public `DatabaseControl.SQLFragment`` | `getWhereClause`()
`public `Calendar`` | `parseDate`(`CharSequence` buf, `Calendar` calDefault) Parse a date in ISO8601 or SOAP format.
`public void` | `parseQueryString`(`String` query)
`public void` | `parseQueryString`(`String` query, `String` prefix, `String` enc)
`public void` | `setDatabaseMetaData`(`DatabaseMetaData` md)
`public void` | `setIdentifierOptions`(int flags) control handling of identifiers in generated SQL.
`public void` | `setResultSetMetaData`(`ResultSetMetaData` md)

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### _chFilter

    protected char _chFilter

### _columns

    protected HashMap _columns

### _filter

    protected DatabaseFilter.FilterTerm _filter

### _identifierOptions

    protected int _identifierOptions

### _maxSortCols

    protected int _maxSortCols

### _mdDatabase

    protected DatabaseMetaData _mdDatabase

### _mdResultSet

    protected ResultSetMetaData _mdResultSet

### _sIdentifierQuote

    protected String _sIdentifierQuote

### _sort

    protected DatabaseFilter.SortTerm _sort

### IDENTIFIER_ASIS

    public static final int IDENTIFIER_ASIS

### IDENTIFIER_CHANGECASE

    public static final int IDENTIFIER_CHANGECASE

### IDENTIFIER_DEFAULT

    public static final int IDENTIFIER_DEFAULT

### IDENTIFIER_QUOTE

    public static final int IDENTIFIER_QUOTE

### IDENTIFIER_TOLOWER

    public static final int IDENTIFIER_TOLOWER

### IDENTIFIER_TOUPPER

    public static final int IDENTIFIER_TOUPPER

### opAsc

    public static final int opAsc

### opContains

    public static final int opContains

### opDesc

    public static final int opDesc

### opEmpty

    public static final int opEmpty

### opEqual

    public static final int opEqual

### opGreater

    public static final int opGreater

### opGreaterEqual

    public static final int opGreaterEqual

### opIn

    public static final int opIn

### opInvalid

    public static final int opInvalid

### opIs

    public static final int opIs

### opIsNot

    public static final int opIsNot

### opLess

    public static final int opLess

### opLessEqual

    public static final int opLessEqual

### opNotEqual

    public static final int opNotEqual

### opStartsWith

    public static final int opStartsWith

### sContains

    public static final String sContains

### sEmpty

    public static final String sEmpty

### sEquals

    public static final String sEquals

### sFilterChar

    public static final String sFilterChar

### sGreaterEqual

    public static final String sGreaterEqual

### sGreaterThan

    public static final String sGreaterThan

### sIn

    public static final String sIn

### sIsEmpty

    public static final String sIsEmpty

### sIsNotEmpty

    public static final String sIsNotEmpty

### sLessEqual

    public static final String sLessEqual

### sLessThan

    public static final String sLessThan

### sNotEqual

    public static final String sNotEqual

### sStartsWith

    public static final String sStartsWith

### sUnitDate

    public static final String sUnitDate

### sUnitMonth

    public static final String sUnitMonth

### sUnitYear

    public static final String sUnitYear

### unitDate

    public static final int unitDate

### unitDefault

    public static final int unitDefault

### unitMonth

    public static final int unitMonth

### unitYear

    public static final int unitYear

## Constructor Detail

### DatabaseFilter

    public DatabaseFilter()

### DatabaseFilter

    public DatabaseFilter(DatabaseFilter.FilterTerm[] filter,
                          DatabaseFilter.SortTerm[] sort)

## Method Detail

### getFilterExpression() Method

    public DatabaseControl.SQLFragment getFilterExpression()

### getOrderByClause() Method

    public DatabaseControl.SQLFragment getOrderByClause()

### getSortExpression() Method

    public DatabaseControl.SQLFragment getSortExpression()

### getWhereClause() Method

    public DatabaseControl.SQLFragment getWhereClause()

### parseDate(CharSequence, Calendar) Method

    public Calendar parseDate(CharSequence buf,
                              Calendar calDefault)

Parse a date in ISO8601 or SOAP format. `1999-05-31 13:20:00.000 1999-05-31T13:20:00Z 1999-05-31T13:20:00-05:00`

#### Returns

Calendar if the timezone is explicit (as in 2nd and 3rd) example the TimeZone of the returned calendar will be UTC. Otherwise the TimeZone will be as indicated by `calDefault` if specified, or the system default otherwize.

### parseQueryString(String) Method

    public void parseQueryString(String query)

### parseQueryString(String, String, String) Method

    public void parseQueryString(String query,
                                 String prefix,
                                 String enc)
         throws UnsupportedEncodingException

#### Exceptions

``UnsupportedEncodingException``

### setDatabaseMetaData(DatabaseMetaData) Method

    public void setDatabaseMetaData(DatabaseMetaData md)

### setIdentifierOptions(int) Method

    public void setIdentifierOptions(int flags)

control handling of identifiers in generated SQL. If setResultSetMetaData() is called IDENTIFIER_TOUPPER and IDENTIFIER_TOLOWER are ignored and the case will be as specificied by metadata.getColumnName()

### setResultSetMetaData(ResultSetMetaData) Method

    public void setResultSetMetaData(ResultSetMetaData md)
         throws SQLException

#### Exceptions

``SQLException``