Nonstop Database, HiRDB Version 9 UAP Development Guide

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

16.7.3 Type conversion by HiRDB.NET Data Provider

When no .NET Framework type or accessory listed in Table 16-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 16-6 and 16-7 list the type conversions for INSERT, and Tables 16-8 and 16-9 list the type conversions for SELECT.

For the definition of symbols used in Tables 16-6 through 16-9, see 16.7.3(1) Definition of symbols.

Table 16-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 C1 N N N N N E1 E1
UInt32 C2 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 16-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 E2 E2 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 E2 E2 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 E2 E2 E1 E1
Decimal data with no fractional part N N E1 E1 E1 E2 E2 E1 E1
Char N N E1 E1 E1 E2 E2 E1 E1
Char[] E1 E1 E1 E1 E1 E2 E2 E1 E1
String N N N N N N N E1 E1
DateTime N N N N N E2 E2 E1 E1
TimeSpan N N E1 E1 E1 E2 N E1 E1
Guid N N E1 E1 E1 E2 E2 E1 E1
Byte N N E1 E1 E1 E2 E2 N N
Byte[] E1 E1 E1 E1 E1 E2 E2 N N
Sbyte N N E1 E1 E1 E2 E2 N N
SByte[] E1 E1 E1 E1 E1 E2 E2 N N

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 16-8 List of type conversions for SELECT (1/2)

Accessory HiRDB data type
I SI DE F SF C VC NC NVC
GetBoolean E3 E3 E3 E3 E3 E3 E3 E3 E3
GetByte E3 E3 E3 E3 E3 E3 E3 E3 E3
GetBytes N N E1 N N N N N N
GetChar E3 E3 E3 E3 E3 E3 E3 E3 E3
GetChars E1 E1 E1 E1 E1 N N N N
GetData E3 E3 E3 E3 E3 E3 E3 E3 E3
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 E3 E3 E3 E3 E3 E3 E3 E3 E3
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 16-9 List of type conversions for SELECT (2/2)

Accessory HiRDB data type
MC MVC DA T TS IY IHS BI BL
GetBoolean E3 E3 E3 E3 E3 E3 E3 E3 E3
GetByte E3 E3 E3 E3 E3 E3 E3 E3 E3
GetBytes N N E1 E1 E1 E1 E1 N N
GetChar E3 E3 E3 E3 E3 E3 E3 E3 E3
GetChars N N E1 E1 E1 E1 E1 E1 E1
GetData E3 E3 E3 E3 E3 E3 E3 E3 E3
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 E3 E3 E3 E3 E3 E3 E3 E3 E3
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

For Int32 type, Int64 type, Single data type with no fraction part, Double data type with no fraction part, Decimal data type with no fraction part, and String data type with no fraction part:
-32768 to 32767: Normal

For UInt16, UInt32, and UInt64 types:
0 to 32767: Normal
Out of range: [Hitachi.HiRDB.HiRDBException] KFPZ24026-E format conversion error
C2

For Int64 type, Single data type with no fraction part, Double data type with no fraction part, Decimal data type with no fraction part, and String data type with no fraction part:
-2147483648 to 2147483647: Normal

For UInt32 and UInt64 types:
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
[Hitachi.HiRDB.HiRDBException] KFPZ24106-E Date and time, time interval type format error
E3 [System.NotSupportedException] unsupported error