org.edg.info.sqlutil.parsql
Class Constant

java.lang.Object
  extended byorg.edg.info.sqlutil.parsql.Constant
All Implemented Interfaces:
ExpSelConst, java.io.Serializable

public class Constant
extends java.lang.Object
implements ExpSelConst

Constant: a representation of SQL constants

See Also:
Serialized Form

Field Summary
static int COLUMNNAME
          Type column name
static int NULL
          Type null.
static int NUMBER
          Type number.
static int STRING
          Type string.
static int UNKNOWN
          Type unknown.
 
Constructor Summary
Constant(java.lang.String value, int type)
          Create a new constant, given its name and type.
 
Method Summary
static java.lang.String escapeBackslash(java.lang.String str)
          Replaces single backslashes with doubles in the given string.
static java.lang.String escapeQuotes(java.lang.String str, char quoteChar)
          Escapes occurrences of 'quoteChar' by repeating the character.
 int getType()
          Returns the constant type.
 java.lang.String getTypeName()
          Gets the name of the type of this Constant.
 java.lang.String getValue()
          Returns the constant value.
 java.lang.String toString()
          Return String representation of Constant in a form which SQL can use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN
Type unknown.

See Also:
Constant Field Values

COLUMNNAME

public static final int COLUMNNAME
Type column name

See Also:
Constant Field Values

NULL

public static final int NULL
Type null.

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
Type number.

See Also:
Constant Field Values

STRING

public static final int STRING
Type string.

See Also:
Constant Field Values
Constructor Detail

Constant

public Constant(java.lang.String value,
                int type)
Create a new constant, given its name and type.

Parameters:
value - Constant's value
type - Constant's type
Method Detail

getType

public int getType()
Returns the constant type.

Returns:
The constant type

getValue

public java.lang.String getValue()
Returns the constant value.

Returns:
The constant value

escapeQuotes

public static java.lang.String escapeQuotes(java.lang.String str,
                                            char quoteChar)
Escapes occurrences of 'quoteChar' by repeating the character.

Parameters:
str - String to process.
quoteChar - Quote character to escape.
Returns:
An escaped String.

escapeBackslash

public static java.lang.String escapeBackslash(java.lang.String str)
Replaces single backslashes with doubles in the given string.

Parameters:
str - String to escape.
Returns:
Escaped string.

toString

public java.lang.String toString()
Return String representation of Constant in a form which SQL can use.

Returns:
String representation of Constant. Either its value, or if it is a STRING, the value with any quotes escaped and the whole string surrounded by quotes.

getTypeName

public java.lang.String getTypeName()
Gets the name of the type of this Constant.

Returns:
The name of the type with the size in characters if it is of type STRING.