fixed bug insert

This commit is contained in:
Lunny Xiao 2013-11-03 22:17:00 +08:00
parent 0c541edf3f
commit b7dce622b9
1 changed files with 4 additions and 6 deletions

View File

@ -1411,13 +1411,11 @@ func (session *Session) innerInsertMulti(rowsSlicePtr interface{}) (int64, error
session.cacheInsert(session.Statement.TableName()) session.cacheInsert(session.Statement.TableName())
} }
id, err := res.LastInsertId() if table.PrimaryKey != "" {
return res.LastInsertId()
if err != nil { } else {
return -1, err return 0, nil
} }
return id, nil
} }
func (session *Session) InsertMulti(rowsSlicePtr interface{}) (int64, error) { func (session *Session) InsertMulti(rowsSlicePtr interface{}) (int64, error) {