DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: webb123
今日帖子: 34
在线用户: 16
导航: 论坛 -> 数据库专区 斑竹:liumazi,waterstone  
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/7/29 16:03:13
标题:
【delphi+unidac+openGauss】取日期问题 浏览:1926
加入我的收藏
楼主: 遇到个很奇怪的问题。
PS:试了一下【bcb+unidac+openGauss】也一样。

当SQL选出的字段是日期型(Timestamp)时包括now()
程序.AsDatetime取到的任何日期永远是"2000-01-01"
用.value看也一样,数值取出来时已经变了。

其它语言比如Java,C和libpq都正常。
访问其它数据库比如Oracle,MySQL,包括PostgreSQL也正常。

不知道大家有没有遇到过这种情况。
----------------------------------------------
Bye bye DDRFAN...
作者:
男 nevergrief (孤独骑士) ★☆☆☆☆ -
盒子活跃会员
2022/7/30 1:01:24
1楼: 数据库的编码分为存储层和传输层,我估计还是传输层的编码出了问题。
而且传入和传出又可以分开设置编码。同时Unidac也要设置用什么编码去传输。你看看问题是不是出在这里。
----------------------------------------------
只有偏执狂才能生存!
作者:
男 hnxxcxg (咏南中间件) ★☆☆☆☆ -
盒子活跃会员
2022/7/30 8:43:36
2楼: 想问下楼主:日期、时间倘要支持跨语言、平台,怎么弄?楼主请想一想。
----------------------------------------------
中间件QQ群: 92449782 博客: http://www.cnblogs.com/hnxxcxg/
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/7/30 10:11:57
3楼: maybe working in UTC format?

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.DateUtils.DateToISO8601

StackOverFlow:
----------
If you are using Indy 10, its StrInternetToDateTime() and GMTToLocalDateTime() functions (in the IdGlobalProtocols unit) can parse ISO-8601 formatted strings.

https://stackoverflow.com/questions/1597754/convert-utc-string-to-tdatetime-in-delphi

----------
use NTP instead TIME protocol:

https://en.delphipraxis.net/topic/1297-ntp-which-component-to-use/
此帖子包含附件:
PNG 图像
大小:55.5K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/7/30 14:54:21
4楼: @nevergrief

openGauss来自PostgreSQL,如果用Java则两者有各自的包。
但是对于Unidac我只能用Provider=PostgreSQL。
我怀疑底层确实有不一样的地方。
因为除了这个问题,openGauss还经常出现“portal PORTALSTXXXXXXXXX cannot be run”这种错误,SQL很普通,仅仅是无数据返回而已,居然就抛异常了。。。

最特别是只有【Unidac+openGauss】这一个组合,有这些个问题。
其它各种语言和各种数据库组合都正常。

公司留下的Delphi程序不多了,我都是设法绕过,不抱太高期望能解决。

发帖主要还想是碰碰运气,论坛高人很多,万一有人知道呢:)
----------------------------------------------
Bye bye DDRFAN...
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/7/30 15:00:04
5楼: @hnxxcxg
存数值啊,epoch一类的。
不同语言0值不一样。

问题我这取得的数值就是0……
----------------------------------------------
Bye bye DDRFAN...
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/7/30 15:01:00
6楼: @emailx45
thx,but the problem is only occur when 【unidac+openGauss3.0.0】.
----------------------------------------------
Bye bye DDRFAN...
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/8/1 15:59:14
7楼: 经过乱试,发现这个玩意儿会影响。

ProtocolVersion
Specifies protocol version to be used when several versions are available. 

Supported values: 

pv20 Set ProtocolVersion to pv20 to work with PostgreSQL server version 7.3 or older that don't support protocol version 3.0. 

pv30 Set ProtocolVersion to pv30 to enforce protocol version 3.0. 

pvAuto (default) Set ProtocolVersion to pvAuto to automatically select between protocol versions depending on the specific query for the best possible performance 

所以设置:
UniSession->SpecificOptions->Values["ProtocolVersion"] = "pv20";
就能正常的选出时间,同时不再有Portalxxxx的错误。

但是新的错误是选出来的二进制变得不正确了(WTF?)……

而且无法连接PostgreSQL 14.4 了(报只支持3.0协议)

目前看来,还是用别的方式连接自主可控的openGauss吧。
btw:不懂openGauss最开始到底出自PostgreSQL哪个版本。
----------------------------------------------
Bye bye DDRFAN...
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/8/2 10:37:10
8楼: a guide complete ( I think... I never heard about OpenGauss :))))
https://medium.com/codex/create-a-distributed-database-solution-based-on-postgresql-opengauss-b30d0e1ced2c
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/8/2 11:43:32
9楼: @emailx45

Me too, never heard about openGauss 3 months ago...
but somehow openGauss(Postgre) and GoldenDB(MySQL) become replacement of Oracle ...... and now most job is done,

and this? ... just let it go ...

I tell myself, not every issue need to be sovled... :)
----------------------------------------------
Bye bye DDRFAN...
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/8/2 20:42:12
10楼: if Huawei use it, then it should be good, not? >:_)
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 ddrfan (若苗瞬) ▲▲▲▲▲ -
普通会员
2022/8/9 17:36:58
11楼: 华为涉及得太广了……
感觉很难Hold住。

补充另一个openGauss3.0.0的问题:
加上它的库目录,就把我的cinnamon桌面(CentOS7)弄崩溃了。

找了很久才发现是这玩意儿的锅。
----------------------------------------------
Bye bye DDRFAN...
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行85.9375毫秒 RSS