gf icon indicating copy to clipboard operation
gf copied to clipboard

dameng database clob type mapping error

Open tianbocheng opened this issue 1 year ago • 3 comments

一、开发环境

  • github.com/gogf/gf/contrib/drivers/dm/v2 v2.4.1
  • github.com/gogf/gf/v2 v2.4.1

二、操作步骤

2.1 初始化数据库表

CREATE TABLE HANDLE_INFO (
                             ID INT IDENTITY (1, 1) NOT NULL,
                             SUB_PREFIX VARCHAR(128),
                             PREFIX VARCHAR(256),
                             HANDLE_NAME VARCHAR(1024) NOT NULL,
                             CREATE_TIME TIMESTAMP,
                             UPDATE_TIME TIMESTAMP,
                             VALUE CLOB   ,
                             NOT CLUSTER PRIMARY KEY (ID)
);

INSERT INTO OA.HANDLE_INFO (SUB_PREFIX,PREFIX,HANDLE_NAME,CREATE_TIME,UPDATE_TIME,VALUE) VALUES ('88.111','88.111.1','88.111.1/test','2023-05-16 14:37:45.337897','2023-05-16 14:37:45.337897', '[{"a": "b"}]');


2.2 执行查询操作

adsf, _ := g.DB().Model("handle_info").Where("handle_name", handle).One()
fmt.Println(adsf)

查询到 clob 字段与中不一致,结果为 {"Valid":true} 但是库中并非如此

image

tianbocheng avatar May 16 '23 06:05 tianbocheng

Dameng database clob corresponding mysql is a blob? What is the correct value? Is it a character problem or a content conversion problem?

zhonghuaxunGM avatar Jun 08 '23 07:06 zhonghuaxunGM

Dameng database clob corresponding mysql is a blob? What is the correct value? Is it a character problem or a content conversion problem?

this is a content conversion problem

find one record by handle_name return gdb.Record , gdb.Record "VALUE" conversion is wrong

adsf, _ := g.DB().Model("handle_info").Where("handle_name", handle).One()
fmt.Println(adsf)

"VALUE" content is wrong , should like this image

image

tianbocheng avatar Jun 08 '23 08:06 tianbocheng

Hello @tianbocheng. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it! 你好 @tianbocheng。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

github-actions[bot] avatar Aug 21 '23 14:08 github-actions[bot]

最新版2.7.0中已修复

wln32 avatar May 05 '24 02:05 wln32

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Fixed in the latest version 2.7.0

Issues-translate-bot avatar May 05 '24 02:05 Issues-translate-bot