summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/go-xorm/xorm/session.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2018-01-27 09:20:59 -0600
committerLauris BH <lauris@nix.lv>2018-01-27 17:20:59 +0200
commit97fe773491ae69531141316a1178d22c8a5d1257 (patch)
tree7b000f9bfd595ef9ac063197ff8a9aa8a1fd22c7 /vendor/github.com/go-xorm/xorm/session.go
parenta0c397df08b3e2de0e438a2404dd6f8edf866acb (diff)
downloadgitea-97fe773491ae69531141316a1178d22c8a5d1257.tar.gz
gitea-97fe773491ae69531141316a1178d22c8a5d1257.zip
fix MSSQL bug on org (#3405)
Diffstat (limited to 'vendor/github.com/go-xorm/xorm/session.go')
-rw-r--r--vendor/github.com/go-xorm/xorm/session.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/github.com/go-xorm/xorm/session.go b/vendor/github.com/go-xorm/xorm/session.go
index ed25205880..5c6cb5f9de 100644
--- a/vendor/github.com/go-xorm/xorm/session.go
+++ b/vendor/github.com/go-xorm/xorm/session.go
@@ -76,6 +76,7 @@ func (session *Session) Init() {
session.afterDeleteBeans = make(map[interface{}]*[]func(interface{}), 0)
session.beforeClosures = make([]func(interface{}), 0)
session.afterClosures = make([]func(interface{}), 0)
+ session.stmtCache = make(map[uint32]*core.Stmt)
session.afterProcessors = make([]executedProcessor, 0)
@@ -262,13 +263,13 @@ func (session *Session) canCache() bool {
return true
}
-func (session *Session) doPrepare(sqlStr string) (stmt *core.Stmt, err error) {
+func (session *Session) doPrepare(db *core.DB, sqlStr string) (stmt *core.Stmt, err error) {
crc := crc32.ChecksumIEEE([]byte(sqlStr))
// TODO try hash(sqlStr+len(sqlStr))
var has bool
stmt, has = session.stmtCache[crc]
if !has {
- stmt, err = session.DB().Prepare(sqlStr)
+ stmt, err = db.Prepare(sqlStr)
if err != nil {
return nil, err
}
@@ -461,6 +462,10 @@ func (session *Session) slice2Bean(scanResults []interface{}, fields []string, b
hasAssigned = true
if len(bs) > 0 {
+ if fieldType.Kind() == reflect.String {
+ fieldValue.SetString(string(bs))
+ continue
+ }
if fieldValue.CanAddr() {
err := json.Unmarshal(bs, fieldValue.Addr().Interface())
if err != nil {