From 69b222e713a27777f0d2687d27c2b76cd57a83c4 Mon Sep 17 00:00:00 2001 From: travelliu Date: Thu, 16 Jun 2022 10:00:00 +0800 Subject: [PATCH] update(mtk): null style --- product/en/docs-mtk/v2.0/faqs.md | 21 +++++++++---------- product/en/docs-mtk/v2.0/mtk-db2-to-mysql.md | 4 ++-- .../en/docs-mtk/v2.0/mtk-db2-to-openGauss.md | 6 +++--- .../docs-mtk/v2.0/mtk-mysql-to-openGauss.md | 2 +- .../docs-mtk/v2.0/mtk-oracle-to-openGauss.md | 2 +- product/zh/docs-mtk/v2.0/faqs.md | 20 +++++++++--------- .../zh/docs-mtk/v2.0/mtk-db2-to-openGauss.md | 6 +++--- .../v2.0/mtk-informix-to-openGauss.md | 8 +++---- .../docs-mtk/v2.0/mtk-oracle-to-openGauss.md | 2 +- 9 files changed, 35 insertions(+), 36 deletions(-) diff --git a/product/en/docs-mtk/v2.0/faqs.md b/product/en/docs-mtk/v2.0/faqs.md index 4873aa90..9c0cd14b 100644 --- a/product/en/docs-mtk/v2.0/faqs.md +++ b/product/en/docs-mtk/v2.0/faqs.md @@ -73,20 +73,19 @@ The following scenarios exist. ## Empty String and NULL conversions ? -- Oracle '' = null -- DB2 '' != null -- MySQL '' != Null -- PostgreSQL '' != Null +- Oracle `''` = `NULL` +- DB2 `''` != `NULL` +- MySQL `''` != `NULL` +- PostgreSQL `''` != `NULL` - openGauss - - Compatibility type A: '' = null - - Compatibility type PG: '' != null - - Compatibility type B: '' != null -- Informix '' != null + - Compatibility type A: `''` = `NULL` + - Compatibility type PG: `''` != `NULL` + - Compatibility type B: `''` != `NULL` +- Informix `''` != `NULL` -MTK processes databases according to the compatibility mode of the source and target databases. +When the processing method of the target database is inconsistent with the processing method of the source database, MTK will perform data conversion according to the `NOT NULL` constraint of the column. -- '' = null does not process data. -- '' = null converts a string to '' when the column type is `NOT Null`. +If the column has `NOT NULL` constraint, and there is a `''` in the column database, the `''` will be converted to `" "`, and when it is allowed to be `NULL`, it will be converted to `NULL` ## Chr(0) 0x00 Change ? diff --git a/product/en/docs-mtk/v2.0/mtk-db2-to-mysql.md b/product/en/docs-mtk/v2.0/mtk-db2-to-mysql.md index 8e3971ec..74dcb37c 100644 --- a/product/en/docs-mtk/v2.0/mtk-db2-to-mysql.md +++ b/product/en/docs-mtk/v2.0/mtk-db2-to-mysql.md @@ -22,9 +22,9 @@ date: 2021-03-04 Table/column/index/cons names in mysql do not support suffixes with spaces, mtk will automatically trim the space on the right -### Empty String and Null Problems +### Empty String and NULL Problems -In DB2 and MySQL, null is not equal to an empty string, which does not need to be processed. +In DB2 and MySQL, `NULL` is not equal to an empty string, which does not need to be processed. #### Sequence diff --git a/product/en/docs-mtk/v2.0/mtk-db2-to-openGauss.md b/product/en/docs-mtk/v2.0/mtk-db2-to-openGauss.md index 74fe0855..835ef1b1 100644 --- a/product/en/docs-mtk/v2.0/mtk-db2-to-openGauss.md +++ b/product/en/docs-mtk/v2.0/mtk-db2-to-openGauss.md @@ -71,9 +71,9 @@ DB2 character set can be divided into three types, including OS Locale, DB2CODEP In DB2, null is not equal to an empty string. -The compatibility type A in openGauss is different from that in DB2 in that the property "not null" of a column will be converted to `" "` and will be converted to null if permitted in openGauss. +The compatibility type A in openGauss is different from that in DB2 in that the property `NOT NULL` of a column will be converted to `" "` and will be converted to `NULL` if permitted in openGauss. -The compatibility type PG in openGauss is the same as that in DB2 in that null != '' does not need to be processed. +The compatibility type PG in openGauss is the same as that in DB2 in that `NULL` !=`''` does not need to be processed. DBCOMPATIBILITY [ = ] compatibility_type @@ -91,7 +91,7 @@ Therefore, the values **A**, **B**, and **PG** are commonly used. >Note: > - > - For the compatibility type of A, the database considers an empty string as null and replace the data type **DATE** with **TIMESTAMP(0) WITHOUT TIME ZONE**. + > - For the compatibility type of A, the database considers an empty string as `NULL` and replace the data type **DATE** with **TIMESTAMP(0) WITHOUT TIME ZONE**. > - For the compatibility type of B, when a string is converted to an integer type, if an illegal value is entered, it will be converted to 0. However, for other compatibility types, an error will be reported. > - For the compatibility type of PG, CHAR and VARCHAR use character as the string unit. For other compatibility types, byte is used as the string unit. For example, as for UTF-8 character set, CHAR(3) can hold 3 Chinese characters in the compatibility type of PG but only one Chinese character in the other compatibility types. diff --git a/product/en/docs-mtk/v2.0/mtk-mysql-to-openGauss.md b/product/en/docs-mtk/v2.0/mtk-mysql-to-openGauss.md index 209e655d..7133e259 100644 --- a/product/en/docs-mtk/v2.0/mtk-mysql-to-openGauss.md +++ b/product/en/docs-mtk/v2.0/mtk-mysql-to-openGauss.md @@ -36,7 +36,7 @@ Therefore, the values **A**, **B**, and **PG** are commonly used. >Note: > - > - For the compatibility type of A, the database considers an empty string as null and replace the data type **DATE** with **TIMESTAMP(0) WITHOUT TIME ZONE**. + > - For the compatibility type of A, the database considers an empty string as `NULL` and replace the data type **DATE** with **TIMESTAMP(0) WITHOUT TIME ZONE**. > - For the compatibility type of B, when a string is converted to an integer type, if an illegal value is entered, it will be converted to 0. However, for other compatibility types, an error will be reported. > - For the compatibility type of PG, CHAR and VARCHAR use character as the string unit. For other compatibility types, byte is used as the string unit. For example, as for UTF-8 character set, CHAR(3) can hold 3 Chinese characters in the compatibility type of PG but only one Chinese character in the other compatibility types. diff --git a/product/en/docs-mtk/v2.0/mtk-oracle-to-openGauss.md b/product/en/docs-mtk/v2.0/mtk-oracle-to-openGauss.md index 68d7d5b9..95937183 100644 --- a/product/en/docs-mtk/v2.0/mtk-oracle-to-openGauss.md +++ b/product/en/docs-mtk/v2.0/mtk-oracle-to-openGauss.md @@ -98,7 +98,7 @@ The object type is from `OBJECT_TYPE` of `DBA_OBJECT`. ### Empty string problem -In Oracle, an empty string is null. In openGauss, If **dbcompatibility** is set to **A**, an empty string is null. If **dbcompatibility** is set to **PG**, an empty string is not null. +In Oracle, an empty string is `NULL`. In openGauss, If **dbcompatibility** is set to **A**, an empty string is `NULL`. If **dbcompatibility** is set to **PG**, an empty string is `NOT NULL`. DBCOMPATIBILITY [ = ] compatibility_type diff --git a/product/zh/docs-mtk/v2.0/faqs.md b/product/zh/docs-mtk/v2.0/faqs.md index 4ba42122..9b4115e9 100644 --- a/product/zh/docs-mtk/v2.0/faqs.md +++ b/product/zh/docs-mtk/v2.0/faqs.md @@ -71,19 +71,19 @@ Char类型数据需要注意. 如在Oracle里Char(1)迁移到openGauss/MogDB就 ## 存在空字符串和NULL转换? -- Oracle '' = null -- DB2 '' != null -- MySQL '' != Null -- PostgreSQL '' != Null +- Oracle `''` = `NULL` +- DB2 `''` != `NULL` +- MySQL `''` != `NULL` +- PostgreSQL `''` != `NULL` - openGauss - - A 兼容模式下 '' = null - - PG 兼容模式下 '' != null - - B 兼容模式下 '' != null -- Informix '' != null + - A 兼容模式下 `''` = `NULL` + - PG 兼容模式下 `''` != `NULL` + - B 兼容模式下 `''` != `NULL` +- Informix `''` != `NULL` -当目标数据库的处理方式和源数据库不一致时,MTK会根据列的属性进行数据转换. +当目标数据库的处理方式和源数据库处理方式不一致时,MTK会根据列的非空属性进行数据转换. -如列的数据为not null时转为`" "`,允许为null时转为null +如列存在非空约束`NOT NULL`,并且列数据库存在`''`,会把`''`时转为`" "`,允许为`NULL`时转为`NULL` ## 存在 Chr(0) 0x00 ? diff --git a/product/zh/docs-mtk/v2.0/mtk-db2-to-openGauss.md b/product/zh/docs-mtk/v2.0/mtk-db2-to-openGauss.md index a221405b..17d233eb 100644 --- a/product/zh/docs-mtk/v2.0/mtk-db2-to-openGauss.md +++ b/product/zh/docs-mtk/v2.0/mtk-db2-to-openGauss.md @@ -68,11 +68,11 @@ db2字符集分为是三种级别的字符集,包括操作系统locale,DB2CODE ### 空字符串和NULL问题 -空字符串和NULL问题, DB2 null 不等于 '' +空字符串和NULL问题, DB2 `NULL` 不等于 '' -openGauss A模式下和DB2不一样,需要处理数据 当列的属性为not null时转为`" "`,允许为null时转为null +openGauss A模式下和DB2不一样,需要处理数据 当列的属性为 `NOT NULL` 时转为 `" "`,允许为 `NULL` 时转为 `NULL` -openGauss PG模式下和DB2一样, null != '' 无需处理 +openGauss PG模式下和DB2一样, `NULL` != `''` 无需处理 DBCOMPATIBILITY [ = ] compatibility_type diff --git a/product/zh/docs-mtk/v2.0/mtk-informix-to-openGauss.md b/product/zh/docs-mtk/v2.0/mtk-informix-to-openGauss.md index 3f471e70..67878881 100644 --- a/product/zh/docs-mtk/v2.0/mtk-informix-to-openGauss.md +++ b/product/zh/docs-mtk/v2.0/mtk-informix-to-openGauss.md @@ -29,13 +29,13 @@ date: 2022-05-28 ### 空字符串和NULL问题 -空字符串和NULL问题, Informix null 不等于 '' +空字符串和NULL问题, Informix `NULL` != `''` -- openGauss A 模式下和 Informix 不一样,需要处理数据 当列的属性为not null时转为`" "`,允许为null时转为null +- openGauss A 模式下和 Informix 不一样,需要处理数据 当列的属性为 `not null` 时转为`" "`,允许为 `NULL` 时转为 `NULL` -- openGauss PG 模式下和 Informix 一样, null != '' 无需处理 +- openGauss PG 模式下和 Informix 一样, `NULL` != `''` 无需处理 -- openGauss B 模式下和 Informix 一样, null != '' 无需处理 +- openGauss B 模式下和 Informix 一样, `NULL` != `''` 无需处理 ### 序列 diff --git a/product/zh/docs-mtk/v2.0/mtk-oracle-to-openGauss.md b/product/zh/docs-mtk/v2.0/mtk-oracle-to-openGauss.md index 2edaf89e..abeff0e5 100644 --- a/product/zh/docs-mtk/v2.0/mtk-oracle-to-openGauss.md +++ b/product/zh/docs-mtk/v2.0/mtk-oracle-to-openGauss.md @@ -93,7 +93,7 @@ date: 2021-03-04 ### 空字符串和NULL问题 -Oracle 里 `''` = `NULL` 。在openGauss dbcompatibility=A的情况下。如果是`pg`兼容模式 `''` ! = `NULL` +Oracle 里 `''` = `NULL` 和 openGauss A兼容模式一致, 和`PG`兼容模式 `''` ! = `NULL` 不一样. DBCOMPATIBILITY [ = ] compatibility_type -- Gitee