org.opengts.dbtools
Class DBWhere

java.lang.Object
  extended by org.opengts.dbtools.DBWhere

public class DBWhere
extends java.lang.Object

DBWhere represents an SQL WHERE clause.


Field Summary
static int KEY_AUTO_INDEX
           
static int KEY_FULL
           
static int KEY_PARTIAL_ALL
           
static int KEY_PARTIAL_ALL_EMPTY
           
static int KEY_PARTIAL_FIRST
           
 
Constructor Summary
DBWhere(DBFactory fact)
          Constructor
 
Method Summary
 java.lang.String _AND_(java.lang.String op1, java.lang.String op2)
          "operand1 AND operand2"
 java.lang.String _OR_(java.lang.String op1, java.lang.String op2)
          "operand1 OR operand2"
 java.lang.String AND_(java.lang.String op)
          "AND operand"
 java.lang.String AND(java.lang.String[] op)
          "(operand AND ...)"
 java.lang.String AND(java.lang.String op1, java.lang.String op2)
          "(operand1 AND operand2)"
 java.lang.String AND(java.lang.String op1, java.lang.String op2, java.lang.String op3)
          "(operand1 AND operand2 AND operand3)"
 java.lang.String AND(java.lang.String op1, java.lang.String op2, java.lang.String op3, java.lang.String op4)
          "(operand1 AND operand2 AND operand3 AND operand4)"
 java.lang.String AND(java.lang.String op1, java.lang.String op2, java.lang.String op3, java.lang.String op4, java.lang.String op5)
          "(operand1 AND operand2 AND operand3 AND operand4 AND operand5)"
 java.lang.StringBuffer append(java.lang.String s)
          Append the specified String to the internal accumulator StringBuffer
 java.lang.String EQ(java.lang.String fld, boolean value)
          "(field = value)"
 java.lang.String EQ(java.lang.String fld, double value)
          "(field = value)"
 java.lang.String EQ(java.lang.String fld, int value)
          "(field = value)"
 java.lang.String EQ(java.lang.String fld, long value)
          "(field = value)"
 java.lang.String EQ(java.lang.String fld, java.lang.Object value)
          "(field = value)"
 java.lang.String GE(java.lang.String fld, double value)
          "(field >= value)"
 java.lang.String GE(java.lang.String fld, int value)
          "(field >= value)"
 java.lang.String GE(java.lang.String fld, long value)
          "(field >= value)"
 java.lang.String GE(java.lang.String fld, java.lang.Object value)
          "(field >= value)"
 java.lang.String GT(java.lang.String fld, double value)
          "(field > value)"
 java.lang.String GT(java.lang.String fld, int value)
          "(field > value)"
 java.lang.String GT(java.lang.String fld, long value)
          "(field > value)"
 java.lang.String GT(java.lang.String fld, java.lang.Object value)
          "(field > value)"
 java.lang.String INLIST(java.lang.String fld, int[] list)
          "(field=value0 OR field=value1 ...)"
 java.lang.String INLIST(java.lang.String fld, java.lang.Iterable<?> list)
          "(field=value0 OR field=value1 ...)"
 java.lang.String INLIST(java.lang.String fld, long[] list)
          "(field=value0 OR field=value1 ...)"
 java.lang.String INLIST(java.lang.String fld, java.lang.Object[] list)
          "(field=value0 OR field=value1 ...)"
 java.lang.String LE(java.lang.String fld, double value)
          "(field <= value)"
 java.lang.String LE(java.lang.String fld, int value)
          "(field <= value)"
 java.lang.String LE(java.lang.String fld, long value)
          "(field <= value)"
 java.lang.String LE(java.lang.String fld, java.lang.Object value)
          "(field <= value)"
 java.lang.String LIKE(java.lang.String fld, java.lang.String value)
          "field LIKE '...%...'"
 java.lang.String LT(java.lang.String fld, double value)
          "(field < value)"
 java.lang.String LT(java.lang.String fld, int value)
          "(field < value)"
 java.lang.String LT(java.lang.String fld, long value)
          "(field < value)"
 java.lang.String LT(java.lang.String fld, java.lang.Object value)
          "(field < value)"
static void main(java.lang.String[] argv)
          Main entry point for testing/debugging
 java.lang.String NE(java.lang.String fld, boolean value)
          "(field != value)"
 java.lang.String NE(java.lang.String fld, double value)
          "(field != value)"
 java.lang.String NE(java.lang.String fld, int value)
          "(field != value)"
 java.lang.String NE(java.lang.String fld, long value)
          "(field != value)"
 java.lang.String NE(java.lang.String fld, java.lang.Object value)
          "(field != value)"
 java.lang.String OR_(java.lang.String op)
          "OR operand"
 java.lang.String OR(java.lang.String[] op)
          "(operand OR ...)"
 java.lang.String OR(java.lang.String op1, java.lang.String op2)
          "(operand1 OR operand2)"
 java.lang.String OR(java.lang.String op1, java.lang.String op2, java.lang.String op3)
          "(operand1 OR operand2 OR operand3)"
 java.lang.String OR(java.lang.String op1, java.lang.String op2, java.lang.String op3, java.lang.String op4)
          "(operand1 OR operand2 OR operand3 OR operand4)"
 java.lang.String STARTSWITH(java.lang.String fld, java.lang.String value)
          "field LIKE '...%...'"
 java.lang.String toString()
          Returns a String representation of this DBWhere instance
 java.lang.String WHERE_(java.lang.String conditions)
          "WHERE conditions"
 java.lang.String WHERE(java.lang.String conditions)
          "WHERE (conditions)"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_FULL

public static int KEY_FULL

KEY_PARTIAL_FIRST

public static int KEY_PARTIAL_FIRST

KEY_PARTIAL_ALL

public static int KEY_PARTIAL_ALL

KEY_PARTIAL_ALL_EMPTY

public static int KEY_PARTIAL_ALL_EMPTY

KEY_AUTO_INDEX

public static int KEY_AUTO_INDEX
Constructor Detail

DBWhere

public DBWhere(DBFactory fact)
Constructor

Parameters:
fact - The table DBFactory
Method Detail

append

public java.lang.StringBuffer append(java.lang.String s)
Append the specified String to the internal accumulator StringBuffer

Parameters:
s - The String to append
Returns:
The accumulator StringBuffer instance

toString

public java.lang.String toString()
Returns a String representation of this DBWhere instance

Overrides:
toString in class java.lang.Object
Returns:
A String representation of this DBWhere instance

AND_

public java.lang.String AND_(java.lang.String op)
"AND operand"

Parameters:
op - The operand
Returns:
A String representation of the internal temporary StringBuffer

_AND_

public java.lang.String _AND_(java.lang.String op1,
                              java.lang.String op2)
"operand1 AND operand2"

Parameters:
op1 - The first operand
op2 - The second operand
Returns:
A String representation of the internal temporary StringBuffer

AND

public java.lang.String AND(java.lang.String op1,
                            java.lang.String op2)
"(operand1 AND operand2)"

Parameters:
op1 - The first operand
op2 - The second operand
Returns:
A String representation of the internal temporary StringBuffer

AND

public java.lang.String AND(java.lang.String op1,
                            java.lang.String op2,
                            java.lang.String op3)
"(operand1 AND operand2 AND operand3)"

Parameters:
op1 - The first operand
op2 - The second operand
op3 - The third operand
Returns:
A String representation of the internal temporary StringBuffer

AND

public java.lang.String AND(java.lang.String op1,
                            java.lang.String op2,
                            java.lang.String op3,
                            java.lang.String op4)
"(operand1 AND operand2 AND operand3 AND operand4)"

Parameters:
op1 - The first operand
op2 - The second operand
op3 - The third operand
op4 - The forth operand
Returns:
A String representation of the internal temporary StringBuffer

AND

public java.lang.String AND(java.lang.String op1,
                            java.lang.String op2,
                            java.lang.String op3,
                            java.lang.String op4,
                            java.lang.String op5)
"(operand1 AND operand2 AND operand3 AND operand4 AND operand5)"

Parameters:
op1 - The first operand
op2 - The second operand
op3 - The third operand
op4 - The forth operand
op5 - The fifth operand
Returns:
A String representation of the internal temporary StringBuffer

AND

public java.lang.String AND(java.lang.String[] op)
"(operand AND ...)"

Parameters:
op - An array of operands
Returns:
A String representation of the internal temporary StringBuffer

OR_

public java.lang.String OR_(java.lang.String op)
"OR operand"

Parameters:
op - The operand
Returns:
A String representation of the internal temporary StringBuffer

_OR_

public java.lang.String _OR_(java.lang.String op1,
                             java.lang.String op2)
"operand1 OR operand2"

Parameters:
op1 - The first operand
op2 - The second operand
Returns:
A String representation of the internal temporary StringBuffer

OR

public java.lang.String OR(java.lang.String op1,
                           java.lang.String op2)
"(operand1 OR operand2)"

Parameters:
op1 - The first operand
op2 - The second operand
Returns:
A String representation of the internal temporary StringBuffer

OR

public java.lang.String OR(java.lang.String op1,
                           java.lang.String op2,
                           java.lang.String op3)
"(operand1 OR operand2 OR operand3)"

Parameters:
op1 - The first operand
op2 - The second operand
op3 - The third operand
Returns:
A String representation of the internal temporary StringBuffer

OR

public java.lang.String OR(java.lang.String op1,
                           java.lang.String op2,
                           java.lang.String op3,
                           java.lang.String op4)
"(operand1 OR operand2 OR operand3 OR operand4)"

Parameters:
op1 - The first operand
op2 - The second operand
op3 - The third operand
op4 - The forth operand
Returns:
A String representation of the internal temporary StringBuffer

OR

public java.lang.String OR(java.lang.String[] op)
"(operand OR ...)"

Parameters:
op - An array of operands
Returns:
A String representation of the internal temporary StringBuffer

EQ

public java.lang.String EQ(java.lang.String fld,
                           java.lang.Object value)
"(field = value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

EQ

public java.lang.String EQ(java.lang.String fld,
                           int value)
"(field = value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

EQ

public java.lang.String EQ(java.lang.String fld,
                           long value)
"(field = value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

EQ

public java.lang.String EQ(java.lang.String fld,
                           double value)
"(field = value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

EQ

public java.lang.String EQ(java.lang.String fld,
                           boolean value)
"(field = value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

NE

public java.lang.String NE(java.lang.String fld,
                           java.lang.Object value)
"(field != value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

NE

public java.lang.String NE(java.lang.String fld,
                           int value)
"(field != value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

NE

public java.lang.String NE(java.lang.String fld,
                           long value)
"(field != value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

NE

public java.lang.String NE(java.lang.String fld,
                           double value)
"(field != value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

NE

public java.lang.String NE(java.lang.String fld,
                           boolean value)
"(field != value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GT

public java.lang.String GT(java.lang.String fld,
                           java.lang.Object value)
"(field > value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GT

public java.lang.String GT(java.lang.String fld,
                           int value)
"(field > value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GT

public java.lang.String GT(java.lang.String fld,
                           long value)
"(field > value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GT

public java.lang.String GT(java.lang.String fld,
                           double value)
"(field > value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GE

public java.lang.String GE(java.lang.String fld,
                           java.lang.Object value)
"(field >= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GE

public java.lang.String GE(java.lang.String fld,
                           int value)
"(field >= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GE

public java.lang.String GE(java.lang.String fld,
                           long value)
"(field >= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

GE

public java.lang.String GE(java.lang.String fld,
                           double value)
"(field >= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LT

public java.lang.String LT(java.lang.String fld,
                           java.lang.Object value)
"(field < value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LT

public java.lang.String LT(java.lang.String fld,
                           int value)
"(field < value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LT

public java.lang.String LT(java.lang.String fld,
                           long value)
"(field < value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LT

public java.lang.String LT(java.lang.String fld,
                           double value)
"(field < value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LE

public java.lang.String LE(java.lang.String fld,
                           java.lang.Object value)
"(field <= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LE

public java.lang.String LE(java.lang.String fld,
                           int value)
"(field <= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LE

public java.lang.String LE(java.lang.String fld,
                           long value)
"(field <= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LE

public java.lang.String LE(java.lang.String fld,
                           double value)
"(field <= value)"

Parameters:
fld - The table field
value - The value
Returns:
A String representation of the internal temporary StringBuffer

LIKE

public java.lang.String LIKE(java.lang.String fld,
                             java.lang.String value)
"field LIKE '...%...'"

Parameters:
fld - The table field
value - The value (containing wildcards)
Returns:
A String representation of the internal temporary StringBuffer

STARTSWITH

public java.lang.String STARTSWITH(java.lang.String fld,
                                   java.lang.String value)
"field LIKE '...%...'"

Parameters:
fld - The table field
value - The 'startsWith' value (no wildcards!)
Returns:
A String representation of the internal temporary StringBuffer

INLIST

public java.lang.String INLIST(java.lang.String fld,
                               java.lang.Iterable<?> list)
"(field=value0 OR field=value1 ...)"

Parameters:
fld - The table field
list - An array of values
Returns:
A String representation of the internal temporary StringBuffer

INLIST

public java.lang.String INLIST(java.lang.String fld,
                               java.lang.Object[] list)
"(field=value0 OR field=value1 ...)"

Parameters:
fld - The table field
list - An array of values
Returns:
A String representation of the internal temporary StringBuffer

INLIST

public java.lang.String INLIST(java.lang.String fld,
                               int[] list)
"(field=value0 OR field=value1 ...)"

Parameters:
fld - The table field
list - An array of values
Returns:
A String representation of the internal temporary StringBuffer

INLIST

public java.lang.String INLIST(java.lang.String fld,
                               long[] list)
"(field=value0 OR field=value1 ...)"

Parameters:
fld - The table field
list - An array of values
Returns:
A String representation of the internal temporary StringBuffer

WHERE_

public java.lang.String WHERE_(java.lang.String conditions)
"WHERE conditions"

Parameters:
conditions - The where conditions

WHERE

public java.lang.String WHERE(java.lang.String conditions)
"WHERE (conditions)"

Parameters:
conditions - The where conditions

main

public static void main(java.lang.String[] argv)
Main entry point for testing/debugging

Parameters:
argv - The command-line arguments