From 128db9c7922b7262600392fb5300995704071cd6 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 11 Apr 2014 17:04:39 +0800 Subject: [PATCH] bug fixed and tests passed --- engine.go | 3 +-- tests/base_test.go | 20 ++++++++++---------- tests/benchmark_base_test.go | 2 +- tests/mssql_test.go | 4 ++-- tests/mymysql_test.go | 4 ++-- tests/mysql_test.go | 6 +++--- tests/postgres_test.go | 6 +++--- tests/sqlite3_test.go | 6 +++--- 8 files changed, 25 insertions(+), 26 deletions(-) diff --git a/engine.go b/engine.go index ca1eb522..0f4caacf 100644 --- a/engine.go +++ b/engine.go @@ -589,8 +589,7 @@ func (engine *Engine) mapType(v reflect.Value) *core.Table { col.Name = key } } - panic("broken") - //engine.dialect.SqlType(col) + engine.dialect.SqlType(col) } preKey = k } diff --git a/tests/base_test.go b/tests/base_test.go index c0c37015..4f5704a8 100644 --- a/tests/base_test.go +++ b/tests/base_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/lunny/xorm" - "github.com/lunny/xorm/core" + "github.com/go-xorm/core" + "github.com/go-xorm/xorm" ) /* @@ -442,8 +442,8 @@ func update(engine *xorm.Engine, t *testing.T) { } col2 := &UpdateMustCols{col1.Id, true, ""} - boolStr := engine.columnMapper.Obj2Table("Bool") - stringStr := engine.columnMapper.Obj2Table("String") + boolStr := engine.ColumnMapper.Obj2Table("Bool") + stringStr := engine.ColumnMapper.Obj2Table("String") _, err = engine.Id(col2.Id).MustCols(boolStr, stringStr).Update(col2) if err != nil { t.Error(err) @@ -746,7 +746,8 @@ func in(engine *xorm.Engine, t *testing.T) { users = make([]Userinfo, 0) 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 { t.Error(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") err = engine.In("(id)", 1).In("(id)", 2).In(department, dev).Find(&users) @@ -3918,9 +3918,9 @@ type Lowercase struct { ended int64 `xorm:"-"` } -func testLowerCase(engine *Engine, t *testing.T) { +func testLowerCase(engine *xorm.Engine, t *testing.T) { err := engine.Sync(&Lowercase{}) - _, err = engine.Where("id > 0").Delete(&Lowercase{}) + _, err = engine.Where("(id) > 0").Delete(&Lowercase{}) if err != nil { t.Error(err) panic(err) @@ -4019,7 +4019,7 @@ func (c *CustomTableName) TableName() string { return "customtablename" } -func testCustomTableName(engine *Engine, t *testing.T) { +func testCustomTableName(engine *xorm.Engine, t *testing.T) { c := new(CustomTableName) err := engine.DropTables(c) 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 --------------") directCreateTable(engine, t) fmt.Println("-------------- insert --------------") diff --git a/tests/benchmark_base_test.go b/tests/benchmark_base_test.go index 5570fa39..d970bd13 100644 --- a/tests/benchmark_base_test.go +++ b/tests/benchmark_base_test.go @@ -4,7 +4,7 @@ import ( "database/sql" "testing" - "github.com/lunny/xorm" + "github.com/go-xorm/xorm" ) type BigStruct struct { diff --git a/tests/mssql_test.go b/tests/mssql_test.go index e814d855..fac774e1 100644 --- a/tests/mssql_test.go +++ b/tests/mssql_test.go @@ -7,9 +7,9 @@ import ( "database/sql" "testing" + "github.com/go-xorm/xorm" + "github.com/go-xorm/xorm/caches" _ "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;" diff --git a/tests/mymysql_test.go b/tests/mymysql_test.go index 5646f95c..ef212a2c 100644 --- a/tests/mymysql_test.go +++ b/tests/mymysql_test.go @@ -4,8 +4,8 @@ import ( "database/sql" "testing" - "github.com/lunny/xorm" - "github.com/lunny/xorm/caches" + "github.com/go-xorm/xorm" + "github.com/go-xorm/xorm/caches" _ "github.com/ziutek/mymysql/godrv" ) diff --git a/tests/mysql_test.go b/tests/mysql_test.go index 38eebc55..02a70b39 100644 --- a/tests/mysql_test.go +++ b/tests/mysql_test.go @@ -5,9 +5,9 @@ import ( "testing" _ "github.com/go-sql-driver/mysql" - "github.com/lunny/xorm" - "github.com/lunny/xorm/caches" - "github.com/lunny/xorm/core" + "github.com/go-xorm/core" + "github.com/go-xorm/xorm" + "github.com/go-xorm/xorm/caches" ) /* diff --git a/tests/postgres_test.go b/tests/postgres_test.go index 85e926cc..8abee32f 100644 --- a/tests/postgres_test.go +++ b/tests/postgres_test.go @@ -4,10 +4,10 @@ import ( "database/sql" "testing" + "github.com/go-xorm/core" + "github.com/go-xorm/xorm" + "github.com/go-xorm/xorm/caches" _ "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" diff --git a/tests/sqlite3_test.go b/tests/sqlite3_test.go index 1f982e29..18cc84a3 100644 --- a/tests/sqlite3_test.go +++ b/tests/sqlite3_test.go @@ -5,9 +5,9 @@ import ( "os" "testing" - "github.com/lunny/xorm" - "github.com/lunny/xorm/caches" - "github.com/lunny/xorm/core" + "github.com/go-xorm/core" + "github.com/go-xorm/xorm" + "github.com/go-xorm/xorm/caches" _ "github.com/mattn/go-sqlite3" )