THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix bugs (#1375)

tags/v0.7.6
Lunny Xiao BetaCat 2 months ago
parent
commit
9681be3e4d
2 changed files with 6 additions and 0 deletions
  1. 2
    0
      session_find.go
  2. 4
    0
      session_get.go

+ 2
- 0
session_find.go View File

@@ -63,6 +63,8 @@ func (session *Session) FindAndCount(rowsSlicePtr interface{}, condiBean ...inte
}

func (session *Session) find(rowsSlicePtr interface{}, condiBean ...interface{}) error {
defer session.resetStatement()

if session.statement.lastError != nil {
return session.statement.lastError
}

+ 4
- 0
session_get.go View File

@@ -24,6 +24,8 @@ func (session *Session) Get(bean interface{}) (bool, error) {
}

func (session *Session) get(bean interface{}) (bool, error) {
defer session.resetStatement()

if session.statement.lastError != nil {
return false, session.statement.lastError
}
@@ -75,6 +77,8 @@ func (session *Session) get(bean interface{}) (bool, error) {
if context != nil {
res := context.Get(fmt.Sprintf("%v-%v", sqlStr, args))
if res != nil {
session.engine.logger.Debug("hit context cache", sqlStr)

structValue := reflect.Indirect(reflect.ValueOf(bean))
structValue.Set(reflect.Indirect(reflect.ValueOf(res)))
session.lastSQL = ""

Loading…
Cancel
Save