add lowertest
This commit is contained in:
parent
112bc13fe9
commit
19b0a57dcd
42
base_test.go
42
base_test.go
|
@ -3334,6 +3334,45 @@ func testCompositeKey(engine *Engine, t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Lowercase struct {
|
||||||
|
Id int64
|
||||||
|
Name string
|
||||||
|
ended int64 `xorm:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func testLowerCase(engine *Engine, t *testing.T) {
|
||||||
|
err := engine.Sync(&Lowercase{})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = engine.Where("id > 0").Delete(&Lowercase{})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = engine.Insert(&Lowercase{ended: 1})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
ls := make([]Lowercase, 0)
|
||||||
|
err = engine.Find(&ls)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(ls) != 1 {
|
||||||
|
err = errors.New("should be 1")
|
||||||
|
t.Error(err)
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testAll(engine *Engine, t *testing.T) {
|
func testAll(engine *Engine, t *testing.T) {
|
||||||
fmt.Println("-------------- directCreateTable --------------")
|
fmt.Println("-------------- directCreateTable --------------")
|
||||||
directCreateTable(engine, t)
|
directCreateTable(engine, t)
|
||||||
|
@ -3430,6 +3469,8 @@ func testAll2(engine *Engine, t *testing.T) {
|
||||||
testPrefixTableName(engine, t)
|
testPrefixTableName(engine, t)
|
||||||
fmt.Println("-------------- testCreatedUpdated --------------")
|
fmt.Println("-------------- testCreatedUpdated --------------")
|
||||||
testCreatedUpdated(engine, t)
|
testCreatedUpdated(engine, t)
|
||||||
|
fmt.Println("-------------- testLowercase ---------------")
|
||||||
|
testLowerCase(engine, t)
|
||||||
fmt.Println("-------------- processors --------------")
|
fmt.Println("-------------- processors --------------")
|
||||||
testProcessors(engine, t)
|
testProcessors(engine, t)
|
||||||
fmt.Println("-------------- transaction --------------")
|
fmt.Println("-------------- transaction --------------")
|
||||||
|
@ -3446,4 +3487,5 @@ func testAll3(engine *Engine, t *testing.T) {
|
||||||
testNullValue(engine, t)
|
testNullValue(engine, t)
|
||||||
fmt.Println("-------------- testCompositeKey --------------")
|
fmt.Println("-------------- testCompositeKey --------------")
|
||||||
testCompositeKey(engine, t)
|
testCompositeKey(engine, t)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2153,6 +2153,7 @@ func (session *Session) innerInsert(bean interface{}) (int64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
colPlaces := strings.Repeat("?, ", len(colNames))
|
colPlaces := strings.Repeat("?, ", len(colNames))
|
||||||
|
fmt.Println(colNames, args)
|
||||||
colPlaces = colPlaces[0 : len(colPlaces)-2]
|
colPlaces = colPlaces[0 : len(colPlaces)-2]
|
||||||
|
|
||||||
sql := fmt.Sprintf("INSERT INTO %v%v%v (%v%v%v) VALUES (%v)",
|
sql := fmt.Sprintf("INSERT INTO %v%v%v (%v%v%v) VALUES (%v)",
|
||||||
|
|
Loading…
Reference in New Issue