15.7.3 Type conversion by HiRDB.NET Data Provider

When no .NET Framework type or accessory listed in Table 15-5 is used, type conversion takes place automatically within the HiRDB data provider. No .NET Framework type or accessory is used when Int32-type data is inserted in a table that contains items with the CHAR attribute or the GetInt32 method is used for acquisition.

Tables 15-6 and 15-7 list the type conversions for INSERT, and Tables 15-8 and 15-9 list the type conversions for SELECT.

For the definition of symbols used in tables 15-6 through 15-9, see 15.7.3(1) Definition of symbols.

Table 15-6 List of type conversions for INSERT (1/2)

.NET Framework typeHiRDB data type
ISIDEFSFCVCNCNVC
BooleanE1E1E1E1E1E1E1E1E1
Int16NNNNNNNE1E1
Int32NC1NNNNNE1E1
Int64C2C1NNNNNE1E1
UInt16NNNNNNNE1E1
UInt32NC1NNNNNE1E1
UInt64C2C1NNNNNE1E1
Single data with fractional partC4C3NNNNNE1E1
Single data with no fractional partC2C1NNNNNE1E1
Double data with fractional partC4C3NNNNNE1E1
Double data with no fractional partC2C1NNNNNE1E1
Decimal data with fractional partC4C3NNNNNE1E1
Decimal data with no fractional partC2C1NNNNNE1E1
CharN1N1E1E1E1NNNN
Char[]E1E1E1E1E1E1E1E1E1
StringC2C1NNNNNNN
DateTimeE1E1E1E1E1NNE1E1
TimeSpanE1E1E1E1E1NNE1E1
GuidE1E1E1E1E1NNE1E1
ByteNNNNNNNE1E1
Byte[]E1E1E1E1E1E1E1E1E1
SbyteNNNNNNNE1E1
SByte[]E1E1E1E1E1E1E1E1E1

Table 15-7 List of type conversions for INSERT (2/2)

.NET Framework typeHiRDB data type
MCMVCDATTSIYIHSBIBL
BooleanE1E1E1E1E1E1E1E1E1
Int16NNE1E1E1E2E2E1E1
Int32NNE1E1E1E2E2E1E1
Int64NNE1E1E1E2E2E1E1
UInt16NNE1E1E1E2E2E1E1
UInt32NNE1E1E1E2E2E1E1
UInt64NNE1E1E1E2E2E1E1
Single data with fractional partNNE1E1E1E3E3E1E1
Single data with no fractional partNNE1E1E1E2E2E1E1
Double data with fractional partNNE1E1E1E3E3E1E1
Double data with no fractional partNNE1E1E1E2E2E1E1
Decimal data with fractional partNNE1E1E1E3E3E1E1
Decimal data with no fractional partNNE1E1E1E2E2E1E1
CharNNE1E1E1E3E3E1E1
Char[]E1E1E1E1E1E3E3E1E1
StringNNNNNNNE1E1
DateTimeNNNNNE3E3E1E1
TimeSpanNNE1E1E1E3NE1E1
GuidNNE1E1E1E3E3E1E1
ByteNNE1E1E1E3E3NN
Byte[]E1E1E1E1E1E3E3NN
SbyteNNE1E1E1E3E3E1E1
SByte[]E1E1E1E1E1E3E3E1E1
Note 1: INSERT operation on NCHAR/NVARCHAR
If the size of data obtained after S-JIS conversion consists of an odd number of bytes, the [Hitachi.HiRDB.HiRDBException]KFPZ24026-E format conversion error occurs.
Note 2: During array INSERT
If the type is not an Object array type, the [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error occurs. Because no array can be inserted in BLOB, the same error occurs if an attempt is made.

Table 15-8 List of type conversions for SELECT (1/2)

AccessoryHiRDB data type
ISIDEFSFCVCNCNVC
GetBooleanE4E4E4E4E4E4E4E4E4
GetByteE4E4E4E4E4E4E4E4E4
GetBytesNNE1NNNNNN
GetCharE4E4E4E4E4E4E4E4E4
GetCharsNNNNNNNNN
GetDataE4E4E4E4E4E4E4E4E4
GetDateTimeE1E1E1E1E1C6C6C6C6
GetDecimalNNNNNC7C7C7C7
GetDoubleNNNNNC8C8C8C8
GetFloatNNNNNC9C9C9C9
GetGuidE4E4E4E4E4E4E4E4E4
GetInt16C1NC1C1C1C1C1C1C1
GetInt32NNC2C2C2C2C2C2C2
GetInt64NNC10C10C10C10C10C10C10
GetStringNNNNNNNNN
GetValueNNNNNNNNN
GetValuesNNNNNNNNN

Table 15-9 List of type conversions for SELECT (2/2)

AccessoryHiRDB data type
MCMVCDATTSIYIHSBIBL
GetBooleanE4E4E4E4E4E4E4E4E4
GetByteE4E4E4E4E4E4E4E4E4
GetBytesNNE1E1E1E1E1NN
GetCharE4E4E4E4E4E4E4E4E4
GetCharsNNE1E1E1E1E1E1E1
GetDataE4E4E4E4E4E4E4E4E4
GetDateTimeC6C6NNNE1E1E1E1
GetDecimalC7C7E1E1E1E1E1E1E1
GetDoubleC8C8E1E1E1E1E1E1E1
GetFloatC9C9E1E1E1E1E1E1E1
GetGuidE4E4E4E4E4E4E4E4E4
GetInt16C1C1E1E1E1E1E1E1E1
GetInt32C2C2E1E1E1E1E1E1E1
GetInt64C10C10E1E1E1E1E1E1E1
GetStringNNNNNNNNN
GetValueNNNNNNNNN
GetValuesNNNNNNNNN
Note 1: During DATE acquisition
When the GetDateTime method is used, 00:00:00 is set in the time field. When the GetString method is used, the value is set in the format YYYY/MM/DD.
Note 2: During TIME/TIMESTAMP acquisition
When the GetDateTime method is used, the current date is set in the date field. When the GetString method is used, the value is set in the following format:
TIME: hh:mm:ss
TIMESTAMP(0): YYYY/MM/DD hh:mm:ss
TIMESTAMP(2): YYYY/MM/DD hh:mm:ss.nn
TIMESTAMP(4): YYYY/MM/DD hh:mm:ss.nnnn
TIMESTAMP(6): YYYY/MM/DD hh:mm:ss.nnnnnn
Note 3: During INTERVALYEARTODAY acquisition
When the GetString method is used, the value is set in the format [Figure]YYYY/MM/DD.
Note 4: During INTERVALHOURTOSECOND acquisition
When the GetString method is used, the value is set in the format [Figure]hh:mm:ss.
Organization of this subsection
(1) Definition of symbols

(1) Definition of symbols

(a) HiRDB data types

The following table defines the symbols used for the HiRDB data types:

SymbolDefinition
IINTEGER
SISMALLINT
DEDECIMAL and LARGE DECIMAL
FFLOAT/DOUBLE PRECISION
SFSMALLFLT and REAL
CCHARACTER
VCVARCHAR
NCNCHAR and NATIONAL CHARACTER
NVCNVARCHAR
MCMCHAR
MVCMVARCHAR
DADATE
TTIME
TSTIMESTAMP
IYINTERVAL YEAR TO DAY
IHSINTERVAL HOUR TO SECOND
BIBINARY
BLBLOB
(b) Whether or not type conversion is supported

N indicates normal; C indicates a conditional; and E indicates error. Some of these letters are followed by a number; they are defined as follows:

SymbolDefinition
NNumeric character code is set.
C1-32768 to 32767: Normal
0 to 32767: Normal
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C2-2147483648​ to 2147483647​: Normal
0 to 2147483647​: Normal
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C3-32768 to 32767: Normal (rounded)
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C4-2147483648​ to 2147483647​: Normal (rounded)
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C50 to 255: Normal
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C6DateTime format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C7Decimal format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C8Double format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C9Float format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C10-9223372036854775808​ to 9223372036854775807​: Normal
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
E1[Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
E2[Hitachi.HiRDB.HiRDBException] KFPZ24107-E Decimal, date and time, time interval type overflow
E3[Hitachi.HiRDB.HiRDBException] KFPZ24106-E date and time, time interval type format error
E4[System.NotSupportedException] unsupported error