1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 05:20:55 +00:00

add const ErrLastInsertIdUnavailable

This commit is contained in:
jianzhiyao 2020-08-14 09:59:11 +08:00
parent 7ce0fde171
commit 139c393f08
4 changed files with 6 additions and 4 deletions

View File

@ -488,7 +488,7 @@ func (d *dbBase) InsertValue(q dbQuerier, mi *modelInfo, isMulti bool, names []s
lastInsertId, err := res.LastInsertId() lastInsertId, err := res.LastInsertId()
if err != nil { if err != nil {
DebugLog.Println("[WARN] return LastInsertId error:", err) DebugLog.Println(ErrLastInsertIdUnavailable, ':', err)
} }
return lastInsertId, nil return lastInsertId, nil
} }
@ -594,7 +594,7 @@ func (d *dbBase) InsertOrUpdate(q dbQuerier, mi *modelInfo, ind reflect.Value, a
lastInsertId, err := res.LastInsertId() lastInsertId, err := res.LastInsertId()
if err != nil { if err != nil {
DebugLog.Println("[WARN] return LastInsertId error:", err) DebugLog.Println(ErrLastInsertIdUnavailable, ':', err)
} }
return lastInsertId, nil return lastInsertId, nil
} }

View File

@ -167,7 +167,7 @@ func (d *dbBaseMysql) InsertOrUpdate(q dbQuerier, mi *modelInfo, ind reflect.Val
lastInsertId, err := res.LastInsertId() lastInsertId, err := res.LastInsertId()
if err != nil { if err != nil {
DebugLog.Println("[WARN] return LastInsertId error:", err) DebugLog.Println(ErrLastInsertIdUnavailable, ':', err)
} }
return lastInsertId, nil return lastInsertId, nil
} }

View File

@ -153,7 +153,7 @@ func (d *dbBaseOracle) InsertValue(q dbQuerier, mi *modelInfo, isMulti bool, nam
lastInsertId, err := res.LastInsertId() lastInsertId, err := res.LastInsertId()
if err != nil { if err != nil {
DebugLog.Println("[WARN] return LastInsertId error:", err) DebugLog.Println(ErrLastInsertIdUnavailable, ':', err)
} }
return lastInsertId, nil return lastInsertId, nil
} }

View File

@ -85,6 +85,8 @@ var (
ErrStmtClosed = errors.New("<QuerySeter> stmt already closed") ErrStmtClosed = errors.New("<QuerySeter> stmt already closed")
ErrArgs = errors.New("<Ormer> args error may be empty") ErrArgs = errors.New("<Ormer> args error may be empty")
ErrNotImplement = errors.New("have not implement") ErrNotImplement = errors.New("have not implement")
ErrLastInsertIdUnavailable = errors.New("<Ormer> last insert id is unavailable")
) )
// Params stores the Params // Params stores the Params