bug fixed and tests passed

This commit is contained in:
Lunny Xiao 2014-04-11 17:04:39 +08:00
parent 5080b2b571
commit 128db9c792
8 changed files with 25 additions and 26 deletions

View File

@ -589,8 +589,7 @@ func (engine *Engine) mapType(v reflect.Value) *core.Table {
col.Name = key col.Name = key
} }
} }
panic("broken") engine.dialect.SqlType(col)
//engine.dialect.SqlType(col)
} }
preKey = k preKey = k
} }

View File

@ -7,8 +7,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/lunny/xorm" "github.com/go-xorm/core"
"github.com/lunny/xorm/core" "github.com/go-xorm/xorm"
) )
/* /*
@ -442,8 +442,8 @@ func update(engine *xorm.Engine, t *testing.T) {
} }
col2 := &UpdateMustCols{col1.Id, true, ""} col2 := &UpdateMustCols{col1.Id, true, ""}
boolStr := engine.columnMapper.Obj2Table("Bool") boolStr := engine.ColumnMapper.Obj2Table("Bool")
stringStr := engine.columnMapper.Obj2Table("String") stringStr := engine.ColumnMapper.Obj2Table("String")
_, err = engine.Id(col2.Id).MustCols(boolStr, stringStr).Update(col2) _, err = engine.Id(col2.Id).MustCols(boolStr, stringStr).Update(col2)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
@ -746,7 +746,8 @@ func in(engine *xorm.Engine, t *testing.T) {
users = make([]Userinfo, 0) users = make([]Userinfo, 0)
ids := []interface{}{7, 8, 9} ids := []interface{}{7, 8, 9}
err = engine.Where("departname = ?", "dev").In("(id)", ids...).Find(&users) department := engine.ColumnMapper.Obj2Table("Departname")
err = engine.Where("`"+department+"` = ?", "dev").In("(id)", ids...).Find(&users)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
panic(err) panic(err)
@ -767,7 +768,6 @@ func in(engine *xorm.Engine, t *testing.T) {
} }
} }
department := engine.ColumnMapper.Obj2Table("Departname")
dev := engine.ColumnMapper.Obj2Table("Dev") dev := engine.ColumnMapper.Obj2Table("Dev")
err = engine.In("(id)", 1).In("(id)", 2).In(department, dev).Find(&users) err = engine.In("(id)", 1).In("(id)", 2).In(department, dev).Find(&users)
@ -3918,9 +3918,9 @@ type Lowercase struct {
ended int64 `xorm:"-"` ended int64 `xorm:"-"`
} }
func testLowerCase(engine *Engine, t *testing.T) { func testLowerCase(engine *xorm.Engine, t *testing.T) {
err := engine.Sync(&Lowercase{}) err := engine.Sync(&Lowercase{})
_, err = engine.Where("id > 0").Delete(&Lowercase{}) _, err = engine.Where("(id) > 0").Delete(&Lowercase{})
if err != nil { if err != nil {
t.Error(err) t.Error(err)
panic(err) panic(err)
@ -4019,7 +4019,7 @@ func (c *CustomTableName) TableName() string {
return "customtablename" return "customtablename"
} }
func testCustomTableName(engine *Engine, t *testing.T) { func testCustomTableName(engine *xorm.Engine, t *testing.T) {
c := new(CustomTableName) c := new(CustomTableName)
err := engine.DropTables(c) err := engine.DropTables(c)
if err != nil { if err != nil {
@ -4032,7 +4032,7 @@ func testCustomTableName(engine *Engine, t *testing.T) {
} }
} }
func testAll(engine *Engine, t *testing.T) { func testAll(engine *xorm.Engine, t *testing.T) {
fmt.Println("-------------- directCreateTable --------------") fmt.Println("-------------- directCreateTable --------------")
directCreateTable(engine, t) directCreateTable(engine, t)
fmt.Println("-------------- insert --------------") fmt.Println("-------------- insert --------------")

View File

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"testing" "testing"
"github.com/lunny/xorm" "github.com/go-xorm/xorm"
) )
type BigStruct struct { type BigStruct struct {

View File

@ -7,9 +7,9 @@ import (
"database/sql" "database/sql"
"testing" "testing"
"github.com/go-xorm/xorm"
"github.com/go-xorm/xorm/caches"
_ "github.com/lunny/godbc" _ "github.com/lunny/godbc"
"github.com/lunny/xorm"
"github.com/lunny/xorm/caches"
) )
const mssqlConnStr = "driver={SQL Server};Server=192.168.20.135;Database=xorm_test; uid=sa; pwd=1234;" const mssqlConnStr = "driver={SQL Server};Server=192.168.20.135;Database=xorm_test; uid=sa; pwd=1234;"

View File

@ -4,8 +4,8 @@ import (
"database/sql" "database/sql"
"testing" "testing"
"github.com/lunny/xorm" "github.com/go-xorm/xorm"
"github.com/lunny/xorm/caches" "github.com/go-xorm/xorm/caches"
_ "github.com/ziutek/mymysql/godrv" _ "github.com/ziutek/mymysql/godrv"
) )

View File

@ -5,9 +5,9 @@ import (
"testing" "testing"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
"github.com/lunny/xorm" "github.com/go-xorm/core"
"github.com/lunny/xorm/caches" "github.com/go-xorm/xorm"
"github.com/lunny/xorm/core" "github.com/go-xorm/xorm/caches"
) )
/* /*

View File

@ -4,10 +4,10 @@ import (
"database/sql" "database/sql"
"testing" "testing"
"github.com/go-xorm/core"
"github.com/go-xorm/xorm"
"github.com/go-xorm/xorm/caches"
_ "github.com/lib/pq" _ "github.com/lib/pq"
"github.com/lunny/xorm"
"github.com/lunny/xorm/caches"
"github.com/lunny/xorm/core"
) )
//var connStr string = "dbname=xorm_test user=lunny password=1234 sslmode=disable" //var connStr string = "dbname=xorm_test user=lunny password=1234 sslmode=disable"

View File

@ -5,9 +5,9 @@ import (
"os" "os"
"testing" "testing"
"github.com/lunny/xorm" "github.com/go-xorm/core"
"github.com/lunny/xorm/caches" "github.com/go-xorm/xorm"
"github.com/lunny/xorm/core" "github.com/go-xorm/xorm/caches"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
) )