Fix some errors for the mssql support pull request

This commit is contained in:
Jinzhu 2014-09-19 21:48:55 +08:00
parent a6b243a3e9
commit 5eeff5d38f
3 changed files with 9 additions and 15 deletions

View File

@ -119,7 +119,6 @@ func (s *DB) Limit(value interface{}) *DB {
func (s *DB) Offset(value interface{}) *DB {
return s.clone().search.offset(value).db
return s.clone().search.offset(value).db
}
func (s *DB) Order(value string, reorder ...bool) *DB {

View File

@ -311,13 +311,11 @@ func TestRows(t *testing.T) {
}
count := 0
if rows != nil {
for rows.Next() {
var name string
var age int64
rows.Scan(&name, &age)
count++
}
for rows.Next() {
var name string
var age int64
rows.Scan(&name, &age)
count++
}
if count != 2 {
t.Errorf("Should found two records with name 3")
@ -452,7 +450,7 @@ func TestTimeWithZone(t *testing.T) {
name := "time_with_zone_" + strconv.Itoa(index)
user := User{Name: name, Birthday: vtime}
//mssql does not support time zones
// TODO mssql does not support time zones
if dialect := os.Getenv("GORM_DIALECT"); dialect == "mssql" {
user.Birthday = vtime.UTC()
}

View File

@ -2,9 +2,10 @@ package gorm_test
import (
"fmt"
"github.com/jinzhu/now"
"reflect"
"github.com/jinzhu/now"
"testing"
"time"
)
@ -239,11 +240,7 @@ func TestOrderAndPluck(t *testing.T) {
var ages []int64
scopedb.Order("age desc").Pluck("age", &ages)
if ages != nil {
if ages[0] != 20 {
t.Errorf("The first age should be 20 when order with age desc")
}
} else {
if ages[0] != 20 {
t.Errorf("The first age should be 20 when order with age desc")
}