refactors
This commit is contained in:
parent
8fd0fd9c7b
commit
a55bded518
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/go-xorm/core"
|
"github.com/go-xorm/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (session *Session) query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) {
|
func (session *Session) query(sqlStr string, paramStr ...interface{}) ([]map[string][]byte, error) {
|
||||||
session.queryPreprocess(&sqlStr, paramStr...)
|
session.queryPreprocess(&sqlStr, paramStr...)
|
||||||
|
|
||||||
if session.IsAutoCommit {
|
if session.IsAutoCommit {
|
||||||
|
@ -19,7 +19,7 @@ func (session *Session) query(sqlStr string, paramStr ...interface{}) (resultsSl
|
||||||
return session.txQuery(session.Tx, sqlStr, paramStr...)
|
return session.txQuery(session.Tx, sqlStr, paramStr...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (session *Session) txQuery(tx *core.Tx, sqlStr string, params ...interface{}) (resultsSlice []map[string][]byte, err error) {
|
func (session *Session) txQuery(tx *core.Tx, sqlStr string, params ...interface{}) ([]map[string][]byte, error) {
|
||||||
rows, err := tx.Query(sqlStr, params...)
|
rows, err := tx.Query(sqlStr, params...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -71,7 +71,7 @@ func (session *Session) innerQuery2(sqlStr string, params ...interface{}) ([]map
|
||||||
}
|
}
|
||||||
|
|
||||||
// Query runs a raw sql and return records as []map[string][]byte
|
// Query runs a raw sql and return records as []map[string][]byte
|
||||||
func (session *Session) Query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) {
|
func (session *Session) Query(sqlStr string, paramStr ...interface{}) ([]map[string][]byte, error) {
|
||||||
defer session.resetStatement()
|
defer session.resetStatement()
|
||||||
if session.IsAutoClose {
|
if session.IsAutoClose {
|
||||||
defer session.Close()
|
defer session.Close()
|
||||||
|
|
Loading…
Reference in New Issue