7.6.3 Overflow handling
This subsection discusses the possibility of overflow when a setXXX or getXXX method is executed.
- Organization of this subsection
(1) Possibility of overflow when a setXXX method (other than the setObject method) is executed
(2) Possibility of overflow when the setObject method is executed
(3) Possibility of overflow when a getXXX method (other than the getObject method) is executed
(4) Possibility of overflow when the getObject method is executed
(1) Possibility of overflow when a setXXX method (other than the setObject method) is executed
The following table shows whether overflow might occur when a setXXX method (other than the setObject method) is executed.
|
Method executed |
HADB data type |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
SML |
INT |
DBL PREC |
DCML |
CHAR, VCHR |
DATE# |
TIME# |
TSTMP# |
ROW |
BIN, VARBIN |
|
|
setByte |
N |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setShort |
N |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setInt |
N |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setLong |
Y |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setFloat |
Y |
Y |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setDouble |
Y |
Y |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setBigDecimal |
Y |
Y |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
setBoolean |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
setString |
Y |
Y |
N |
Y |
N |
Y |
N |
Y |
-- |
N |
|
setBytes |
-- |
-- |
-- |
-- |
-- |
-- |
-- |
-- |
N |
N |
|
setDate |
-- |
-- |
-- |
-- |
N |
Y |
N |
Y |
-- |
-- |
|
setTime |
-- |
-- |
-- |
-- |
N |
-- |
N |
Y |
-- |
-- |
|
setTimestamp |
-- |
-- |
-- |
-- |
N |
Y |
N |
Y |
-- |
-- |
|
setAsciiStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
|
setBinaryStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
|
setCharacterStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
- Legend:
-
SML: SMALLINT
INT: INTEGER
DBL PREC: DOUBLE PRECISION
DCML: DECIMAL
VCHR: VARCHAR
TSTMP: TIMESTAMP
BIN: BINARY
VARBIN: VARBINARY
N: Overflow does not occur regardless of the value.
Y: Overflow might occur depending on the value.
--: Combination that is not allowed.
- #
-
Overflow occurs when the value obtained by the getTime method of the java.sql.Date, java.sql.Time, or java.sql.Timestamp class is an object larger than 253,402,268,399,999 or smaller than -62,135,802,000,000. The getTime method returns the number of milliseconds since 1970-01-01 00:00:00 (Greenwich Mean Time).
The methods shown below can be used to obtain 253,402,268,399,999 from the maximum value that can be stored in HADB's TIMESTAMP type, and -62,135,802,000,000 from the minimum value that can be represented by the java.sql.Timestamp class.
- 253,402,268,399,999
-
Timestamp.valueOf("9999-12-31 23:59:59.999999").getTime()
- -62,135,802,000,000
-
Timestamp.valueOf("0001-01-01 00:00:00.0").getTime()
(2) Possibility of overflow when the setObject method is executed
The following table shows whether overflow might occur when the setObject method is executed.
|
Data type of object specified by the setObject method |
HADB data type |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
SML |
INT |
DBL PREC |
DCML |
CHAR, VCHR |
DATE# |
TIME# |
TSTMP# |
ROW |
BIN, VARBIN |
|
|
Byte |
N |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Short |
N |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Integer |
N |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Long |
Y |
N |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Decimal |
Y |
Y |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Float |
Y |
Y |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Double |
Y |
Y |
N |
Y |
N |
-- |
-- |
-- |
-- |
-- |
|
Boolean |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
String |
Y |
Y |
N |
Y |
N |
Y |
N |
Y |
-- |
-- |
|
Date |
-- |
-- |
-- |
-- |
N |
Y |
N |
Y |
-- |
-- |
|
Time |
-- |
-- |
-- |
-- |
N |
-- |
N |
-- |
-- |
-- |
|
Timestamp |
-- |
-- |
-- |
-- |
N |
Y |
N |
Y |
-- |
-- |
|
byte[] |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
N |
N |
- Legend:
-
SML: SMALLINT
INT: INTEGER
DBL PREC: DOUBLE PRECISION
DCML: DECIMAL
VCHR: VARCHAR
TSTMP: TIMESTAMP
BIN: BINARY
VARBIN: VARBINARY
N: Overflow does not occur regardless of the value.
Y: Overflow might occur depending on the value.
--: Combination that is not allowed.
- #
-
Overflow occurs when the value obtained by the getTime method of the java.sql.Date, java.sql.Time, or java.sql.Timestamp class is an object larger than 253,402,268,399,999 or smaller than -62,135,802,000,000. The getTime method returns the number of milliseconds since 1970-01-01 00:00:00 (Greenwich Mean Time).
The methods shown below can be used to obtain 253,402,268,399,999 from the maximum value that can be stored in HADB's TIMESTAMP type, and -62,135,802,000,000 from the minimum value that can be represented by the java.sql.Timestamp class.
- 253,402,268,399,999
-
Timestamp.valueOf("9999-12-31 23:59:59.999999").getTime()
- -62,135,802,000,000
-
Timestamp.valueOf("0001-01-01 00:00:00.0").getTime()
(3) Possibility of overflow when a getXXX method (other than the getObject method) is executed
The following table shows whether overflow might occur when a getXXX method (other than the getObject method) is executed.
|
Method executed |
HADB data type |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
SML |
INT |
DBL PREC |
DCML |
CHAR, VCHR |
DATE |
TIME |
TSTMP |
ROW |
BIN, VARBIN |
|
|
getByte |
Y |
Y |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
getShort |
Y |
Y |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
getInt |
N |
Y |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
getLong |
N |
N |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
getFloat |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
getDouble |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
getBigDecimal |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
getBoolean |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
getString |
N |
N |
N |
N |
N |
N |
N |
N |
-- |
N |
|
getBytes |
-- |
-- |
-- |
-- |
-- |
-- |
-- |
-- |
N |
N |
|
getDate |
-- |
-- |
-- |
-- |
N |
N |
N |
N |
-- |
-- |
|
getTime |
-- |
-- |
-- |
-- |
N |
-- |
N |
N |
-- |
-- |
|
getTimestamp |
-- |
-- |
-- |
-- |
N |
N |
N |
N |
-- |
-- |
|
getAsciiStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
|
getBinaryStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
|
getCharacterStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
- Legend:
-
SML: SMALLINT
INT: INTEGER
DBL PREC: DOUBLE PRECISION
DCML: DECIMAL
VCHR: VARCHAR
TSTMP: TIMESTAMP
BIN: BINARY
VARBIN: VARBINARY
N: Overflow does not occur regardless of the value.
Y: Overflow might occur depending on the value.
--: Combination that is not allowed.
(4) Possibility of overflow when the getObject method is executed
The following table shows whether overflow might occur when the getObject method is executed.
|
Data type of object obtained by the getObject method |
HADB data type |
|||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
SML |
INT |
DBL PREC |
DCML |
CHAR, VCHR |
DATE |
TIME |
TSTMP |
ROW |
BIN, VARBIN |
|
|
Byte |
Y |
Y |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
Short |
Y |
Y |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
Int |
N |
Y |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
Long |
N |
N |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
Float |
N |
N |
Y |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
Double |
N |
N |
N |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
BigDecimal |
N |
N |
N |
Y |
Y |
-- |
-- |
-- |
-- |
-- |
|
Boolean |
N |
N |
N |
N |
N |
-- |
-- |
-- |
-- |
-- |
|
String |
N |
N |
N |
N |
N |
N |
N |
N |
-- |
N |
|
Bytes |
-- |
-- |
-- |
-- |
-- |
-- |
-- |
-- |
N |
N |
|
Date |
-- |
-- |
-- |
-- |
N |
N |
N |
N |
-- |
-- |
|
Time |
-- |
-- |
-- |
-- |
N |
-- |
N |
N |
-- |
-- |
|
Timestamp |
-- |
-- |
-- |
-- |
N |
N |
N |
N |
-- |
-- |
|
AsciiStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
|
BinaryStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
|
Object |
N |
N |
N |
N |
N |
N |
N |
N |
N |
N |
|
CharacterStream |
-- |
-- |
-- |
-- |
N |
-- |
-- |
-- |
-- |
N |
- Legend:
-
SML: SMALLINT
INT: INTEGER
DBL PREC: DOUBLE PRECISION
DCML: DECIMAL
VCHR: VARCHAR
TSTMP: TIMESTAMP
BIN: BINARY
VARBIN: VARBINARY
N: Overflow does not occur regardless of the value.
Y: Overflow might occur depending on the value.
--: Combination that is not allowed.