public class DbTimestamp extends DbDateTime
A thin wrapper around SQL TIMESTAMP value.
It adds the ability to hold the SQL TIMESTAMP fractional seconds value by allowing
the specification of fractional seconds to a precision of nanoseconds.
In addition, this class provides several methods for the interconversion of
a DbTimestamp and a String,
as well as other constants and methods used when dealing
with a DbTimestamp.
Note: This type is a composite of a java.util.Date long value and a
separate nanoseconds value.
| Modifier and Type | Field and Description |
|---|---|
int |
nanos
Deprecated.
|
Unknown_DataTimeZone, valueBIGINT_DESC, bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC| Constructor and Description |
|---|
DbTimestamp()
Constructs an uninitialized
DbTimestamp. |
DbTimestamp(DbColDesc desc)
Constructs an uninitialized
DbTimestamp. |
DbTimestamp(java.sql.Timestamp v)
Constructs an uninitialized
DbTimestamp. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Creates a clone of this
DbTimestamp object. |
int |
compareTo(DbValue v,
boolean matchSQL)
Compares this
DbTimestamp object with the DbValue object. |
boolean |
equals(DbValue v)
Compares this object to the specified object.
|
int |
getNanos()
Returns a nanoseconds time value of this object.
|
java.sql.Timestamp |
getTimestamp()
Returns a
java.sql.Timestamp object using the milliseconds
time value and the nanoseconds value. |
void |
set(DbValue v)
Sets a newly allocated
DbTimestamp object that
represents the the long date value and int time value indicated by the
DbValue parameter. |
void |
set(JRHierarchicalDataset hds,
int col)
Sets a newly allocated
DbTimestamp object that
represents the long date value and int time value indicated by the
JRHierarchicalDataset parameter and an index of the column. |
void |
set(long time,
int nanos)
Sets a
DbTimestamp object
using a milliseconds time value for date, and a nanoseconds time value for time. |
void |
set(java.sql.ResultSet rs,
int col)
Sets a newly allocated
DbTimestamp object that
represents the long date value and int time value
indicated by the ResultSet parameter and an index of the column. |
void |
set(java.sql.Timestamp v)
Sets an existing
java.sql.Timestamp object
using the given milliseconds and nanoseconds value. |
void |
setNanos(int v)
Sets an existing
java.sql.Time object
using the given nanoseconds time value. |
void |
setTimestamp(java.sql.Timestamp v)
Sets an existing
java.sql.Timestamp object
using the given milliseconds and nanoseconds value. |
void |
setValue(java.lang.String v)
Sets a
DbTimestamp value for a String
object in JDBC timestamp escape format. |
java.lang.String |
toFormatString(java.lang.String pattern)
This method is for parsing DbTimestamp to valid string, which contains nanos.
|
java.lang.String |
toString()
Returns a
String object representing this
DbTimestamp's value. |
java.lang.String |
toStringValue() |
java.util.Date |
toUtilDate()
Returns a
java.util.Date object and initializes it to
represent the specified number of milliseconds since the
standard base time is known as "the epoch", namely, January 1,
1970, 00:00:00 GMT. |
get, getDataTimeZone, set, setDataTimeZone, toSqlDatecompareTo, compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, setColDesc, setfoo, setNull, setValuepublic int nanos
getNanos and setNanos to access it instead of accessing it directly.public DbTimestamp()
DbTimestamp. This
DbTimestamp object is mutable until the value and the description of the column are set.public DbTimestamp(java.sql.Timestamp v)
DbTimestamp. This
DbTimestamp object is mutable until DbColDesc is set.v - The value holding a java.sql.Timestamp object.public DbTimestamp(DbColDesc desc)
DbTimestamp. This
DbTimestamp object is mutable until the value set.desc - The value to be represented by the
DbColDesc object.public void setNanos(int v)
java.sql.Time object
using the given nanoseconds time value.v - the nanoseconds time valuepublic int getNanos()
public java.util.Date toUtilDate()
java.util.Date object and initializes it to
represent the specified number of milliseconds since the
standard base time is known as "the epoch", namely, January 1,
1970, 00:00:00 GMT.toUtilDate in class DbDateTimepublic void set(long time,
int nanos)
DbTimestamp object
using a milliseconds time value for date, and a nanoseconds time value for time.
The long seconds are stored in the underlying date value; the
fractional seconds are stored in the nanos field of
the DbTimestamp object.time - Milliseconds since January 1, 1970, 00:00:00 GMT.
A negative number is the number of milliseconds before
January 1, 1970, 00:00:00 GMT.nanos - Nanoseconds time value for time.Timestamppublic java.sql.Timestamp getTimestamp()
java.sql.Timestamp object using the milliseconds
time value and the nanoseconds value.public void setTimestamp(java.sql.Timestamp v)
java.sql.Timestamp object
using the given milliseconds and nanoseconds value.v - The valid Timestamp value.public void set(java.sql.Timestamp v)
java.sql.Timestamp object
using the given milliseconds and nanoseconds value.v - The valid Timestamp value.public void set(java.sql.ResultSet rs,
int col)
throws java.sql.SQLException
DbTimestamp object that
represents the long date value and int time value
indicated by the ResultSet parameter and an index of the column.public void set(JRHierarchicalDataset hds, int col) throws java.sql.SQLException
DbTimestamp object that
represents the long date value and int time value indicated by the
JRHierarchicalDataset parameter and an index of the column.public java.lang.String toString()
String object representing this
DbTimestamp's value. The value is returned as a string.
If the value is null, it returns "NULL".public java.lang.Object clone()
DbTimestamp object.public boolean equals(DbValue v)
true if and only if the argument is not
null but a DbTimestamp object that
contains the same the long date value and int time value as this object.equals in class DbDateTimev - The DbValue object to be compared with.true if the objects are the same;
false otherwise.public int compareTo(DbValue v, boolean matchSQL)
DbTimestamp object with the DbValue object.compareTo in class DbDateTimejet.util.DbValueablepublic void set(DbValue v)
DbTimestamp object that
represents the the long date value and int time value indicated by the
DbValue parameter. The DbValue object will be checked to see if it is null,set in class DbDateTimev - The DbValue to be converted to a
DbChar. If it is null, the value will not be set.public void setValue(java.lang.String v)
DbTimestamp value for a String
object in JDBC timestamp escape format.public java.lang.String toFormatString(java.lang.String pattern)
toFormatString in class DbDateTimepattern - The string is defined in java.text.SimpleDateFormat.
Date and Time Pattern Result "yyyy.MM.dd G 'at' HH:mm:ss z"2001.07.04 AD at 12:08:56 PDT"EEE, MMM d, ''yy"Wed, Jul 4, '01"h:mm a"12:08 PM"hh 'o''clock' a, zzzz"12 o'clock PM, Pacific Daylight Time"K:mm a, z"0:08 PM, PDT"yyyyy.MMMMM.dd GGG hh:mm aaa"02001.July.04 AD 12:08 PM"EEE, d MMM yyyy HH:mm:ss Z"Wed, 4 Jul 2001 12:08:56 -0700"yyMMddHHmmssZ"010704120856-0700"yyyy-MM-dd'T'HH:mm:ss.SSSZ"2001-07-04T12:08:56.235-0700"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"2001-07-04T12:08:56.235-07:00"YYYY-'W'ww-u"2001-W27-3
DbDateTimepublic java.lang.String toStringValue()
toStringValue in class DbDateTime