xorm 1.x版本和之前版本 针对空数组不兼容的问题 #1870

Open
opened 2021-02-22 12:42:35 +00:00 by whybangbang · 1 comment
Contributor

(1)0.x 版本insert 空数组不会报错,只是affected = 0,而现在会报 ErrNoElementsOnSlice,这在代码升级的时候会让insert方法都得重新考虑,之前只要不是err 就继续执行下面代码的逻辑都得重新审查,是否考虑过还采用原来方式?
(2)xorm 在affected 和 error 之间是如何取舍的,是否有一个原则我们可以遵循,例如“报错只包含 mysql + 网络错误 + 语法错误”,“无更新也是更新”这种
(3)这个报错和hook 也有冲突,hook的afterProcessor 是可以在hookCtx 中获取到err的,但看代码应该只有exec 里面的err 才会被hook 感知到,像 ErrNoElementsOnSlice 这种外层检查报错hook不会捕获,这对于通过hook 做监控 就存在漏报的问题

(1)0.x 版本insert 空数组不会报错,只是affected = 0,而现在会报 ErrNoElementsOnSlice,这在代码升级的时候会让insert方法都得重新考虑,之前只要不是err 就继续执行下面代码的逻辑都得重新审查,是否考虑过还采用原来方式? (2)xorm 在affected 和 error 之间是如何取舍的,是否有一个原则我们可以遵循,例如“报错只包含 mysql + 网络错误 + 语法错误”,“无更新也是更新”这种 (3)这个报错和hook 也有冲突,hook的afterProcessor 是可以在hookCtx 中获取到err的,但看代码应该只有exec 里面的err 才会被hook 感知到,像 ErrNoElementsOnSlice 这种外层检查报错hook不会捕获,这对于通过hook 做监控 就存在漏报的问题
lunny added the
kind
proposal
label 2021-03-23 13:33:03 +00:00
Owner

I think we can add all the error on hookCtx

I think we can add all the error on hookCtx
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1870
No description provided.