Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

17.8.5 Overflow handling

This section explains when overflow is set when a program uses a setXXX method to set a value, or uses a getXXX method to get a value.

Organization of this subsection
(1) setXXX methods (except for the setObject method)
(2) setObject method
(3) getXXX methods (except the getObject method)
(4) getObject method

(1) setXXX methods (except for the setObject method)

Tables 17-38 and 17-39 show for each HiRDB data type whether or not overflow occurs when a setXXX method is used.

Table 17-38 Possibility of overflow when the setXXX method is used (1/2)

setXXX method HiRDB data type
SMALLINT INTEGER FLOAT REAL DECIMAL Character string types
setByte -- -- -- -- Y -
setShort -- -- -- -- Y --
setInt Y -- -- -- Y --
setLong Y Y -- -- Y --
setFloat Y Y -- -- Y --
setDouble Y Y -- -- Y --
setBigDecimal Y Y -- -- Y --
setBoolean -- -- -- -- Y --
setString Y Y -- -- Y --
setBytes N/A N/A N/A N/A N/A N/A
setDate N/A N/A N/A N/A N/A --
setTime N/A N/A N/A N/A N/A --
setTimestamp N/A N/A N/A N/A N/A --
setBlob N/A N/A N/A N/A N/A N/A
setBinaryStream N/A N/A N/A N/A N/A N/A
setAsciiStream N/A N/A N/A N/A N/A --
setCharacterStream N/A N/A N/A N/A N/A --

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.
Character string types: CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, and NVARCHAR

Table 17-39 Possibility of overflow when the setXXX method is used (2/2)

setXXX method HiRDB data type
DATE# TIME# TIMESTAMP# BINARY BLOB
setByte N/A N/A N/A N/A N/A
setShort N/A N/A N/A N/A N/A
setInt N/A N/A N/A N/A N/A
setLong N/A N/A N/A N/A N/A
setFloat N/A N/A N/A N/A N/A
setDouble N/A N/A N/A N/A N/A
setBigDecimal N/A N/A N/A N/A N/A
setBoolean N/A N/A N/A N/A N/A
setString Y -- Y N/A N/A
setBytes N/A N/A N/A -- --
setDate Y N/A Y N/A N/A
setTime N/A Y Y N/A N/A
setTimestamp Y N/A Y N/A N/A
setBlob N/A N/A N/A -- --
setBinaryStream N/A N/A N/A -- --
setAsciiStream N/A N/A N/A -- --
setCharacterStream N/A N/A N/A -- --

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination 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 HiRDB'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) setObject method

Tables 17-40 and 17-41 show whether or not overflow occurs for each HiRDB data type when the setObject method is used.

Table 17-40 Possibility of overflow when the setObject method is used (1/2)

setObject method HiRDB data type
SMALLINT INTEGER FLOAT REAL DECIMAL Character string types
Byte -- -- -- -- Y --
Short -- -- -- -- Y --
Integer Y -- -- -- Y --
Long Y Y -- -- Y --
Decimal Y Y -- -- Y --
Float Y Y -- -- Y --
Double Y Y -- Y Y --
Boolean -- -- -- -- Y --
String Y Y --- -- Y --
Date N/A N/A N/A N/A N/A --
Time N/A N/A N/A N/A N/A --
Timestamp N/A N/A N/A N/A N/A --
byte[] N/A N/A N/A N/A N/A --
Blob N/A N/A N/A N/A N/A N/A

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.
Character string types: CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, and NVARCHAR

Table 17-41 Possibility of overflow when the setObject method is used (2/2)

setObject method HiRDB data type
DATE# TIME# TIMESTAMP# BINARY BLOB
Byte N/A N/A N/A N/A N/A
Short N/A N/A N/A N/A N/A
Integer N/A N/A N/A N/A N/A
Long N/A N/A N/A N/A N/A
Decimal N/A N/A N/A N/A N/A
Float N/A N/A N/A N/A N/A
Double N/A N/A N/A N/A N/A
Boolean N/A N/A N/A N/A N/A
String Y -- Y N/A N/A
Date Y N/A Y N/A N/A
Time N/A Y N/A N/A N/A
Timestamp Y N/A Y N/A N/A
byte[] N/A N/A N/A -- --
Blob N/A N/A N/A -- --

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.

#
Overflow occurs if 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 HiRDB'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) getXXX methods (except the getObject method)

Tables 17-42 and 17-43 show whether or not overflow occurs for each HiRDB data type when a getXXX method is used.

Table 17-42 Possibility of overflow when the getXXX method is used (1/2)

getXXX method HiRDB data type
SMALLINT INTEGER FLOAT REAL DECIMAL Character string types
getByte Y Y Y Y Y Y
getShort -- Y Y Y Y Y
getInt -- -- Y Y Y Y
getLong -- -- Y Y Y Y
getFloat -- -- -- -- -- --
getDouble -- -- -- -- -- --
getBigDecimal -- -- -- -- -- --
getBoolean -- -- -- -- -- --
getString -- -- -- -- -- --
getBytes N/A N/A N/A N/A N/A N/A
getDate N/A N/A N/A N/A N/A --
getTime N/A N/A N/A N/A N/A --
getTimestamp N/A N/A N/A N/A N/A --
getAsciiStream N/A N/A N/A N/A N/A --
getBinaryStream N/A N/A N/A N/A N/A N/A
getCharacterStream N/A N/A N/A N/A N/A --
getBlob N/A N/A N/A N/A N/A N/A

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.
Character string types: CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, and NVARCHAR

Table 17-43 Possibility of overflow when the getXXX method is used (2/2)

getXXX method HiRDB data type
DATE TIME TIMESTAMP BINARY BLOB
getByte N/A N/A N/A N/A N/A
getShort N/A N/A N/A N/A N/A
getInt N/A N/A N/A N/A N/A
getLong N/A N/A N/A N/A N/A
getFloat N/A N/A N/A N/A N/A
getDouble N/A N/A N/A N/A N/A
getBigDecimal N/A N/A N/A N/A N/A
getBoolean N/A N/A N/A N/A N/A
getString -- -- -- -- --
getBytes N/A N/A N/A -- --
getDate -- N/A -- N/A N/A
getTime N/A -- -- N/A N/A
getTimestamp -- N/A -- N/A N/A
getAsciiStream N/A N/A N/A -- --
getBinaryStream N/A N/A N/A -- --
getCharacterStream N/A N/A N/A -- --
getBlob N/A N/A N/A -- --

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.

(4) getObject method

Tables 17-44 and 17-45 show whether or not overflow occurs for each HiRDB data type when the getObject method is used.

Table 17-44 Possibility of overflow when the getObject method is used (1/2)

getObject method HiRDB data type
SMALLINT INTEGER FLOAT REAL DECIMAL Character string type
Byte Y Y Y Y Y Y
Short -- Y Y Y Y Y
Int -- -- Y Y Y Y
Long -- -- Y Y Y Y
Float -- -- Y -- Y Y
Double -- -- -- Y Y Y
BigDecimal -- -- -- Y Y Y
Boolean -- -- -- -- -- --
String -- -- -- -- -- --
Bytes N/A N/A N/A N/A N/A N/A
Date N/A N/A N/A N/A N/A --
Time N/A N/A N/A N/A N/A --
Timestamp N/A N/A N/A N/A N/A --
AsciiStream N/A N/A N/A N/A N/A --
BinaryStream N/A N/A N/A N/A N/A N/A
Object -- -- -- -- -- --
CharacterStream N/A N/A N/A N/A N/A --
Blob N/A N/A N/A N/A N/A N/A

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.
Character string types: CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, and NVARCHAR

Table 17-45 Possibility of overflow when the getObject method is used (2/2)

getObject method HiRDB data type
DATE TIME TIMESTAMP BINARY BLOB
Byte N/A N/A N/A N/A N/A
Short N/A N/A N/A N/A N/A
Int N/A N/A N/A N/A N/A
Long N/A N/A N/A N/A N/A
Float N/A N/A N/A N/A N/A
Double N/A N/A N/A N/A N/A
BigDecimal N/A N/A N/A N/A N/A
Boolean N/A N/A N/A N/A N/A
String -- -- -- N/A N/A
Bytes N/A N/A N/A -- --
Date -- N/A -- N/A N/A
Time N/A -- -- N/A N/A
Timestamp -- N/A -- N/A N/A
AsciiStream N/A N/A N/A -- --
BinaryStream N/A N/A N/A -- --
Object -- -- -- -- --
CharacterStream N/A N/A N/A -- --
Blob N/A N/A N/A -- --

Legend:
--: Overflow does not occur regardless of the value.
Y: Overflow may occur depending on the value.
N/A: This combination is not allowed.