diff options
author | kolaente <konrad@kola-entertainments.de> | 2018-12-12 02:01:41 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2018-12-12 09:01:41 +0800 |
commit | 6db7dbd333204bcff50716e4840deee28e09c2f9 (patch) | |
tree | b68ee709873a91738b586fa57b367b2b217b0a4a /models/models.go | |
parent | b1f3685015246d3458f6d8c1d892eab076b3ed4a (diff) | |
download | gitea-6db7dbd333204bcff50716e4840deee28e09c2f9.tar.gz gitea-6db7dbd333204bcff50716e4840deee28e09c2f9.zip |
Added test environment for mssql (#4282)
* Added test environment for m$sql
* Added template for test environment for m$sql
* Fix password
* Fix password (again)
* Fix password (again again)
* Fix db
* Ci trigger (Looking at you drone....)
* Ci trigger (Looking at you drone....)
* Ci trigger (Looking at you drone....)
* Ci trigger (Looking at you drone....)
* Create master database for mssql integration tests
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Create database only if master do not exist
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix mssql integration tests by using custom database "gitea"
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Moved defer
* bump xorm
* updated xorm
* Fixed build
Diffstat (limited to 'models/models.go')
-rw-r--r-- | models/models.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/models/models.go b/models/models.go index 0123eab12d..daef7c07e8 100644 --- a/models/models.go +++ b/models/models.go @@ -36,7 +36,7 @@ type Engine interface { Count(...interface{}) (int64, error) Decr(column string, arg ...interface{}) *xorm.Session Delete(interface{}) (int64, error) - Exec(string, ...interface{}) (sql.Result, error) + Exec(...interface{}) (sql.Result, error) Find(interface{}, ...interface{}) error Get(interface{}) (bool, error) ID(interface{}) *xorm.Session @@ -200,7 +200,8 @@ func getPostgreSQLConnectionString(DBHost, DBUser, DBPasswd, DBName, DBParam, DB return } -func parseMSSQLHostPort(info string) (string, string) { +// ParseMSSQLHostPort splits the host into host and port +func ParseMSSQLHostPort(info string) (string, string) { host, port := "127.0.0.1", "1433" if strings.Contains(info, ":") { host = strings.Split(info, ":")[0] @@ -235,7 +236,7 @@ func getEngine() (*xorm.Engine, error) { case "postgres": connStr = getPostgreSQLConnectionString(DbCfg.Host, DbCfg.User, DbCfg.Passwd, DbCfg.Name, Param, DbCfg.SSLMode) case "mssql": - host, port := parseMSSQLHostPort(DbCfg.Host) + host, port := ParseMSSQLHostPort(DbCfg.Host) connStr = fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", host, port, DbCfg.Name, DbCfg.User, DbCfg.Passwd) case "sqlite3": if !EnableSQLite3 { |