Replies: 1 comment
-
|
转为issue #2708 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🐛 问题描述
在使用 MySQL + SeaORM 时,如果往字段里插入超长数据,MySQL 默认会 截断数据并发出 warning,而不是报错。
根据 MySQL 官方文档:
相关资料:
在 SQLx 里,可以通过
.after_connect在连接建立的时候执行来开启严格模式。
但是 SeaORM 的
ConnectOptions没有提供类似的接口,目前没有办法在 SeaORM 里直接开启严格模式,尝试过在 URL 后追加 sql_modl参数,但无效特性请求
希望 SeaORM 在
ConnectOptionsAPI 里能够暴露一个类似 SQLx.after_connect的能力,以便用户在建立连接池时配置 MySQL 的 session 变量(例如sql_mode), 或者直接提供严格模式的开启与关闭功能。🐛 Issue
Problem
When using MySQL with SeaORM, inserting a value longer than the defined column length results in silent truncation (only a warning).
According to MySQL docs:
References:
In SQLx, this can be solved by using
.after_connectto run:However, SeaORM’s
ConnectOptionsdoes not expose such anafter_connecthook, so it is not possible to enable strict SQL mode directly via SeaORM.Feature Request
Expose an
after_connecthook (similar to SQLx) insea_orm::ConnectOptions, so that users can configure MySQL session variables likesql_modewhen establishing the pool.Beta Was this translation helpful? Give feedback.
All reactions