From a6b243a3e9f420b0ee90faee2d0e011b4818d9fe Mon Sep 17 00:00:00 2001 From: Joel Trost Date: Tue, 16 Sep 2014 14:49:29 -0700 Subject: [PATCH] fix for bad rebase --- dialect.go | 2 ++ main_test.go | 2 +- mysql.go | 1 - postgres.go | 1 - scope_private.go | 6 ------ 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/dialect.go b/dialect.go index cc87b41a..64ffc7f0 100644 --- a/dialect.go +++ b/dialect.go @@ -31,6 +31,8 @@ func NewDialect(driver string) Dialect { d = &mysql{} case "sqlite3": d = &sqlite3{} + case "mssql": + d = &mssql{} default: fmt.Printf("`%v` is not officially supported, running under compatibility mode.\n", driver) d = &commonDialect{} diff --git a/main_test.go b/main_test.go index 4346452b..3071bf2d 100644 --- a/main_test.go +++ b/main_test.go @@ -38,7 +38,7 @@ func init() { DB, err = gorm.Open("postgres", "user=gorm DB.ame=gorm sslmode=disable") case "mssql": fmt.Println("testing mssql...") - DB, err = gorm.Open("mssql", "server=SERVER_HERE;database=DB_HERE;user id=USER_HERE;password=PW_HERE;port=1433") + DB, err = gorm.Open("mssql", "server=SERVER_HERE;database=rogue;user id=USER_HERE;password=PW_HERE;port=1433") default: fmt.Println("testing sqlite3...") DB, err = gorm.Open("sqlite3", "/tmp/gorm.db") diff --git a/mysql.go b/mysql.go index 3263180a..9f4c525b 100644 --- a/mysql.go +++ b/mysql.go @@ -4,7 +4,6 @@ import ( "fmt" "strings" "reflect" - "strings" ) type mysql struct{} diff --git a/postgres.go b/postgres.go index 78161da5..d279b859 100644 --- a/postgres.go +++ b/postgres.go @@ -6,7 +6,6 @@ import ( "fmt" "reflect" "github.com/lib/pq/hstore" - "reflect" ) type postgres struct { diff --git a/scope_private.go b/scope_private.go index adea5f26..e97dfce0 100644 --- a/scope_private.go +++ b/scope_private.go @@ -216,8 +216,6 @@ func (s *Scope) topSql() string { } } else { return "" - } else { - return " LIMIT " + s.Search.Limit } } @@ -261,11 +259,7 @@ func (scope *Scope) prepareQuerySql() { if scope.Search.Raw { scope.Raw(strings.TrimLeft(scope.CombinedConditionSql(), "WHERE ")) } else { -<<<<<<< HEAD - scope.Raw(fmt.Sprintf("SELECT %v FROM %v %v", scope.selectSql(), scope.QuotedTableName(), scope.CombinedConditionSql())) -======= scope.Raw(fmt.Sprintf("SELECT %v %v FROM %v %v", scope.topSql(), scope.selectSql(), scope.QuotedTableName(), scope.CombinedConditionSql())) ->>>>>>> 15a20a4... GORM support for MSSQL, passes all tests } return }