|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jet.connect.DbValue jet.connect.DbDateTime jet.connect.DbTimestamp
public class DbTimestamp
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.
Field Summary | |
---|---|
int |
nanos
Deprecated. |
Fields inherited from class jet.connect.DbDateTime |
---|
value |
Fields inherited from class jet.connect.DbValue |
---|
bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC |
Fields inherited from interface jet.util.DbValueable |
---|
EQUAL, GREATER, LESS |
Constructor Summary | |
---|---|
DbTimestamp()
Constructs an uninitialized DbTimestamp . |
|
DbTimestamp(DbColDesc desc)
Constructs an uninitialized DbTimestamp . |
|
DbTimestamp(java.sql.Timestamp v)
Constructs an uninitialized DbTimestamp . |
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates a clone of this DbTimestamp object. |
int |
compareTo(DbValue v)
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. |
Methods inherited from class jet.connect.DbDateTime |
---|
get, set, toSqlDate |
Methods inherited from class jet.connect.DbValue |
---|
compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, setColDesc, setfoo, setNull, setValue |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int nanos
getNanos
and setNanos
to access it instead of accessing it directly.
Constructor Detail |
---|
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.Method Detail |
---|
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 DbDateTime
public 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.Timestamp
public 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.
set
in class DbValue
rs
- The ResultSet
to be fetched.col
- The index of the column.
java.sql.SQLException
- if the ResultSet
does not
contain the index.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.
set
in class DbValue
hds
- The JRHierarchicalDataset
to be fetched.col
- The index of the column.
java.sql.SQLException
- if the ResultSet
does not
contain the index.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".
toString
in class DbValue
public java.lang.Object clone()
DbTimestamp
object.
clone
in interface jet.util.DbValueable
clone
in class DbValue
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 DbDateTime
v
- The DbValue object to be compared with.
true
if the objects are the same;
false
otherwise.public int compareTo(DbValue v)
DbTimestamp
object with the DbValue object.
compareTo
in class DbDateTime
DbValueable
public 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 DbDateTime
v
- 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.
setValue
in class DbValue
v
- Timestamp in the format yyyy-[m]m-[d]d hh:mm:ss[.f...]
. The
fractional seconds may be omitted. The leading zero for mm
and dd
may also be omitted.public java.lang.String toFormatString(java.lang.String pattern)
toFormatString
in class DbDateTime
pattern
- 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
DbDateTime
public java.lang.String toStringValue()
toStringValue
in class DbDateTime
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |