de.esprit.appsuite.database.dbase

## Class SqlCondition

- java.lang.Object
- - de.esprit.appsuite.database.dbase.SqlCondition

- All Implemented Interfaces:
    java.io.Serializable

      public class SqlCondition
      extends java.lang.Object
      implements java.io.Serializable

  This class allows for constructing SQL conditions in an object oriented manner. By adding SqlCondition objects instead of simple condition strings you can achieve bracing in any level of nesting.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `EQUAL`
    `static java.lang.String` | `GREATER`
    `static java.lang.String` | `NOT_EQUAL`
    `static java.lang.String` | `SMALLER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SqlCondition()`
    `SqlCondition(SqlCondition cond)`
    `SqlCondition(java.lang.String cond)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(SqlCondition condition)` Same as `and(SqlCondition)`
    `void` | `add(java.lang.String condition)` Same as `and(String)`
    `void` | `addEqual(DBColumnKey field, int value)` ANDs an equals condition (using the '=' operator)
    `void` | `addEqual(DBColumnKey field, java.lang.String value)` ANDs an equals condition (using the '=' operator)
    `void` | `addEqual(java.lang.String field, int value)` ANDs an equals condition (using the '=' operator)
    `void` | `addEqual(java.lang.String field, java.lang.String value)` ANDs an equals condition (using the '=' operator)
    `void` | `addLike(DBColumnKey field, java.lang.String sqlPattern)` ANDs a match condition (using the 'like' operator)
    `void` | `addLike(java.lang.String field, java.lang.String sqlPattern)` ANDs a match condition (using the 'like' operator)
    `void` | `and(SqlCondition condition)` Adds a nested condition that will be ANDed.
    `void` | `and(java.lang.String condition)` Adds a condition that will be ANDed.
    `void` | `and(java.lang.String field, java.lang.String operator, int value)`
    `void` | `and(java.lang.String field, java.lang.String operator, java.lang.String value)`
    `void` | `andEqual(java.lang.String field, int value)` ANDs an equals condition (using the '=' operator)
    `void` | `andEqual(java.lang.String field, java.lang.String value)` ANDs an equals condition (using the '=' operator)
    `void` | `andIsNotNull(DBColumnKey colKey)` ANDs a 'is not NULL' constraint for the given column
    `void` | `andIsNotNull(java.lang.String field)` ANDs a 'is not NULL' constraint for the given column
    `void` | `andIsNull(DBColumnKey colKey)` ANDs a 'is NULL' constraint for the given column
    `void` | `andIsNull(java.lang.String field)` ANDs a 'is NULL' constraint for the given column
    `java.lang.String` | `getConditionClause()` Returns the fully expanded SQL condition clause not including the WHERE keyord.
    `java.lang.String` | `getWhereCondition()` Returns the fully expanded condition string including the WHERE clause keyord.
    `boolean` | `isEmpty()`
    `void` | `or(SqlCondition condition)` Adds a nested condition that will be ORed.
    `void` | `or(java.lang.String condition)` Adds a condition that will be ORed.
    `void` | `or(java.lang.String field, java.lang.String operator, int value)`
    `void` | `or(java.lang.String field, java.lang.String operator, java.lang.String value)`
    `java.lang.String` | `toString()` Same as getCondition().

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

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

- - ### Field Detail

    - #### NOT_EQUAL

          public static final java.lang.String NOT_EQUAL

      See Also:
        Constant Field Values

    - #### EQUAL

          public static final java.lang.String EQUAL

      See Also:
        Constant Field Values

    - #### GREATER

          public static final java.lang.String GREATER

      See Also:
        Constant Field Values

    - #### SMALLER

          public static final java.lang.String SMALLER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SqlCondition

          public SqlCondition()

    - #### SqlCondition

          public SqlCondition(java.lang.String cond)

    - #### SqlCondition

          public SqlCondition(SqlCondition cond)

  - ### Method Detail

    - #### add

          public void add(SqlCondition condition)

      Same as `and(SqlCondition)`

    - #### add

          public void add(java.lang.String condition)

      Same as `and(String)`

    - #### and

          public void and(java.lang.String field,
                 java.lang.String operator,
                 java.lang.String value)

    - #### and

          public void and(java.lang.String field,
                 java.lang.String operator,
                 int value)

    - #### or

          public void or(java.lang.String field,
                java.lang.String operator,
                java.lang.String value)

    - #### or

          public void or(java.lang.String field,
                java.lang.String operator,
                int value)

    - #### addEqual

          public void addEqual(java.lang.String field,
                      java.lang.String value)

      ANDs an equals condition (using the '=' operator)

    - #### addEqual

          public void addEqual(DBColumnKey field,
                      java.lang.String value)

      ANDs an equals condition (using the '=' operator)

    - #### addEqual

          public void addEqual(java.lang.String field,
                      int value)

      ANDs an equals condition (using the '=' operator)

    - #### addEqual

          public void addEqual(DBColumnKey field,
                      int value)

      ANDs an equals condition (using the '=' operator)

    - #### andEqual

          public void andEqual(java.lang.String field,
                      java.lang.String value)

      ANDs an equals condition (using the '=' operator)

    - #### andEqual

          public void andEqual(java.lang.String field,
                      int value)

      ANDs an equals condition (using the '=' operator)

    - #### addLike

          public void addLike(java.lang.String field,
                     java.lang.String sqlPattern)

      ANDs a match condition (using the 'like' operator)
      Parameters:
        `sqlPattern` - any SQL pattern string like 'A%'

    - #### addLike

          public void addLike(DBColumnKey field,
                     java.lang.String sqlPattern)

      ANDs a match condition (using the 'like' operator)
      Parameters:
        `sqlPattern` - any SQL pattern string like 'A%'

    - #### and

          public void and(SqlCondition condition)

      Adds a nested condition that will be ANDed.

    - #### and

          public void and(java.lang.String condition)

      Adds a condition that will be ANDed.

    - #### or

          public void or(SqlCondition condition)

      Adds a nested condition that will be ORed.

    - #### or

          public void or(java.lang.String condition)

      Adds a condition that will be ORed.

    - #### andIsNull

          public void andIsNull(DBColumnKey colKey)

      ANDs a 'is NULL' constraint for the given column

    - #### andIsNull

          public void andIsNull(java.lang.String field)

      ANDs a 'is NULL' constraint for the given column

    - #### andIsNotNull

          public void andIsNotNull(DBColumnKey colKey)

      ANDs a 'is not NULL' constraint for the given column

    - #### andIsNotNull

          public void andIsNotNull(java.lang.String field)

      ANDs a 'is not NULL' constraint for the given column

    - #### isEmpty

          public boolean isEmpty()

    - #### toString

          public java.lang.String toString()

      Same as getCondition().
      Overrides:
        `toString` in class `java.lang.Object`
      See Also:
        `getConditionClause()`

    - #### getWhereCondition

          public java.lang.String getWhereCondition()

      Returns the fully expanded condition string including the WHERE clause keyord.
      See Also:
        `getConditionClause()`

    - #### getConditionClause

          public java.lang.String getConditionClause()

      Returns the fully expanded SQL condition clause not including the WHERE keyord.

Copyright © 2014 EsprIT-Systems. All Rights Reserved.