Scalable Database Server, HiRDB Version 8 UAP Development Guide

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

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 type HiRDB data type
I SI DE F SF C VC NC NVC
Boolean E1 E1 E1 E1 E1 E1 E1 E1 E1
Int16 N N N N N N N E1 E1
Int32 N C1 N N N N N E1 E1
Int64 C2 C1 N N N N N E1 E1
UInt16 N N N N N N N E1 E1
UInt32 N C1 N N N N N E1 E1
UInt64 C2 C1 N N N N N E1 E1
Single data with fractional part C4 C3 N N N N N E1 E1
Single data with no fractional part C2 C1 N N N N N E1 E1
Double data with fractional part C4 C3 N N N N N E1 E1
Double data with no fractional part C2 C1 N N N N N E1 E1
Decimal data with fractional part C4 C3 N N N N N E1 E1
Decimal data with no fractional part C2 C1 N N N N N E1 E1
Char N1 N1 E1 E1 E1 N N N N
Char[] E1 E1 E1 E1 E1 E1 E1 E1 E1
String C2 C1 N N N N N N N
DateTime E1 E1 E1 E1 E1 N N E1 E1
TimeSpan E1 E1 E1 E1 E1 N N E1 E1
Guid E1 E1 E1 E1 E1 N N E1 E1
Byte N N N N N N N E1 E1
Byte[] E1 E1 E1 E1 E1 E1 E1 E1 E1
Sbyte N N N N N N N E1 E1
SByte[] E1 E1 E1 E1 E1 E1 E1 E1 E1

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

.NET Framework type HiRDB data type
MC MVC DA T TS IY IHS BI BL
Boolean E1 E1 E1 E1 E1 E1 E1 E1 E1
Int16 N N E1 E1 E1 E2 E2 E1 E1
Int32 N N E1 E1 E1 E2 E2 E1 E1
Int64 N N E1 E1 E1 E2 E2 E1 E1
UInt16 N N E1 E1 E1 E2 E2 E1 E1
UInt32 N N E1 E1 E1 E2 E2 E1 E1
UInt64 N N E1 E1 E1 E2 E2 E1 E1
Single data with fractional part N N E1 E1 E1 E3 E3 E1 E1
Single data with no fractional part N N E1 E1 E1 E2 E2 E1 E1
Double data with fractional part N N E1 E1 E1 E3 E3 E1 E1
Double data with no fractional part N N E1 E1 E1 E2 E2 E1 E1
Decimal data with fractional part N N E1 E1 E1 E3 E3 E1 E1
Decimal data with no fractional part N N E1 E1 E1 E2 E2 E1 E1
Char N N E1 E1 E1 E3 E3 E1 E1
Char[] E1 E1 E1 E1 E1 E3 E3 E1 E1
String N N N N N N N E1 E1
DateTime N N N N N E3 E3 E1 E1
TimeSpan N N E1 E1 E1 E3 N E1 E1
Guid N N E1 E1 E1 E3 E3 E1 E1
Byte N N E1 E1 E1 E3 E3 N N
Byte[] E1 E1 E1 E1 E1 E3 E3 N N
Sbyte N N E1 E1 E1 E3 E3 E1 E1
SByte[] E1 E1 E1 E1 E1 E3 E3 E1 E1

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)

Accessory HiRDB data type
I SI DE F SF C VC NC NVC
GetBoolean E4 E4 E4 E4 E4 E4 E4 E4 E4
GetByte E4 E4 E4 E4 E4 E4 E4 E4 E4
GetBytes N N E1 N N N N N N
GetChar E4 E4 E4 E4 E4 E4 E4 E4 E4
GetChars N N N N N N N N N
GetData E4 E4 E4 E4 E4 E4 E4 E4 E4
GetDateTime E1 E1 E1 E1 E1 C6 C6 C6 C6
GetDecimal N N N N N C7 C7 C7 C7
GetDouble N N N N N C8 C8 C8 C8
GetFloat N N N N N C9 C9 C9 C9
GetGuid E4 E4 E4 E4 E4 E4 E4 E4 E4
GetInt16 C1 N C1 C1 C1 C1 C1 C1 C1
GetInt32 N N C2 C2 C2 C2 C2 C2 C2
GetInt64 N N C10 C10 C10 C10 C10 C10 C10
GetString N N N N N N N N N
GetValue N N N N N N N N N
GetValues N N N N N N N N N

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

Accessory HiRDB data type
MC MVC DA T TS IY IHS BI BL
GetBoolean E4 E4 E4 E4 E4 E4 E4 E4 E4
GetByte E4 E4 E4 E4 E4 E4 E4 E4 E4
GetBytes N N E1 E1 E1 E1 E1 N N
GetChar E4 E4 E4 E4 E4 E4 E4 E4 E4
GetChars N N E1 E1 E1 E1 E1 E1 E1
GetData E4 E4 E4 E4 E4 E4 E4 E4 E4
GetDateTime C6 C6 N N N E1 E1 E1 E1
GetDecimal C7 C7 E1 E1 E1 E1 E1 E1 E1
GetDouble C8 C8 E1 E1 E1 E1 E1 E1 E1
GetFloat C9 C9 E1 E1 E1 E1 E1 E1 E1
GetGuid E4 E4 E4 E4 E4 E4 E4 E4 E4
GetInt16 C1 C1 E1 E1 E1 E1 E1 E1 E1
GetInt32 C2 C2 E1 E1 E1 E1 E1 E1 E1
GetInt64 C10 C10 E1 E1 E1 E1 E1 E1 E1
GetString N N N N N N N N N
GetValue N N N N N N N N N
GetValues N N N N N N N N N

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:

Symbol Definition
I INTEGER
SI SMALLINT
DE DECIMAL and LARGE DECIMAL
F FLOAT/DOUBLE PRECISION
SF SMALLFLT and REAL
C CHARACTER
VC VARCHAR
NC NCHAR and NATIONAL CHARACTER
NVC NVARCHAR
MC MCHAR
MVC MVARCHAR
DA DATE
T TIME
TS TIMESTAMP
IY INTERVAL YEAR TO DAY
IHS INTERVAL HOUR TO SECOND
BI BINARY
BL BLOB
(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:

Symbol Definition
N Numeric 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
C5 0 to 255: Normal
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C6 DateTime format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C7 Decimal format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C8 Double format data: Normal
Other: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C9 Float 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