1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-16 10:52:16 +00:00

Merge branch 'develop' of https://github.com/astaxie/beego into develop

 Conflicts:
	go.sum
This commit is contained in:
harry890829
2020-06-10 11:05:57 +08:00
18 changed files with 215 additions and 56 deletions

View File

@@ -374,6 +374,7 @@ func SetMaxIdleConns(aliasName string, maxIdleConns int) {
func SetMaxOpenConns(aliasName string, maxOpenConns int) {
al := getDbAlias(aliasName)
al.MaxOpenConns = maxOpenConns
al.DB.DB.SetMaxOpenConns(maxOpenConns)
// for tip go 1.2
if fun := reflect.ValueOf(al.DB).MethodByName("SetMaxOpenConns"); fun.IsValid() {
fun.Call([]reflect.Value{reflect.ValueOf(maxOpenConns)})

View File

@@ -17,6 +17,8 @@ package orm
import (
"database/sql"
"fmt"
"reflect"
"time"
)
// sqlite operators.
@@ -66,6 +68,14 @@ type dbBaseSqlite struct {
var _ dbBaser = new(dbBaseSqlite)
// override base db read for update behavior as SQlite does not support syntax
func (d *dbBaseSqlite) Read(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, cols []string, isForUpdate bool) error {
if isForUpdate {
DebugLog.Println("[WARN] SQLite does not support SELECT FOR UPDATE query, isForUpdate param is ignored and always as false to do the work")
}
return d.dbBase.Read(q, mi, ind, tz, cols, false)
}
// get sqlite operator.
func (d *dbBaseSqlite) OperatorSQL(operator string) string {
return sqliteOperators[operator]