Skip to content

Commit

Permalink
MySQL 影响行数的处理,采用和 SQL Server 一样的逻辑。即 UPDATE 时,只要找到行,即使原值和目标值一致,也作为影响到…
Browse files Browse the repository at this point in the history
…行处理。
  • Loading branch information
bunnier committed Oct 8, 2023
1 parent 38de176 commit 1b3002c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mysql/mysql_db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func NewMySqlDbClient(dsn string, options ...sqlmer.DbClientOption) (*MySqlDbCli
return nil, err
}

// 影响行数的处理,采用和 SQL Server 一样的逻辑,即:
// UPDATE 时,只要找到行,即使原值和目标值一致,也作为影响到行处理。
dsnConfig.ClientFoundRows = true
dsn = dsnConfig.FormatDSN()

fixedOptions := []sqlmer.DbClientOption{
sqlmer.WithDsn(DriverName, dsn),
sqlmer.WithGetScanTypeFunc(getScanTypeFn(dsnConfig)), // 定制 Scan 类型逻辑。
Expand Down

0 comments on commit 1b3002c

Please sign in to comment.