diff options
Diffstat (limited to 'vendor/github.com/go-xorm/xorm/engine.go')
-rw-r--r-- | vendor/github.com/go-xorm/xorm/engine.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vendor/github.com/go-xorm/xorm/engine.go b/vendor/github.com/go-xorm/xorm/engine.go index 846889c364..89a96d9fdb 100644 --- a/vendor/github.com/go-xorm/xorm/engine.go +++ b/vendor/github.com/go-xorm/xorm/engine.go @@ -177,6 +177,14 @@ func (engine *Engine) QuoteStr() string { return engine.dialect.QuoteStr() } +func (engine *Engine) quoteColumns(columnStr string) string { + columns := strings.Split(columnStr, ",") + for i := 0; i < len(columns); i++ { + columns[i] = engine.Quote(strings.TrimSpace(columns[i])) + } + return strings.Join(columns, ",") +} + // Quote Use QuoteStr quote the string sql func (engine *Engine) Quote(value string) string { value = strings.TrimSpace(value) @@ -237,6 +245,11 @@ func (engine *Engine) AutoIncrStr() string { return engine.dialect.AutoIncrStr() } +// SetConnMaxLifetime sets the maximum amount of time a connection may be reused. +func (engine *Engine) SetConnMaxLifetime(d time.Duration) { + engine.db.SetConnMaxLifetime(d) +} + // SetMaxOpenConns is only available for go 1.2+ func (engine *Engine) SetMaxOpenConns(conns int) { engine.db.SetMaxOpenConns(conns) @@ -1333,10 +1346,10 @@ func (engine *Engine) DropIndexes(bean interface{}) error { } // Exec raw sql -func (engine *Engine) Exec(sql string, args ...interface{}) (sql.Result, error) { +func (engine *Engine) Exec(sqlorArgs ...interface{}) (sql.Result, error) { session := engine.NewSession() defer session.Close() - return session.Exec(sql, args...) + return session.Exec(sqlorArgs...) } // Query a raw sql and return records as []map[string][]byte |