| java.lang.Object org.apache.derby.iapi.types.DataType org.apache.derby.iapi.types.SQLTimestamp
SQLTimestamp | final public class SQLTimestamp extends DataType implements DateTimeDataValue(Code) | | This contains an instance of a SQL Timestamp object.
SQLTimestamp is stored in 3 ints - an encoded date, an encoded time and
nanoseconds
encodedDate = 0 indicates a null WSCTimestamp
SQLTimestamp is similar to SQLTimestamp, but it does conserves space by not keeping a GregorianCalendar object
PERFORMANCE OPTIMIZATION:
We only instantiate the value field when required due to the overhead of the
Date methods.
Thus, use isNull() instead of "value == null" and
getTimestamp() instead of using value directly.
|
Method Summary | |
public int | compare(DataValueDescriptor other) | public boolean | compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) | public static DateTimeDataValue | computeTimestampFunction(DataValueDescriptor operand, DataValueFactory dvf) Compute the SQL timestamp function. | public int | estimateMemoryUsage() | public DataValueDescriptor | getClone() | public Date | getDate(Calendar cal) getDate returns the date portion of the timestamp
Time is set to 00:00:00.0
Since Date is a JDBC object we use the JDBC definition
for the time portion. | public NumberDataValue | getDate(NumberDataValue result) | public NumberDataValue | getHours(NumberDataValue result) | public int | getLength() | public NumberDataValue | getMinutes(NumberDataValue result) | public NumberDataValue | getMonth(NumberDataValue result) | protected String | getNationalString(LocaleFinder localeFinder) International version of getString(). | public DataValueDescriptor | getNewNull() | public Object | getObject() | public NumberDataValue | getSeconds(NumberDataValue source) | public String | getString() | public Time | getTime(Calendar cal) getTime returns the time portion of the timestamp
Date is set to 1970-01-01
Since Time is a JDBC object we use the JDBC definition
for the date portion. | public Timestamp | getTimestamp(java.util.Calendar cal) Get the value field. | public int | getTypeFormatId() Return my format identifier. | public String | getTypeName() | public NumberDataValue | getYear(NumberDataValue result) | public int | hashCode() | final public boolean | isNull() Check if the value is null. | static int[] | parseDateOrTimestamp(DateTimeParser parser, boolean timeRequired) Parse a timestamp or a date. | static int | parseDateTimeInteger(String str, int start, int ndigits) | static int[] | parseLocalTimestamp(String str, LocaleFinder localeFinder, Calendar cal) Parse a localized timestamp. | static SQLTimestamp | promote(DateTimeDataValue dateTime, java.sql.Date currentDate) Promotes a DateTimeDataValue to a timestamp. | public void | readExternal(ObjectInput in) | public void | readExternalFromArray(ArrayInputStream in) | public void | restoreToNull() | protected void | setFrom(DataValueDescriptor theValue) | public void | setInto(PreparedStatement ps, int position) | void | setObject(Object theValue) Set the value from a correctly typed Timestamp object. | public void | setValue(Date value, Calendar cal) | public void | setValue(Time value, Calendar cal) | public void | setValue(Timestamp value, Calendar cal) | public void | setValue(String theValue) | public void | setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) | public DateTimeDataValue | timestampAdd(int intervalType, NumberDataValue count, java.sql.Date currentDate, DateTimeDataValue resultHolder) Add a number of intervals to a datetime value. | public NumberDataValue | timestampDiff(int intervalType, DateTimeDataValue time1, java.sql.Date currentDate, NumberDataValue resultHolder) Finds the difference between two datetime values as a number of intervals. | public String | toString() | public int | typePrecedence() | public void | writeExternal(ObjectOutput out) |
DATE_SEPARATOR | final static char DATE_SEPARATOR(Code) | | |
FRACTION_TO_NANO | final static int FRACTION_TO_NANO(Code) | | |
MAX_FRACTION_DIGITS | final static int MAX_FRACTION_DIGITS(Code) | | |
ONE_BILLION | final static int ONE_BILLION(Code) | | |
SQLTimestamp | public SQLTimestamp()(Code) | | no-arg constructor required by Formattable
|
SQLTimestamp | SQLTimestamp(int encodedDate, int encodedTime, int nanos)(Code) | | |
SQLTimestamp | public SQLTimestamp(String timestampStr, boolean isJDBCEscape, LocaleFinder localeFinder) throws StandardException(Code) | | Construct a timestamp from a string. The allowed formats are:
- JDBC escape: yyyy-mm-dd hh:mm:ss[.fffff]
- IBM: yyyy-mm-dd-hh.mm.ss[.nnnnnn]
The format is specified by a parameter to the constructor. Leading zeroes may be omitted from the month, day,
and hour part of the timestamp. The microsecond part may be omitted or truncated.
|
SQLTimestamp | public SQLTimestamp(String timestampStr, boolean isJDBCEscape, LocaleFinder localeFinder, Calendar cal) throws StandardException(Code) | | Construct a timestamp from a string. The allowed formats are:
- JDBC escape: yyyy-mm-dd hh:mm:ss[.fffff]
- IBM: yyyy-mm-dd-hh.mm.ss[.nnnnnn]
The format is specified by a parameter to the constructor. Leading zeroes may be omitted from the month, day,
and hour part of the timestamp. The microsecond part may be omitted or truncated.
|
estimateMemoryUsage | public int estimateMemoryUsage()(Code) | | |
getDate | public Date getDate(Calendar cal) throws StandardException(Code) | | getDate returns the date portion of the timestamp
Time is set to 00:00:00.0
Since Date is a JDBC object we use the JDBC definition
for the time portion. See JDBC API Tutorial, 47.3.12.
exception: StandardException - thrown on failure |
getLength | public int getLength()(Code) | | |
getTime | public Time getTime(Calendar cal) throws StandardException(Code) | | getTime returns the time portion of the timestamp
Date is set to 1970-01-01
Since Time is a JDBC object we use the JDBC definition
for the date portion. See JDBC API Tutorial, 47.3.12.
exception: StandardException - thrown on failure |
hashCode | public int hashCode()(Code) | | |
isNull | final public boolean isNull()(Code) | | Check if the value is null. encodedDate value of 0 is null
Whether or not value is logically null. |
parseDateOrTimestamp | static int[] parseDateOrTimestamp(DateTimeParser parser, boolean timeRequired) throws StandardException(Code) | | Parse a timestamp or a date. DB2 allows timestamps to be used as dates or times. So
date('2004-04-15-16.15.32') is valid, as is date('2004-04-15').
This method does not handle localized timestamps.
Parameters: parser - a DateTimeParser initialized with a string. Parameters: timeRequired - If true then an error will be thrown if the time is missing. If false then the time maybe omitted. {encodedDate, encodedTime, nanosecond} array. exception: StandardException - if the syntax is incorrect for an IBM standard timestamp. |
timestampAdd | public DateTimeDataValue timestampAdd(int intervalType, NumberDataValue count, java.sql.Date currentDate, DateTimeDataValue resultHolder) throws StandardException(Code) | | Add a number of intervals to a datetime value. Implements the JDBC escape TIMESTAMPADD function.
Parameters: intervalType - One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL,DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVAL Parameters: count - The number of intervals to add Parameters: currentDate - Used to convert time to timestamp Parameters: resultHolder - If non-null a DateTimeDataValue that can be used to hold the result. If null thengenerate a new holder startTime + intervalCount intervals, as a timestamp exception: StandardException - |
timestampDiff | public NumberDataValue timestampDiff(int intervalType, DateTimeDataValue time1, java.sql.Date currentDate, NumberDataValue resultHolder) throws StandardException(Code) | | Finds the difference between two datetime values as a number of intervals. Implements the JDBC
TIMESTAMPDIFF escape function.
Parameters: intervalType - One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL,DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVAL Parameters: time1 - Parameters: currentDate - Used to convert time to timestamp Parameters: resultHolder - If non-null a NumberDataValue that can be used to hold the result. If null thengenerate a new holder the number of intervals by which this datetime is greater than time1 exception: StandardException - |
Methods inherited from org.apache.derby.iapi.types.DataType | public void checkHostVariable(int declaredLength) throws StandardException(Code)(Java Doc) public Object cloneObject()(Code)(Java Doc) public DataValueDescriptor coalesce(DataValueDescriptor[] argumentsList, DataValueDescriptor returnValue) throws StandardException(Code)(Java Doc) public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException(Code)(Java Doc) final protected StandardException dataTypeConversion(String targetType)(Code)(Java Doc) public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public boolean equals(Object other)(Code)(Java Doc) protected static int flip(int operator)(Code)(Java Doc) void genericSetObject(Object theValue) throws StandardException(Code)(Java Doc) public boolean getBoolean() throws StandardException(Code)(Java Doc) public byte getByte() throws StandardException(Code)(Java Doc) public byte[] getBytes() throws StandardException(Code)(Java Doc) public Date getDate(Calendar cal) throws StandardException(Code)(Java Doc) public double getDouble() throws StandardException(Code)(Java Doc) public float getFloat() throws StandardException(Code)(Java Doc) public int getInt() throws StandardException(Code)(Java Doc) public long getLong() throws StandardException(Code)(Java Doc) protected String getNationalString(LocaleFinder localeFinder) throws StandardException(Code)(Java Doc) public Object getObject() throws StandardException(Code)(Java Doc) public short getShort() throws StandardException(Code)(Java Doc) public InputStream getStream() throws StandardException(Code)(Java Doc) public Time getTime(Calendar cal) throws StandardException(Code)(Java Doc) public Timestamp getTimestamp(Calendar cal) throws StandardException(Code)(Java Doc) public String getTraceString() throws StandardException(Code)(Java Doc) String getTypeName(String className)(Code)(Java Doc) public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public BooleanDataValue in(DataValueDescriptor left, DataValueDescriptor[] inList, boolean orderedList) throws StandardException(Code)(Java Doc) final protected StandardException invalidFormat()(Code)(Java Doc) final public BooleanDataValue isNotNull()(Code)(Java Doc) final public BooleanDataValue isNullOp()(Code)(Java Doc) public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException(Code)(Java Doc) public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException(Code)(Java Doc) final protected StandardException outOfRange()(Code)(Java Doc) public void setBigDecimal(Number bigDecimal) throws StandardException(Code)(Java Doc) protected void setFrom(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc) public void setInto(PreparedStatement ps, int position) throws SQLException, StandardException(Code)(Java Doc) public void setInto(ResultSet rs, int position) throws SQLException, StandardException(Code)(Java Doc) void setObject(Object theValue) throws StandardException(Code)(Java Doc) public void setObjectForCast(Object theValue, boolean instanceOfResultType, String resultTypeClassName) throws StandardException(Code)(Java Doc) public void setToNull()(Code)(Java Doc) public void setValue(Time theValue) throws StandardException(Code)(Java Doc) public void setValue(Time theValue, Calendar cal) throws StandardException(Code)(Java Doc) public void setValue(Timestamp theValue) throws StandardException(Code)(Java Doc) public void setValue(Timestamp theValue, Calendar cal) throws StandardException(Code)(Java Doc) public void setValue(Date theValue) throws StandardException(Code)(Java Doc) public void setValue(Date theValue, Calendar cal) throws StandardException(Code)(Java Doc) public void setValue(String theValue) throws StandardException(Code)(Java Doc) public void setValue(int theValue) throws StandardException(Code)(Java Doc) public void setValue(double theValue) throws StandardException(Code)(Java Doc) public void setValue(float theValue) throws StandardException(Code)(Java Doc) public void setValue(short theValue) throws StandardException(Code)(Java Doc) public void setValue(long theValue) throws StandardException(Code)(Java Doc) public void setValue(byte theValue) throws StandardException(Code)(Java Doc) public void setValue(boolean theValue) throws StandardException(Code)(Java Doc) public void setValue(byte[] theValue) throws StandardException(Code)(Java Doc) final public void setValue(DataValueDescriptor dvd) throws StandardException(Code)(Java Doc) public void setValue(InputStream theStream, int valueLength) throws StandardException(Code)(Java Doc) public void throwLangSetMismatch(Object value) throws StandardException(Code)(Java Doc) void throwLangSetMismatch(String argTypeName) throws StandardException(Code)(Java Doc) public int typePrecedence()(Code)(Java Doc) public int typeToBigDecimal() throws StandardException(Code)(Java Doc)
|
|
|