Update session.go

fix stmt query of 'Get function' bug when an error occurred
This commit is contained in:
starChou 2014-07-31 15:30:42 +08:00
parent 6e37d48701
commit d22a247759
1 changed files with 3 additions and 0 deletions

View File

@ -983,6 +983,9 @@ func (session *Session) Get(bean interface{}) (bool, error) {
} }
// defer stmt.Close() // !nashtsai! don't close due to stmt is cached and bounded to this session // defer stmt.Close() // !nashtsai! don't close due to stmt is cached and bounded to this session
rawRows, err = stmt.Query(args...) rawRows, err = stmt.Query(args...)
if err != nil {
return false, err
}
} else { } else {
rawRows, err = session.Tx.Query(sqlStr, args...) rawRows, err = session.Tx.Query(sqlStr, args...)
} }