public class IntervalYM extends Interval
Timestamp| Modifier and Type | Field and Description |
|---|---|
protected long |
months |
protected static int |
MonthsPerYear |
| Constructor and Description |
|---|
IntervalYM()
Default Constructor with a default qualifier of
leading field precision = 4
start code = TU_YEAR
end code = TU_MONTH
|
IntervalYM(java.sql.Connection conn)
Default Constructor with the default qualifier.
|
IntervalYM(int years,
int months)
Creates an Interval from a number of years and months.
|
IntervalYM(int years,
int months,
java.sql.Connection conn)
Creates an Interval from a number of years and months.
|
IntervalYM(int months,
short qual)
Creates an Interval from a number of months and a qualifier.
|
IntervalYM(int months,
short qual,
java.sql.Connection conn)
Creates an Interval from a number of months and a qualifier.
|
IntervalYM(long months)
Creates an Interval from a number of months.
|
IntervalYM(java.lang.String str)
Creates an Interval from a string and a default qualifier of
leading field precision = 4
start code = TU_YEAR
end code = TU_MONTH
|
IntervalYM(java.lang.String str,
java.sql.Connection conn)
Creates an Interval from a string and the default qualifier.
|
IntervalYM(java.lang.String str,
int len,
byte startCode,
byte endCode)
Creates an Interval from a string and qualifier information.
|
IntervalYM(java.lang.String str,
int len,
byte startCode,
byte endCode,
java.sql.Connection conn)
Creates an Interval from a string and qualifier information.
|
IntervalYM(java.lang.String str,
short qual)
Creates an Interval from a string and the qualifier.
|
IntervalYM(java.lang.String str,
short qual,
java.sql.Connection conn)
Creates an Interval from a string and the qualifier.
|
IntervalYM(java.sql.Timestamp t1,
java.sql.Timestamp t2)
Creates an Interval object from two timestamps.
|
IntervalYM(java.sql.Timestamp t1,
java.sql.Timestamp t2,
java.sql.Connection conn)
Creates an Interval object from two timestamps.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
void |
fromString(java.lang.String str)
Sets the values for the Interval from a string.
|
long |
getMonths()
Returns the number of months in the interval.
|
boolean |
greaterThan(IntervalYM other)
Compares this Interval with another to see if it is
greater (longer in time) than the other.
|
int |
hashCode() |
boolean |
lessThan(IntervalYM other)
Compares this Interval with another to see if it is
less (shorter in time) than the other.
|
void |
set(int years,
int months)
Sets the value of the Interval from years and months.
|
void |
set(java.lang.String str)
Set the value of the Interval from a string.
|
void |
set(java.sql.Timestamp t1,
java.sql.Timestamp t2)
Sets the value of the Interval from two Timestamps.
|
void |
setQualifier(byte len,
byte startCode,
byte endCode)
Sets the qualifier from its constituent pieces.
|
void |
setQualifier(short qualifier)
Sets the qualifier from an existing qualifier.
|
void |
setWellKnownQualifier(byte len,
byte startCode,
byte endCode) |
java.lang.String |
toString()
Returns a string representation of the Interval in the following
format: yyyy-mm
The presence of the various fields depends upon the qualifier.
|
getEndCode, getEndCode, getFieldName, getFirstLength, getIfxTypeName, getLength, getLength, getQualifier, getQualifier, getQualifier, getScale, getStartCode, getStartCode, getStaticEndCode, getStaticStartCode, goodQualifier, setConnection, stringToUnitsprotected long months
protected static final int MonthsPerYear
public IntervalYM()
public IntervalYM(java.sql.Connection conn)
conn - Connectionpublic IntervalYM(java.sql.Timestamp t1,
java.sql.Timestamp t2)
t1 - First timestamp.t2 - Second timestamp.public IntervalYM(java.sql.Timestamp t1,
java.sql.Timestamp t2,
java.sql.Connection conn)
t1 - First timestamp.t2 - Second timestamp.conn - Connection objectpublic IntervalYM(int years,
int months)
years - Number of years.months - Number of months.public IntervalYM(long months)
months - Number of months.public IntervalYM(int years,
int months,
java.sql.Connection conn)
years - Number of years.months - Number of months.conn - Connection object.public IntervalYM(int months,
short qual)
throws java.sql.SQLException
months - Number of months.qual - Interval qualifier.java.sql.SQLException - if there is a database access errorpublic IntervalYM(int months,
short qual,
java.sql.Connection conn)
throws java.sql.SQLException
months - Number of months.qual - Interval qualifier.conn - Connection objectjava.sql.SQLException - if there is a database access errorpublic IntervalYM(java.lang.String str)
throws java.sql.SQLException
str - String representation of an Interval value.java.sql.SQLException - if there is a database access errorpublic IntervalYM(java.lang.String str,
java.sql.Connection conn)
throws java.sql.SQLException
str - String representation of an Interval value.conn - Connection objectjava.sql.SQLException - if there is a database access errorpublic IntervalYM(java.lang.String str,
short qual)
throws java.sql.SQLException
str - String representation of an Interval value.qual - Interval qualifier.java.sql.SQLException - if there is a database access errorpublic IntervalYM(java.lang.String str,
short qual,
java.sql.Connection conn)
throws java.sql.SQLException
str - String representation of an Interval value.qual - Interval qualifier.conn - Connection objectjava.sql.SQLException - if there is a database access errorpublic IntervalYM(java.lang.String str,
int len,
byte startCode,
byte endCode)
throws java.sql.SQLException
str - The string representation of the year to month Interval.len - The total length of the qualifier.startCode - The starting time unit value (TU_XXX).endCode - The ending time unit value (TU_XXX).java.sql.SQLException - if there is a database access errorpublic IntervalYM(java.lang.String str,
int len,
byte startCode,
byte endCode,
java.sql.Connection conn)
throws java.sql.SQLException
str - The string representation of the year to month Interval.len - The total length of the qualifier.startCode - The starting time unit value (TU_XXX).endCode - The ending time unit value (TU_XXX).conn - Connection objectjava.sql.SQLException - if there is a database access errorpublic void set(java.sql.Timestamp t1,
java.sql.Timestamp t2)
t1 - First timestamp.t2 - Second timestamp.public void set(int years,
int months)
years - Number of years.months - Number of months.public void set(java.lang.String str)
throws java.sql.SQLException
str - A valid string representing a year to month INTERVAL.java.sql.SQLException - if there is a database access errorpublic java.lang.String toString()
toString in class java.lang.Objectpublic void fromString(java.lang.String str)
throws java.sql.SQLException
str - String representation of an Interval value in y-m format.java.sql.SQLException - if there is a database access errorpublic long getMonths()
public boolean greaterThan(IntervalYM other)
other - The IntervalYM object to which this Interval is compared.public boolean lessThan(IntervalYM other)
other - The IntervalYM object to which this Interval is compared.public void setQualifier(byte len,
byte startCode,
byte endCode)
throws java.sql.SQLException
len - The total length of the qualifier.startCode - The starting time unit value (TU_XXX).endCode - The ending time unit value (TU_XXX).java.sql.SQLException - if there is a database access errorpublic void setWellKnownQualifier(byte len,
byte startCode,
byte endCode)
public void setQualifier(short qualifier)
throws java.sql.SQLException
qualifier - Qualifier value.java.sql.SQLException - if there is a database access error