Package com.randomnoun.common.jexl.sql
Class SqlColumn
java.lang.Object
com.randomnoun.common.jexl.sql.SqlColumn
Objects of this type are used in the evaluation context passed into an SqlGenerator
to define a database column used in a TopLevelExpression.
See the SqlGenerator class for detailed documentation.
- Author:
- knoxg
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
These constants are copied directly from the java.sql.Types class; note that we also add the new types MONEYVALUE, DATEVALUE, TIMEVALUE, FIXEDDATEVALUE and FIXEDTIMEVALUEstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
The range 5000-6000 is currently unused in java.sql.Types; (and doesn't look like it will ever be used), so I'm going to use this for custom types.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new column, of type VARCHARCreate a new column, with the supplied datatypeCreate a new column, in a specific table, of type VARCHARCreate a new column, in a specific table, with the supplied datatype -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the currency column of this SqlColumn, as supplied by setCurrencyCodeNameint
Retrieves the data type of this SqlColumnEither returns the name of the currency column, or table + "." + currency name, if a table has been setEither returns the name of this column, or table + "." + name, if a table has been setgetName()
Retrieves the name of this SqlColumn, as set by the constructorgetTable()
Retrieves the table of this SqlColumn, as set by the constructorvoid
setCurrencyCodeName
(String currencyCodeName) Sets the column name that contains the currency code, for a MONEYVALUE SqlColumn.toString()
Retrieve a string representation of this column
-
Field Details
-
ARRAY
These constants are copied directly from the java.sql.Types class; note that we also add the new types MONEYVALUE, DATEVALUE, TIMEVALUE, FIXEDDATEVALUE and FIXEDTIMEVALUE- See Also:
-
BIGINT
- See Also:
-
BINARY
- See Also:
-
BIT
- See Also:
-
BLOB
- See Also:
-
BOOLEAN
- See Also:
-
CHAR
- See Also:
-
CLOB
- See Also:
-
DATALINK
- See Also:
-
DATE
- See Also:
-
DECIMAL
- See Also:
-
DISTINCT
- See Also:
-
DOUBLE
- See Also:
-
FLOAT
- See Also:
-
INTEGER
- See Also:
-
JAVA_OBJECT
- See Also:
-
LONGVARBINARY
- See Also:
-
LONGVARCHAR
- See Also:
-
NULL
- See Also:
-
NUMERIC
- See Also:
-
OTHER
- See Also:
-
REAL
- See Also:
-
REF
- See Also:
-
SMALLINT
- See Also:
-
STRUCT
- See Also:
-
TIME
- See Also:
-
TIMESTAMP
- See Also:
-
TINYINT
- See Also:
-
VARBINARY
- See Also:
-
VARCHAR
- See Also:
-
MONEYVALUE
The range 5000-6000 is currently unused in java.sql.Types; (and doesn't look like it will ever be used), so I'm going to use this for custom types. Anything in here is treated specially in SqlGenerator when converting to SQL.- See Also:
-
DATEVALUE
- See Also:
-
TIMEVALUE
- See Also:
-
FIXEDDATEVALUE
- See Also:
-
FIXEDTIMEVALUE
- See Also:
-
-
Constructor Details
-
SqlColumn
Create a new column, of type VARCHAR- Parameters:
name
- The name of the column in the database
-
SqlColumn
Create a new column, with the supplied datatype- Parameters:
name
- The name of the column in the databasedataType
- The datatype of the column. Corresponds to one of the public static final int constants defined in this class.
-
SqlColumn
Create a new column, in a specific table, of type VARCHAR- Parameters:
name
- The name of the column in the databasetable
- The name of the table in the database this column is in
-
SqlColumn
Create a new column, in a specific table, with the supplied datatype- Parameters:
name
- The name of the column in the databasetable
- The name of the table in the database this column is indataType
- The datatype of the column. Corresponds to one of the public static final int constants defined in this class.
-
-
Method Details
-
setCurrencyCodeName
Sets the column name that contains the currency code, for a MONEYVALUE SqlColumn. If a table has been specified for this column, then the currency is always sourced from the same table.- Parameters:
currencyCodeName
- the column name that contains the currency code- Throws:
IllegalStateException
- if this method is called for a non-MONEYVALUE SqlColumn
-
getName
Retrieves the name of this SqlColumn, as set by the constructor -
getTable
Retrieves the table of this SqlColumn, as set by the constructor -
getCurrencyCodeName
Retrieves the currency column of this SqlColumn, as supplied by setCurrencyCodeName -
getDataType
Retrieves the data type of this SqlColumn -
getFullName
Either returns the name of this column, or table + "." + name, if a table has been set -
getFullCurrencyCodeName
Either returns the name of the currency column, or table + "." + currency name, if a table has been set -
toString
Retrieve a string representation of this column
-