Engine.Exec()不支持传入Conversion对象? #1803

Closed
opened 2020-09-27 06:36:24 +00:00 by jacexh · 1 comment

我执行以下SQL语句会报错:

db.Exec(
	"INSERT INTO snippet (id, name, description, type, details) VALUES(?, ?, ?, ?, ?) ON DUPLICATE KEY ...",
    do.ID, do.Name, do.Description, do.Type, do.Details,
    )

do.Details是一个结构体,并且实现了Conversion接口,但是执行时会报错:

sql: converting argument $5 type: unsupported type do.SpecificationDetail, a struct
我执行以下SQL语句会报错: ``` db.Exec( "INSERT INTO snippet (id, name, description, type, details) VALUES(?, ?, ?, ?, ?) ON DUPLICATE KEY ...", do.ID, do.Name, do.Description, do.Type, do.Details, ) ``` `do.Details`是一个结构体,并且实现了Conversion接口,但是执行时会报错: ``` sql: converting argument $5 type: unsupported type do.SpecificationDetail, a struct ```
lunny added the
kind
feature
label 2020-10-17 14:04:58 +00:00
lunny added this to the 1.2.0 milestone 2021-06-12 08:07:33 +00:00
lunny removed this from the 1.2.0 milestone 2021-07-28 14:20:25 +00:00
Owner

It's better to implement driver.Valuer but not conversion. For mssql, something will always wrong.

It's better to implement `driver.Valuer` but not conversion. For mssql, something will always wrong.
lunny closed this issue 2023-08-07 10:54:59 +00:00
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#1803
No description provided.