Hitachi

Hitachi Advanced Database Application Development Guide


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

The following table shows whether overflow might occur when a setXXX method (other than the setObject method) is executed.

Table 7‒11: Possibility of overflow when a setXXX method (other than the setObject method) is executed

Method executed

HADB data type

SMALLINT

INTEGER

BIGINT

DOUBLE,

REAL,

BOOLEAN

DEC

VCHAR

DATE#1

TIME#1

TIMESTAMP#1, #3

ROW

BIN,

UUID

setByte

N

N

N

N

Y

N

--

--

--

--

--

setShort

N

N

N

N

Y

N

--

--

--

--

--

setInt

Y#2

N

N

N

Y

N

--

--

--

--

--

setLong

Y

Y#2

N

N

Y

N

--

--

--

--

--

setFloat

Y

Y

Y

N

Y

N

--

--

--

--

--

setDouble

Y

Y

Y

N

Y

N

--

--

--

--

--

setBigDecimal

Y

Y

Y

N

Y

N

--

--

--

--

--

setBoolean

N

N

N

N

N

N

--

--

--

--

--

setString

Y

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:

N: Overflow does not occur regardless of the value.

Y: Overflow might occur depending on the value.

--: Combination that is not allowed.

DOUBLE: DOUBLE PRECISION, FLOAT

DEC: DECIMAL, NUMERIC

VCHAR: CHAR, VARCHAR, STRING

BIN: BINARY, VARBINARY

#1

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

If the integer data type format is in legacy format, overflow does not occur regardless of the value.

#3

The TIMESTAMP type in the above table refers to the TIMESTAMP WITHOUT TIME ZONE type.

For the TIMESTAMP WITH TIME ZONE type, it is as follows:

  • All methods: --

(2) Possibility of overflow when the setObject method is executed

The following table shows whether overflow might occur when the setObject method is executed.

Table 7‒12: Possibility of overflow when the setObject method is executed

Data type of object specified by the setObject method

HADB data type

SMALLINT

INTEGER

BIGINT

DOUBLE,

BOOLEAN

REAL

DEC

VCHAR

DATE#1

TIME#1

TIMESTAMP#1, #3

ROW

BIN,

UUID#4

Byte

N

N

N

N

N

Y

N

--

--

--

--

--

Short

N

N

N

N

N

Y

N

--

--

--

--

--

Integer

Y#2

N

N

N

N

Y

N

--

--

--

--

--

Long

Y

Y#2

N

N

N

Y

N

--

--

--

--

--

Decimal

Y

Y

Y

N

N

Y

N

--

--

--

--

--

Float

Y

Y

Y

N

N

Y

N

--

--

--

--

--

Double

Y

Y

Y

N

Y

Y

N

--

--

--

--

--

Boolean

N

N

N

N

N

N

N

--

--

--

--

--

String

Y

Y

Y

N

N

Y

N

Y

N

Y

--

--

Date

--

--

--

--

--

--

N

Y

N

Y

--

--

Time

--

--

--

--

--

--

N

--

N

--

--

--

Timestamp

--

--

--

--

--

--

N

Y

N

Y

--

--

byte[]

--

--

--

--

--

--

N

--

--

--

N

N

OffsetDateTime

--

--

--

--

--

--

--

--

--

--

--

--

LocalDate

--

--

--

--

--

--

--

Y

--

--

--

--

LocalDateTime

--

--

--

--

--

--

--

--

--

Y

--

--

Instant

--

--

--

--

--

--

--

Y

--

Y

--

--

ZonedDateTime

--

--

--

--

--

--

--

--

--

--

--

--

java.util.UUID

--

--

--

--

--

--

--

--

--

--

--

--

Legend:

N: Overflow does not occur regardless of the value.

Y: Overflow might occur depending on the value.

--: Combination that is not allowed.

DOUBLE: DOUBLE PRECISION, FLOAT

DEC: DECIMAL, NUMERIC

VCHAR: CHAR, VARCHAR, STRING

BIN: BINARY, VARBINARY

#1

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

If the integer data type format is in legacy format, overflow does not occur regardless of the value.

#3

The TIMESTAMP type in the above table refers to the TIMESTAMP WITHOUT TIME ZONE type.

For the TIMESTAMP WITH TIME ZONE type, it is as follows:

  • OffsetDateTime type: N

  • LocalDateTime type: N

  • Instant type: N

  • ZonedDateTime type: N

  • Other data types: --

#4

The above table applies to BINARY and VARBINARY types.

For the UUID type, the following applies:

  • java.util.UUID type: N

  • Other data types: --

(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.

Table 7‒13: Possibility of overflow when a getXXX method (other than the getObject method) is executed

Method executed

HADB data type

SMALLINT

INTEGER

BIGINT

DOUBLE,

REAL

DEC

VCHAR

DATE

TIME

TIMESTAMP#2

ROW

BIN,

UUID

BOOLEAN

getByte

Y

Y

Y

Y

Y

Y

--

--

--

--

--

N

getShort

N#1

Y

Y

Y

Y

Y

--

--

--

--

--

N

getInt

N

N#1

Y

Y

Y

Y

--

--

--

--

--

N

getLong

N

N

N

Y

Y

Y

--

--

--

--

--

N

getFloat

N

N

N

N

N

N

--

--

--

--

--

N

getDouble

N

N

N

N

N

N

--

--

--

--

--

N

getBigDecimal

N

N

N

N

N

N

--

--

--

--

--

N

getBoolean

N

N

N

N

N

N

--

--

--

--

--

N

getString

N

N

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

--

getArray

--

--

--

--

--

N

--

--

--

--

N

--

Legend:

N: Overflow does not occur regardless of the value.

Y: Overflow might occur depending on the value.

--: Combination that is not allowed.

DOUBLE: DOUBLE PRECISION, FLOAT

DEC: DECIMAL, NUMERIC

VCHAR: CHAR, VARCHAR, STRING

BIN: BINARY, VARBINARY

#1

If the integer data type format is in legacy format, overflow might occur depending on the value.

#2

The TIMESTAMP type in the above table refers to the TIMESTAMP WITHOUT TIME ZONE type.

For the TIMESTAMP WITH TIME ZONE type, it is as follows:

  • getBytes method: N

  • getTimestamp method: N

  • Other methods: --

(4) Possibility of overflow when the getObject method is executed

The following table shows whether overflow might occur when the getObject method is executed.

Table 7‒14: Possibility of overflow when the getObject method is executed (part 1)

Data type of object obtained by the getObject method

HADB data type

SMALLINT

INTEGER

BIGINT

DOUBLE

REAL

DEC

VCHAR

Byte

Y

Y

Y

Y

Y

Y

Y

Short

N#

Y

Y

Y

Y

Y

Y

Int

N

N#

Y

Y

Y

Y

Y

Long

N

N

N

Y

Y

Y

Y

Float

N

N

N

Y

N

Y

Y

Double

N

N

N

N

Y

Y

Y

BigDecimal

N

N

N

N

Y

Y

Y

Boolean

N

N

N

N

N

N

N

String

N

N

N

N

N

N

N

Bytes

--

--

--

--

--

--

--

Date

--

--

--

--

--

--

N

Time

--

--

--

--

--

--

N

Timestamp

--

--

--

--

--

--

N

AsciiStream

--

--

--

--

--

--

N

BinaryStream

--

--

--

--

--

--

N

Object

N

N

N

N

N

N

N

CharacterStream

--

--

--

--

--

--

N

OffsetDateTime

--

--

--

--

--

--

--

LocalDate

--

--

--

--

--

--

--

LocalDateTime

--

--

--

--

--

--

--

Instant

--

--

--

--

--

--

--

ZonedDateTime

--

--

--

--

--

--

--

java.util.UUID

--

--

--

--

--

--

--

Legend:

N: Overflow does not occur regardless of the value.

Y: Overflow might occur depending on the value.

--: Combination that is not allowed.

DOUBLE: DOUBLE PRECISION, FLOAT

DEC: DECIMAL, NUMERIC

VCHAR: CHAR, VARCHAR, STRING

#

If the integer data type format is in legacy format, overflow might occur depending on the value.

Table 7‒15: Possibility of overflow when the getObject method is executed (part 2)

Data type of object obtained by the getObject method

HADB data type

DATE

TIME

TIMESTAMP WITHOUT TIME ZONE

TIMESTAMP WITH TIME ZONE

ROW

BIN

BOOLEAN

UUID

Byte

--

--

--

--

--

--

N

--

Short

--

--

--

--

--

--

N

--

Int

--

--

--

--

--

--

N

--

Long

--

--

--

--

--

--

N

--

Float

--

--

--

--

--

--

N

--

Double

--

--

--

--

--

--

N

--

BigDecimal

--

--

--

--

--

--

N

--

Boolean

--

--

--

--

--

--

N

--

String

N

N

N

N

--

N

N

N

Bytes

--

--

--

--

N

N

--

N

Date

N

N

N

--

--

--

--

--

Time

--

N

N

--

--

--

--

--

Timestamp

N

N

N

N

--

--

--

--

AsciiStream

--

--

--

--

--

N

--

N

BinaryStream

--

--

--

--

--

N

--

N

Object

N

N

N

--

N

N

N

N

CharacterStream

--

--

--

--

--

N

--

N

OffsetDateTime

--

--

--

N

--

--

--

--

LocalDate

N

--

--

--

--

--

--

--

LocalDateTime

--

--

N

N

--

--

--

--

Instant

N

--

N

N

--

--

--

--

ZonedDateTime

--

--

--

N

--

--

--

--

java.util.UUID

--

--

--

--

--

--

--

N

Legend:

N: Overflow does not occur regardless of the value.

--: Combination that is not allowed.

BIN: BINARY, VARBINARY