当前位置:网站首页>Chapter VI data type (V)
Chapter VI data type (V)
2022-06-12 11:55:00 【yaoxin521123】
List of articles
Chapter six data type ( 5、 ... and )
Integer code of data type
In query metadata and other contexts , The data type defined for the column can be returned as an integer code . CType( Client data type ) Integer codes are listed in %SQL.StatementColumnclientType Properties of the .
ODBC and JDBC Use xDBC Data type code (SQLType). ODBC The data type code is defined by %SQL.Statement.%Metadata.columns.GetAt() Method returns , As shown in the example above . SQL Shell Metadata also returns ODBC Data type code . JDBC Code and the ODBC Same code , In addition to the representation of time and date data types . These are listed below ODBC and JDBC value :
| ODBC | JDBC | Data Type |
|---|---|---|
| -11 | -11 | GUID |
| -7 | -7 | BIT |
| -6 | -6 | TINYINT |
| -5 | -5 | BIGINT |
| -4 | -4 | LONGVARBINARY |
| -3 | -3 | VARBINARY |
| -2 | -2 | BINARY |
| -1 | -1 | LONGVARCHAR |
| 0 | 0 | Unknown type |
| 1 | 1 | CHAR |
| 2 | 2 | NUMERIC |
| 3 | 3 | DECIMAL |
| 4 | 4 | INTEGER |
| 5 | 5 | SMALLINT |
| 6 | 6 | FLOAT |
| 7 | 7 | REAL |
| 8 | 8 | DOUBLE |
| 9 | 91 | DATE |
| 10 | 92 | TIME |
| 11 | 93 | TIMESTAMP |
| 12 | 12 | VARCHAR |
IRIS It also supports the use of multi byte character sets ODBC Application's Unicode SQL type , For example, Chinese 、 Hebrew 、 Japanese or Korean language environment .
| ODBC | Data Type |
|---|---|
| -10 | WLONGVARCHAR |
| -9 | WVARCHAR |
Create user defined DDL data type
You can modify the data type set by overriding the data type mapping of the system data type parameter value or defining a new user data type . The system data type can be modified to override Default mapping . You can create user-defined data types to provide Other data type mappings not provided .
To view and modify or add to the current user data type mapping , Please go to the administration portal , Choose system management 、 To configure 、SQL And object settings 、 user DDL mapping . To add a user data type , Please select to create a new user-defined DDL mapping . In the displayed box , Enter a name , for example VARCHAR(100) And data types , for example MyString100(MAXLEN=100).
The result will be user-defined DDL An entry in the data type list .
User defined data types can be created as data type classes . for example , You may want to create a maximum of 10 Character string data type , Then truncate the rest of the input data . This data type will be created Sample.TruncStr, As shown below :
Class Sample.TruncStr Extends %Library.String
{
Parameter MAXLEN=10;
Parameter TRUNCATE=1;
}
To use this data type in a table definition , Just specify the data type class name :
CREATE TABLE Sample.ShortNames (Name Sample.TruncStr)
As shown in the previous example , There are several useful routines for entering user-defined DDL data type :
maxval^%apiSQL()— Given precision and scale , Return each IRIS The maximum valid value of a numeric data type (MAXVAL). Grammar is :
maxval^%apiSQL(precision,scale)
minval^%apiSQL()— Given precision and scale , Return each IRIS The least significant value of a numeric data type (MINVAL). Grammar is :
minval^%apiSQL(precision,scale)
If necessary DDL The data type maps to a collection type of Stream Of IRIS attribute , Please specify... For character stream data %Stream.GlobalCharacter, Specify... For binary stream data %Stream.GlobalBinary.
If you can't find it DDL mapping , Then pass on
If DDL Encountered not in SystemDataTypes Tabular DDL Data types in the data type column , It then checks UserDataTypes surface . If there is no mapping for any data type in any table , No data type conversion will occur , And the data type will be passed directly to DDL Class definitions specified in .
for example , The following field definitions may appear in DDL In the sentence :
CREATE TABLE TestTable (
Field1 %String,
Field2 %String(MAXLEN=45)
)
In view of the above definition , If DDL stay SystemDataTypes or UserDataTypes I can't find it in China. %String or %String(MAXLEN=%1) or %String(MAXLEN=45) Mapping , Then pass on %String and %String(MAXLEN=45) Type directly to the appropriate class definition .
Convert data type
To convert data from one data type to another , Please use CAST or CONVERT function .
CAST Support conversion to multiple string and numeric data types , as well as DATE、TIME as well as TIMESTAMP and POSIXTIME Timestamp data type .
CONVERT There are two forms of grammar . Both forms support and DATE、TIME as well as TIMESTAMP and POSIXTIME Conversion between timestamp data types , And other data types .
VARCHAR Of CAST and CONVERT Handle
VARCHAR data type ( No size specified ) Mapping to 1 A character MAXLEN, As shown in the table above . however , When CAST or CONVERT Convert the value to VARCHAR when , The default size mapping is 30 Characters . Provide this 30 The default size of characters is for non - IRIS The software requires compatibility .
边栏推荐
- Neighbor item status update of neighbor subsystem
- System. IO. Fileloadexception exception
- Analyze the implementation principle of the onion model, and connect the onion model in your own project
- Manuscript manuscript format preparation
- QT添加QObject类(想使用信号和槽)遇到的问题汇总,亲测解决有效error: undefined reference to `vtable for xxxxxx(你的类名)‘
- How to select standard products and non-standard products, the importance of selection, and how to layout the store
- Mysql45 lecture 01 | infrastructure: how is an SQL query executed?
- ARP protocol data processing process of neighbor subsystem
- Miscellaneous instructions of arm instruction set
- Compiling Draco library on Windows platform
猜你喜欢

Batch load/store instructions of arm instruction set

必杀技--使用FFmpeg命令快速精准剪切视频

UML系列文章(30)体系结构建模---制品图

PDSCH 相关

MySQL - built in function

LeetCode 890. 查找和替换模式(模拟+双哈希表)

UML series articles (30) architecture modeling -- product diagram

Record the pits encountered when using JPA

Index in MySQL show index from XXX the meaning of each parameter

Must do skill -- use ffmpeg command to quickly and accurately cut video
随机推荐
Google Earth engine (GEE) - quick land classification by kmeans clustering (double for loop quick parameter adjustment)
Batch load/store instructions of arm instruction set
文件夹目录结构自动生成
Inter class and intra class relations in video classification -- regularization
6.6 separate convolution
Neighbor item status update of neighbor subsystem
Jump instruction of arm instruction set
TinyMCE series (III) introduction to common TinyMCE APIs
一个人必须不停地写作,才能不被茫茫人海淹没。
Design of tablewithpage
转载--win10打开任务管理器就蓝屏的问题
Face recognition PIP failed to install Dlib Library
[foundation of deep learning] learning of neural network (4)
Doris记录服务接口调用情况
如何确定首页和搜索之间的关系呢?首页与搜索的关系
Channel Shuffle类
ARM指令集之杂类指令
[QNX hypervisor 2.2 user manual] 4.1 method of building QNX hypervisor system
TinyMCE series (II) TinyMCE plug-in development
必杀技--使用FFmpeg命令快速精准剪切视频