From 8cdfd3289eb03388b8e92fb39de918b4c59bb03f Mon Sep 17 00:00:00 2001 From: travelliu Date: Fri, 10 Jun 2022 16:18:28 +0800 Subject: [PATCH] update(mysql): empty string != null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - openGauss B模式下和MySQL一样, NULL != `''` 无需处理 - Informix '' != Null --- product/en/docs-mtk/v2.0/faqs.md | 2 + .../docs-mtk/v2.0/mtk-mysql-to-openGauss.md | 1 + product/zh/docs-mtk/v2.0/faqs.md | 2 + .../v2.0/mtk-informix-to-openGauss.md | 41 ++++++++++++++++++- .../docs-mtk/v2.0/mtk-mysql-to-openGauss.md | 1 + 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/product/en/docs-mtk/v2.0/faqs.md b/product/en/docs-mtk/v2.0/faqs.md index 95ed7585..98c3322d 100644 --- a/product/en/docs-mtk/v2.0/faqs.md +++ b/product/en/docs-mtk/v2.0/faqs.md @@ -80,6 +80,8 @@ The following scenarios exist. - openGauss - 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. 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 66267344..209e655d 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 @@ -22,6 +22,7 @@ date: 2021-03-04 - openGauss A mode is different from MySQL, and data needs to be processed. When the attribute of the column is ``NOT NULL`, it is converted to`" "`, and when it is allowed to be NULL, it is converted to NULL - openGauss PG mode is the same as MySQL, NULL != `''` No need to deal with +- openGauss B mode is the same as MySQL, NULL != `''` No need to deal with Database compatible types. Value range: **A**, **B**, **C**, and **PG** diff --git a/product/zh/docs-mtk/v2.0/faqs.md b/product/zh/docs-mtk/v2.0/faqs.md index 9afbc400..8e229a77 100644 --- a/product/zh/docs-mtk/v2.0/faqs.md +++ b/product/zh/docs-mtk/v2.0/faqs.md @@ -78,6 +78,8 @@ Char类型数据需要注意. 如在Oracle里Char(1)迁移到openGauss/MogDB就 - openGauss - A 兼容模式下 '' = null - PG 兼容模式下 '' != null + - B 兼容模式下 '' != null +- Informix '' != null 当目标数据库的处理方式和源数据库不一致时,MTK会根据列的属性进行数据转换. 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 1f463bde..e6144f61 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 @@ -25,6 +25,26 @@ date: 2022-05-28 ## 注意事项 +### 空字符串和NULL问题 + +空字符串和NULL问题, Informix null 不等于 '' + +openGauss A 模式下和 Informix 不一样,需要处理数据 当列的属性为not null时转为`" "`,允许为null时转为null + +openGauss PG 模式下和 Informix 一样, null != '' 无需处理 + +openGauss B 模式下和 Informix 一样, null != '' 无需处理 + +DBCOMPATIBILITY [ = ] compatibility_type + +指定兼容的数据库的类型。取值范围: A、B、C、PG。分别表示兼容Oracle、MySQL、Teradata和PostgreSQL。但是C目前已经放弃支持。因此常用的取值是A、B、PG。 + + > 说明: + > + > - A兼容性下,数据库将空字符串作为NULL处理,数据类型DATE会被替换为TIMESTAMP(0) WITHOUT TIME ZONE。 + > - 将字符串转换成整数类型时,如果输入不合法,B兼容性会将输入转换为0,而其它兼容性则会报错。 + > - PG兼容性下,CHAR和VARCHAR以字符为计数单位,其它兼容性以字节为计数单位。例如,对于UTF-8字符集,CHAR(3)在PG兼容性下能存放3个中文字符,而在其它兼容性下只能存放1个中文字符。 + ### 序列 > informix 的序列是一张表,只是表上只有一个自增列 @@ -43,7 +63,7 @@ date: 2022-05-28 - 支持中文. UTF8字符集 - ```jdbc + ```java # jdbc 中文字符测试 jdbc:informix-sqli://localhost:19088/sysadmin:INFORMIXSERVER=dev;NEWCODESET=utf8,8859-1,819;CLIENT_LOCALE=en_US.utf8;DB_LOCALE=en_US.utf8; ``` @@ -242,6 +262,8 @@ openGauss统一处理为bigint类型加默认序列 ### 视图 +- 无语法转换迁移. + ### 函数 ### 存储过程 @@ -264,6 +286,7 @@ openGauss统一处理为bigint类型加默认序列 - sysobjstate 对象状态 - sysreferences 外健约束 - syschecks 检查约束 +- sysviews 视图 ### 序列信息 @@ -451,3 +474,19 @@ left outer join syscolumns c1 on c1.tabid = tab.tabid abs(part11), abs(part12), abs(part13), abs(part14), abs(part15), abs(part16)) WHERE constr.constrtype != 'N' ``` + +## 视图信息 + +```sql +select + t.owner, + t.tabname, + v.tabid, + v.seqno, + v.viewtext +from + informix.sysviews v +join informix.systables t on + v.tabid = t.tabid +order by v.tabid,v.seqno +``` diff --git a/product/zh/docs-mtk/v2.0/mtk-mysql-to-openGauss.md b/product/zh/docs-mtk/v2.0/mtk-mysql-to-openGauss.md index a119e4ff..3aaa706b 100644 --- a/product/zh/docs-mtk/v2.0/mtk-mysql-to-openGauss.md +++ b/product/zh/docs-mtk/v2.0/mtk-mysql-to-openGauss.md @@ -20,6 +20,7 @@ date: 2021-03-04 - openGauss A模式下和MySQL不一样,需要处理数据 当列的属性为`NOT NULL`时转为 `" "`,允许为NULL时转为NULL - openGauss PG模式下和MySQL一样, NULL != `''` 无需处理 +- openGauss B模式下和MySQL一样, NULL != `''` 无需处理 数据库兼容类型。取值范围: A、B、C、PG。分别表示兼容Oracle、MySQL、Teradata和PostgreSQL。但是C目前已经放弃支持。因此常用的取值是A、B、PG。 -- Gitee