fix for bad rebase

This commit is contained in:
Joel Trost 2014-09-16 14:49:29 -07:00
parent 6b7d0879c5
commit a6b243a3e9
5 changed files with 3 additions and 9 deletions

View File

@ -31,6 +31,8 @@ func NewDialect(driver string) Dialect {
d = &mysql{} d = &mysql{}
case "sqlite3": case "sqlite3":
d = &sqlite3{} d = &sqlite3{}
case "mssql":
d = &mssql{}
default: default:
fmt.Printf("`%v` is not officially supported, running under compatibility mode.\n", driver) fmt.Printf("`%v` is not officially supported, running under compatibility mode.\n", driver)
d = &commonDialect{} d = &commonDialect{}

View File

@ -38,7 +38,7 @@ func init() {
DB, err = gorm.Open("postgres", "user=gorm DB.ame=gorm sslmode=disable") DB, err = gorm.Open("postgres", "user=gorm DB.ame=gorm sslmode=disable")
case "mssql": case "mssql":
fmt.Println("testing 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: default:
fmt.Println("testing sqlite3...") fmt.Println("testing sqlite3...")
DB, err = gorm.Open("sqlite3", "/tmp/gorm.db") DB, err = gorm.Open("sqlite3", "/tmp/gorm.db")

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"strings" "strings"
"reflect" "reflect"
"strings"
) )
type mysql struct{} type mysql struct{}

View File

@ -6,7 +6,6 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"github.com/lib/pq/hstore" "github.com/lib/pq/hstore"
"reflect"
) )
type postgres struct { type postgres struct {

View File

@ -216,8 +216,6 @@ func (s *Scope) topSql() string {
} }
} else { } else {
return "" return ""
} else {
return " LIMIT " + s.Search.Limit
} }
} }
@ -261,11 +259,7 @@ func (scope *Scope) prepareQuerySql() {
if scope.Search.Raw { if scope.Search.Raw {
scope.Raw(strings.TrimLeft(scope.CombinedConditionSql(), "WHERE ")) scope.Raw(strings.TrimLeft(scope.CombinedConditionSql(), "WHERE "))
} else { } 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())) 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 return
} }