优化代码

This commit is contained in:
刘祥超
2023-07-07 09:52:53 +08:00
parent 8efaacf1ef
commit a037546cfa

View File

@@ -146,7 +146,7 @@ func (this *SysLockerDAO) Increase(tx *dbs.Tx, key string, defaultValue int64) (
} }
// combine statements to make increasing faster // combine statements to make increasing faster
colValue, err := tx.FindCol(0, "INSERT INTO `edgeSysLockers` (`key`, `version`) VALUES ('"+key+"', "+types.String(defaultValue)+") ON DUPLICATE KEY UPDATE `version`=`version`+1; SELECT `version` FROM edgeSysLockers WHERE `key`='"+key+"'") colValue, err := tx.FindCol(0, "INSERT INTO `"+this.Table+"` (`key`, `version`) VALUES ('"+key+"', "+types.String(defaultValue)+") ON DUPLICATE KEY UPDATE `version`=`version`+1; SELECT `version` FROM `"+this.Table+"` WHERE `key`='"+key+"'")
if err != nil { if err != nil {
if CheckSQLErrCode(err, 1064 /** syntax error **/) { if CheckSQLErrCode(err, 1064 /** syntax error **/) {
// continue to use seperated query // continue to use seperated query