|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface for implementing custom timestamp, date, and time translators.
Each implementing class MUST implement a constructor with four
java.lang.String
arguments.
The first argument is the native database timestamp/date/time value.
All implementations MUST be able to corectly translate ODBC canoncial
formats for timestamp yyyy-mm-dd hh:mm:ss.fffffffff
,
date yyyy-mm-dd
and time hh:mm:ss
in addition to native database formats for these types.
This is easily accomplished by using the
java.sql.Timestamp.valueOf(String)
,
java.sql.Date.valueOf(String)
and
java.sql.Time.valueOf(String)
methods,
respectively.
The second argument is the name of the Java class this instance represents
(i.e., "java.sql.Timestamp
",
"java.sql.Date
", or "java.sql.Time
"),
"java.sql.Timestamp
" being the default. The unqualified
class name can also be used (e.g., "timestamp", "date" or "time"),
case-insensitive.
The third argument is reserved for future use.
The fourth argument is the output format, either "1
" (integer) or
"2
" (string), the default being "1
" (integer).
DBLib.NewTimestamp(java.lang.String)
,
DBLib.NewDate(java.lang.String)
,
DBLib.NewTime(java.lang.String)
Field Summary | |
static String |
CLASS_DATE
java.sql.Date |
static String |
CLASS_TIME
java.sql.Time |
static String |
CLASS_TIMESTAMP
java.sql.Timestamp |
Method Summary | |
String |
getDSTime()
Returns this timestamp/date/time value in the directory canonical string format (e.g. CCYYMMDDHHMMSSNNNNNNNNN ,
CCYYMMDD or HHMMSS ) or in the
32-bit integer string format (e.g. "1013368206"),
if translation was successful. |
String |
getErrorMessage()
Returns the first parse error message, if any. |
List |
getExceptions()
Returns any exceptions generated while parsing. |
boolean |
parseError()
Indicates whether an error occurred parsing this timestamp/date/time value. |
boolean |
precisionLost()
Indicates whether precision was lost translating this timestamp value to the specified directory format. |
void |
setDSTime(String nativeTime)
Translates a database-native timestamp/date/time value into an equivalent directory format as per the arguments passed to the constructor. |
Field Detail |
public static final String CLASS_TIMESTAMP
java.sql.Timestamp
public static final String CLASS_DATE
java.sql.Date
public static final String CLASS_TIME
java.sql.Time
Method Detail |
public String getDSTime()
CCYYMMDDHHMMSSNNNNNNNNN
,
CCYYMMDD
or HHMMSS
) or in the
32-bit integer string format (e.g. "1013368206"),
if translation was successful.
null
public void setDSTime(String nativeTime) throws ParseException, IllegalArgumentException
nativeTime
- a database-native timestamp, date, or time value;
may be null
ParseException
IllegalArgumentException
public boolean parseError()
true
if there was a parse error;
false
otherwisepublic String getErrorMessage()
null
public List getExceptions()
Exception
s with length > 0 if exceptions were generated;
Collections.EMPTY_LIST
otherwise.
true
if there was a parse error;
false
otherwise; never returns null
public boolean precisionLost()
true
if precision was lost;
false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |