Nonstop Database, HiRDB Version 9 UAP Development Guide
This item explains the conversion process when data of HiRDB's TIME, DATE, or TIMESTAMP data type is set in the setTime, setDate, setTimestamp, or setString method.
When the setTime, setDate, setTimestamp, or setString method is used to set data in a column of HiRDB's TIME, DATE, or TIMESTAMP data type, data conversion takes place according to the HiRDB data type.
The following table shows the conversion processing for combinations of the different column data types and methods.
Table 18-71 Conversion processing for combinations of the TIME, DATE, and TIMESTAMP types and the setXXX methods
setXXX method | HiRDB data type | ||
---|---|---|---|
TIME type | DATE type | TIMESTAMP type | |
setTime(Time Obj)#1 | Stores the UAP setting value in the database without any conversion. | Throws an SQLException. | Stores in the database data that has 1970-01-01 added before the UAP setting value hh:mm:ss[.000000]. |
setDate(Date Obj)#2 | Throws an SQLException. | Stores the UAP setting value in the database without any conversion. | Stores data in the database that has 00:00:00[.000000] added after the UAP setting value yyyy-MM-DD. |
setTimestamp(Timestamp Obj)#3 | Throws an SQLException. | Stores in the database the data formed when yyyy-MM-DD is removed from the UAP setting value. | Stores the UAP setting value in the database without any conversion. |
setString(character string in hh:mm:ss format) | Converts the specified time with java.sql.Time.valueOf() and stores the result in the database.#5 | Throws an SQLException. | Throws an SQLException. |
setString(character string in yyyy-MM-DD format) | Throws an SQLException. | Converts the specified date with java.sql.Date.valueOf() and stores the result in the database.#5 | Throws an SQLException. |
setString(character string in yyyy-MM-DD |
Throws an SQLException. | Throws an SQLException. | Converts the specified date/time with java.sql.Timestamp.valueOf() and stores the result in the database.#5 |
This item explains the conversion process when data of HiRDB's TIME, DATE, TIMESTAMP or character string (CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, or NVARCHAR) data type is set in the getTime, getDate, or getTimestamp method.
When the getTime, getDate, or getTimestamp method is used to set data in a column of HiRDB's TIME, DATE, TIMESTAMP, or character string data type, data conversion takes place according to the HiRDB data type.
The following table shows the conversion processing for combinations of the different column data types and methods.
Table 18-72 Conversion processing for combinations of the TIME, DATE, TIMESTAMP, and character string types and the getXXX methods
getXXX method | HiRDB data type | |||
---|---|---|---|---|
TIME type | DATE type | TIMESTAMP type | Character string type | |
getTime()#2 | Gets the value stored in the database and sets it as the java.sql.Time object without any conversion.#1 | Throws an SQLException. | Removes the hour:minute:second data from the TIMESTAMP data retrieved from the database and sets the result as the java.sql.Time object.#1 | Gets only an hh:mm:ss character string expression of the TIME type as the java.sql.Time object. For other expressions, the method throws an exception. |
getDate()#2 | Throws an SQLException. | Gets the value stored in the database and sets it as the java.sql.Date object without any conversion.#1 | Removes the year-month-day data from the TIMESTAMP data retrieved from the database and sets the result as the java.sql.Date object.#1 | Gets only a yyyy-MM-DD character string expression of the DATE type as the java.sql.Date object. For other expressions, the method throws an exception. |
getTimestamp()#2 | Throws an SQLException. | Appends 00:00:00.000000 to the DATE data retrieved from the database and sets the result as the java.sql.Timestamp object. | Gets the value stored in the database and sets it as the java.sql.Timestamp object without any conversion. | Gets only a yyyy-MM-DD |
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.