DEPRECATED This class has been deprecated in favor of using a `com.bea.p13n.content.document.ref.RefSQLGenerator``` instance configured as needed.

# com.bea.p13n.content.document.ref
StatementParams Class

public class StatementParams
extends `Object`

A little holder class for the information required to create and execute a PreparedStatement, plus how to convert a Search/Expression into a StatementParams.

This class is specific to the table structure of the RefDocumentProvider.

Hierarchy
  `Object`
  `StatementParams`

## Field Summary

`public static final short` | `AND_TYPE` The LogicalAnd/LogicalMulitAnd expression type.
`public static final short` | `COLLECTION_CONTAINS_ALL_TYPE` The CollectionContainsAll expression type.
`public static final short` | `COLLECTION_CONTAINS_TYPE` The CollectionContains expression type.
`public static final `DateFormat`` | `dateFormat` A date formatter for "MM/dd/yyyy HH:mm:ss z" (02/28/2000 15:58:35 MST).
`public static final `String`` | `DOC_MD_TABLE` The document_metadata table name.
`public static final `String`` | `DOC_TABLE` The document table name.
`public static final short` | `EQUALS_TYPE` The Equals expression type.
`public static final short` | `GREATER_OR_EQUALS_TYPE` The GreaterOrEquals expression type.
`public static final short` | `GREATER_THAN_TYPE` The GreaterThan expression type.
`public static final short` | `LESS_OR_EQUALS_TYPE` The LessOrEquals expression type.
`public static final short` | `LESS_THAN_TYPE` The LessThan expression type.
`public static final short` | `LIKE_TYPE` The StringLike expression type.
`public long` | `maxReturn` The max number to return (0 or less for all).
`public static final short` | `NOT_EQUALS_TYPE` The NotEquals expression type.
`public static final short` | `NOT_TYPE` The LogicalNot expression type.
`public static final short` | `OR_TYPE` The LogicalOr/LogicalMulitOr expression type.
`public `List`` | `params` The list of input parameters that match up with the SQL string.
`public `com.bea.p13n.content.expression.SortCriteria`` | `sortCriteria` The list of SortCriteria needing to be applied.
`public `String`` | `sql` The SQL string.

## Constructor Summary

StatementParams()

## Method Summary

`protected static void` | `createBranchStatementParams`(`StringBuffer` buf, `Expression` expr, `List` params, boolean supportsLikeEscapeClause) Utility to convert a branch expression into a SQL expression.
`protected static void` | `createLeafStatementParams`(`StringBuffer` buf, `Expression` expr, `List` params, boolean supportsLikeEscapeClause) Utility to convert a valid leaf Expression into a SQL expression.
`protected static `String`` | `createStatementParams`(`Expression` expr, `List` params, boolean supportsLikeEscapeClause) Utility method to convert an Expression into a SQL expression.
`protected static void` | `createStatementParams`(`StringBuffer` buf, `Expression` expr, `List` params, boolean supportsLikeEscapeClause) Utility method to convert an Expression into a SQL expression.
`public static `String`` | `getExpressionString`(short type) Get the expression string for the specified expression type.
`public static short` | `getExpressionType`(`Expression` expr) Get a type constant for the given expression.
`protected static `PropertyRef`` | `getLeftHandSide`(`Expression` expr) Get the left-hand-side of an expression.
`protected static `Object`` | `getRightHandSide`(`Expression` expr) Get the right-hand-side of an expression.
`public static `String`` | `getSQLOperator`(short type) Return the corresponding SQL operator for the given expression type.
`public static `StatementParams`` | `getStatementParams`(`String` baseSql, `Search` params, boolean supportsLikeEscapeClause) Utility method to get a StatementParams from Search params.
`protected static `Expression`` | `getSubExpression`(`Expression` expr, int count) Get the specified subexpression.
`public static boolean` | `isLegalSingleValueExpressionType`(short type) Determine if a comparator is legal, single-value attribute comparator.
`public `PreparedStatement`` | `prepare`(`Connection` con) Prepare a statement from our sql and input params on the given database connection.
`public void` | `sort`(`List` list) Sort a list of DocumentMetadataDefs based upon our sort criteria.
`public static `String`` | `toSQLLike`(`String` like, boolean supportsLikeEscapeClause) Convert a query LIKE value to a SQL LIKE value.
`public static `Object`` | `toSQLLike`(`Object` obj, boolean supportsLikeEscapeClause) Convert an object, which might be a string, to a SQL like string.

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

## Field Detail

### AND_TYPE

    public static final short AND_TYPE

  The LogicalAnd/LogicalMulitAnd expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### COLLECTION_CONTAINS_ALL_TYPE

    public static final short COLLECTION_CONTAINS_ALL_TYPE

  The CollectionContainsAll expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### COLLECTION_CONTAINS_TYPE

    public static final short COLLECTION_CONTAINS_TYPE

  The CollectionContains expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### dateFormat

    public static final DateFormat dateFormat

  A date formatter for "MM/dd/yyyy HH:mm:ss z" (02/28/2000 15:58:35 MST).

### DOC_MD_TABLE

    public static final String DOC_MD_TABLE

  The document_metadata table name.

Related Topics

``RefDocumentProvider.DOC_MD_TABLE``

### DOC_TABLE

    public static final String DOC_TABLE

  The document table name.

Related Topics

``RefDocumentProvider.DOC_TABLE``

### EQUALS_TYPE

    public static final short EQUALS_TYPE

  The Equals expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### GREATER_OR_EQUALS_TYPE

    public static final short GREATER_OR_EQUALS_TYPE

  The GreaterOrEquals expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### GREATER_THAN_TYPE

    public static final short GREATER_THAN_TYPE

  The GreaterThan expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### LESS_OR_EQUALS_TYPE

    public static final short LESS_OR_EQUALS_TYPE

  The LessOrEquals expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### LESS_THAN_TYPE

    public static final short LESS_THAN_TYPE

  The LessThan expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### LIKE_TYPE

    public static final short LIKE_TYPE

  The StringLike expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### maxReturn

    public long maxReturn

  The max number to return (0 or less for all).

### NOT_EQUALS_TYPE

    public static final short NOT_EQUALS_TYPE

  The NotEquals expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### NOT_TYPE

    public static final short NOT_TYPE

  The LogicalNot expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### OR_TYPE

    public static final short OR_TYPE

  The LogicalOr/LogicalMulitOr expression type.

Related Topics

``StatementParams.getExpressionType(Expression)``

### params

    public List params

  The list of input parameters that match up with the SQL string.

### sortCriteria

    public com.bea.p13n.content.expression.SortCriteria sortCriteria

  The list of SortCriteria needing to be applied.

  This will be null or empty if no additional sorting is required.

### sql

    public String sql

  The SQL string.

## Constructor Detail

### StatementParams

    public StatementParams()

## Method Detail

### createBranchStatementParams(StringBuffer, Expression, List, boolean) Method

    protected static void createBranchStatementParams(StringBuffer buf,
                                                      Expression expr,
                                                      List params,
                                                      boolean supportsLikeEscapeClause)
         throws DocumentException

Utility to convert a branch expression into a SQL expression.

#### Parameters

buf
  the string buffer to write into.

expr
  the branch expression.

params
  the prepared statement input parameters list (will be appended to).

supportsLikeEscapeClause
  tells if the SQL statement can use the LIKE ESCAPE clause.

#### Returns

the SQL expression (no WHERE, no SELECT).

#### Exceptions

``DocumentException``
  thrown on invalid expression data.

### createLeafStatementParams(StringBuffer, Expression, List, boolean) Method

    protected static void createLeafStatementParams(StringBuffer buf,
                                                    Expression expr,
                                                    List params,
                                                    boolean supportsLikeEscapeClause)
         throws DocumentException

Utility to convert a valid leaf Expression into a SQL expression.

#### Parameters

buf
  the string buffer to write into.

expr
  the expression object.

params
  the prepared statement input parameters list (will be appended to).

supportsLikeEscapeClause
  tells if the SQL statement can use the LIKE ESCAPE clause.

#### Returns

the SQL expression (no WHERE, no SELECT).

#### Exceptions

``DocumentException``
  thrown on invalid expression data.

### createStatementParams(Expression, List, boolean) Method

    protected static String createStatementParams(Expression expr,
                                                  List params,
                                                  boolean supportsLikeEscapeClause)
         throws DocumentException

Utility method to convert an Expression into a SQL expression.

#### Parameters

expr
  the expression object.

params
  the prepared statement input parameters list (will be appended to).

supportsLikeEscapeClause
  tells if the SQL statement can use the LIKE ESCAPE clause.

#### Returns

the SQL expression (no WHERE, no SELECT).

#### Exceptions

``DocumentException``
  thrown on invalid expression data.

### createStatementParams(StringBuffer, Expression, List, boolean) Method

    protected static void createStatementParams(StringBuffer buf,
                                                Expression expr,
                                                List params,
                                                boolean supportsLikeEscapeClause)
         throws DocumentException

Utility method to convert an Expression into a SQL expression.

#### Parameters

buf
  the string buffer to write into.

expr
  the expression object.

params
  the prepared statement input parameters list (will be appended to).

supportsLikeEscapeClause
  tells if the SQL statement can use the LIKE ESCAPE clause.

#### Returns

the SQL expression (no WHERE, no SELECT).

#### Exceptions

``DocumentException``
  thrown on invalid expression data.

### getExpressionString(short) Method

    public static String getExpressionString(short type)
         throws DocumentException

Get the expression string for the specified expression type.

#### Exceptions

``DocumentException``

Related Topics

``StatementParams.NOT_EQUALS_TYPE``
``StatementParams.EQUALS_TYPE``
``StatementParams.GREATER_THAN_TYPE``
``StatementParams.LESS_THAN_TYPE``
``StatementParams.GREATER_OR_EQUALS_TYPE``
``StatementParams.LESS_OR_EQUALS_TYPE``
``StatementParams.LIKE_TYPE``
``StatementParams.COLLECTION_CONTAINS_TYPE``
``StatementParams.COLLECTION_CONTAINS_ALL_TYPE``
``StatementParams.AND_TYPE``
``StatementParams.OR_TYPE``
``StatementParams.NOT_TYPE``

### getExpressionType(Expression) Method

    public static short getExpressionType(Expression expr)
         throws DocumentException

Get a type constant for the given expression.

#### Exceptions

``DocumentException``

Related Topics

``StatementParams.NOT_EQUALS_TYPE``
``StatementParams.EQUALS_TYPE``
``StatementParams.GREATER_THAN_TYPE``
``StatementParams.LESS_THAN_TYPE``
``StatementParams.GREATER_OR_EQUALS_TYPE``
``StatementParams.LESS_OR_EQUALS_TYPE``
``StatementParams.LIKE_TYPE``
``StatementParams.COLLECTION_CONTAINS_TYPE``
``StatementParams.COLLECTION_CONTAINS_ALL_TYPE``
``StatementParams.AND_TYPE``
``StatementParams.OR_TYPE``
``StatementParams.NOT_TYPE``

### getLeftHandSide(Expression) Method

    protected static PropertyRef getLeftHandSide(Expression expr)
         throws DocumentException

Get the left-hand-side of an expression.

#### Exceptions

``DocumentException``
  thrown on invalid expression.

Related Topics

``ExpressionHelper.getLeftHandSide(Expression)``

### getRightHandSide(Expression) Method

    protected static Object getRightHandSide(Expression expr)
         throws DocumentException

Get the right-hand-side of an expression.

#### Exceptions

``DocumentException``
  thrown on invalid expression.

Related Topics

``ExpressionHelper.getRightHandSide(Expression)``

### getSQLOperator(short) Method

    public static String getSQLOperator(short type)
         throws DocumentException

Return the corresponding SQL operator for the given expression type.

#### Parameters

type
  the comparator (one from TypesHelper).

#### Exceptions

``DocumentException``

### getStatementParams(String, Search, boolean) Method

    public static StatementParams getStatementParams(String baseSql,
                                                     Search params,
                                                     boolean supportsLikeEscapeClause)
         throws DocumentException

Utility method to get a StatementParams from Search params.

#### Parameters

baseSql
  the base select part of the sql (no from, no where, "doc" is document table, "md" is document_metadata table).

params
  the list to add the prepared statement parameters to.

supportsLikeEscapeClause
  tells if the SQL statement can use the LIKE ESCAPE clause.

#### Exceptions

``DocumentException``

### getSubExpression(Expression, int) Method

    protected static Expression getSubExpression(Expression expr,
                                                 int count)
         throws DocumentException

Get the specified subexpression.

#### Exceptions

``DocumentException``
  thrown on invalid expression.

Related Topics

``ExpressionHelper.getSubExpression(Expression, int)``

### isLegalSingleValueExpressionType(short) Method

    public static boolean isLegalSingleValueExpressionType(short type)

Determine if a comparator is legal, single-value attribute comparator.

### prepare(Connection) Method

    public PreparedStatement prepare(Connection con)
         throws SQLException

Prepare a statement from our sql and input params on the given database connection.

#### Exceptions

``SQLException``

### sort(List) Method

    public void sort(List list)
         throws DocumentException

Sort a list of DocumentMetadataDefs based upon our sort criteria.

#### Exceptions

``DocumentException``

### toSQLLike(String, boolean) Method

    public static String toSQLLike(String like,
                                   boolean supportsLikeEscapeClause)

Convert a query LIKE value to a SQL LIKE value.

### toSQLLike(Object, boolean) Method

    public static Object toSQLLike(Object obj,
                                   boolean supportsLikeEscapeClause)

Convert an object, which might be a string, to a SQL like string.