public abstract class Interval
extends java.lang.Object
This is the base class for the Informix data type INTERVAL. This is an Informix-specific JDBC extension. Interval qualifiers and some common methods for the IntervalYM and IntervalDF classes are in this class. Qualifier start code and end code indicators are also defined in this class.
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DAY_IDX |
protected static boolean |
DEBUG |
protected static boolean |
debugFlag |
protected static int |
DECSIZE |
protected static char[] |
dtdelim |
protected static int |
FRAC_IDX |
protected static int |
HOUR_IDX |
protected short |
int_qual |
protected static int |
MIN_IDX |
protected static int |
MONTH_IDX |
protected static int |
NUMBER_UNITS |
protected static int |
SEC_IDX |
static byte |
TU_DAY
The time unit for the DAY field in a binary qualifier.
|
static byte |
TU_F1
The time unit for the FRACTION(1) field in a binary qualifier.
|
static byte |
TU_F2
The time unit for the FRACTION(2) field in a binary qualifier.
|
static byte |
TU_F3
The time unit for the FRACTION(3) field in a binary qualifier.
|
static byte |
TU_F4
The time unit for the FRACTION(4) field in a binary qualifier.
|
static byte |
TU_F5
The time unit for the FRACTION(5) field in a binary qualifier.
|
static byte |
TU_FRAC
The time unit for the default FRACTION field in a binary qualifier.
|
static byte |
TU_HOUR
The time unit for the HOUR field in a binary qualifier.
|
static byte |
TU_MINUTE
The time unit for the MINUTE field in a binary qualifier.
|
static byte |
TU_MONTH
The time unit for the MONTH field in a binary qualifier.
|
static byte |
TU_SECOND
The time unit for the SECOND field in a binary qualifier.
|
static byte |
TU_YEAR
The time unit for the YEAR field in a binary qualifier.
|
protected static int |
YEAR_IDX |
| Modifier | Constructor and Description |
|---|---|
protected |
Interval()
Default Constructor with no arguments
|
protected |
Interval(java.sql.Connection conn)
Default Constructor with connection argument, used to
set current locale
|
| Modifier and Type | Method and Description |
|---|---|
byte |
getEndCode()
Gets the end code from the internal qualifier.
|
static byte |
getEndCode(short qualifier)
Extracts the ending field code from a qualifier.
|
static java.lang.String |
getFieldName(byte code)
A static method that takes the TU_XXX value of part of
a DATETIME or Interval data type and returns the string value.
|
protected byte |
getFirstLength(short qual)
Calculates the length of the first field of a qualifier.
|
static java.lang.String |
getIfxTypeName(int type,
short qual)
Returns, in string form, the entire name of the Interval or
DATETIME from the qualifier.
|
protected byte |
getLength()
Retrieves the length portion of the internal qualifier.
|
static byte |
getLength(short qualifier)
Extracts the length from a qualifier.
|
short |
getQualifier()
Returns the qualifier for this Interval object.
|
protected short |
getQualifier(byte startCode,
byte endCode)
Composes the DATETIME qualifier from the start code and end code.
|
static short |
getQualifier(byte len,
byte startCode,
byte endCode)
Composes the Interval qualifier from the length, start code, and
end code.
|
static byte |
getScale(short qualifier)
Returns the number of digits in the FRACTION part of the Interval
datatype.
|
byte |
getStartCode()
Gets the start code from the internal qualifier.
|
static byte |
getStartCode(short qualifier)
Extracts the start code of the qualifier.
|
static byte |
getStaticEndCode(short qualifier)
A static method, similar to getEndCode, that returns the
ending type of an interval (for example, the 'second' part of
'year to second'.
|
static byte |
getStaticStartCode(short qualifier)
A static method, similar to getStartCode, that returns the
starting type of an interval (for example, the 'year' part of
'year to second'.
|
protected boolean |
goodQualifier(byte startCode,
byte endCode)
Verifies the startCode and endCode values of the DATETIME
qualifier.
|
static void |
goodQualifier(byte length,
byte startCode,
byte endCode)
Verifies the length, startCode, and endCode values of the Interval
qualifier.
|
protected static void |
print(java.lang.String str) |
protected static void |
println(java.lang.String str) |
void |
setConnection(java.sql.Connection conn)
Sets the connection.
|
protected int[] |
stringToUnits(java.lang.String str,
short qual)
Converts a string to an array of integers.
|
public static final byte TU_YEAR
public static final byte TU_MONTH
public static final byte TU_DAY
public static final byte TU_HOUR
public static final byte TU_MINUTE
public static final byte TU_SECOND
public static final byte TU_FRAC
public static final byte TU_F1
public static final byte TU_F2
public static final byte TU_F3
public static final byte TU_F4
public static final byte TU_F5
protected static final int DECSIZE
protected static final int NUMBER_UNITS
protected static final int YEAR_IDX
protected static final int MONTH_IDX
protected static final int DAY_IDX
protected static final int HOUR_IDX
protected static final int MIN_IDX
protected static final int SEC_IDX
protected static final int FRAC_IDX
protected static final char[] dtdelim
protected static final boolean DEBUG
protected static boolean debugFlag
protected short int_qual
protected Interval()
throws java.sql.SQLException
java.sql.SQLExceptionprotected Interval(java.sql.Connection conn)
throws java.sql.SQLException
conn - Current connectionjava.sql.SQLExceptionpublic static byte getLength(short qualifier)
qualifier - The qualifier from which the length is extracted.protected byte getLength()
public short getQualifier()
public static short getQualifier(byte len,
byte startCode,
byte endCode)
throws java.sql.SQLException
len - The leading field length.startCode - The starting time unit field (TU_XXX).endCode - The ending time unit field (TU_XXX).java.sql.SQLExceptionprotected short getQualifier(byte startCode,
byte endCode)
throws java.sql.SQLException
startCode - The starting time unit field (TU_XXX).endCode - The ending time unit field (TU_XXX).java.sql.SQLExceptionpublic static void goodQualifier(byte length,
byte startCode,
byte endCode)
throws java.sql.SQLException
length - The leading field precision.startCode - The starting time unit field (TU_XXX).endCode - The ending time unit field (TU_XXX).java.sql.SQLExceptionprotected boolean goodQualifier(byte startCode,
byte endCode)
throws java.sql.SQLException
startCode - The starting time unit field (TU_XXX).endCode - The ending time unit field (TU_XXX).java.sql.SQLExceptionpublic static byte getScale(short qualifier)
qualifier - The qualifier from which the scale is extracted.public static byte getStartCode(short qualifier)
qualifier - The qualifier.public static byte getEndCode(short qualifier)
qualifier - The qualifier.public byte getStartCode()
public byte getEndCode()
protected byte getFirstLength(short qual)
qual - The qualifier.public static byte getStaticStartCode(short qualifier)
qualifier - The datetime or interval qualifier.public static byte getStaticEndCode(short qualifier)
qualifier - The datetime or interval qualifier.public static java.lang.String getFieldName(byte code)
code - The time unit (TU_XXX) value.public static java.lang.String getIfxTypeName(int type,
short qual)
type - Indicates whether the type is interval or datetime.qual - The qualifier.protected int[] stringToUnits(java.lang.String str,
short qual)
throws java.sql.SQLException
str - The string to be converted.qual - The qualifier used for the conversion.java.sql.SQLExceptionprotected static void print(java.lang.String str)
protected static void println(java.lang.String str)
public void setConnection(java.sql.Connection conn)
conn - The connection object