bug fixed for Sync2 when mysql engine is myisam

This commit is contained in:
Lunny Xiao 2016-01-13 09:58:40 +08:00
parent 025e2a20e5
commit 90c454a96a
4 changed files with 9 additions and 5 deletions

View File

@ -1 +1 @@
xorm v0.4.5.0112
xorm v0.4.5.0113

View File

@ -105,6 +105,10 @@ func isPKZero(pk core.PK) bool {
return false
}
func equalNoCase(s1, s2 string) bool {
return strings.ToLower(s1) == strings.ToLower(s2)
}
func indexNoCase(s, sep string) int {
return strings.Index(strings.ToLower(s), strings.ToLower(sep))
}

View File

@ -3998,7 +3998,7 @@ func (s *Session) Sync2(beans ...interface{}) error {
var oriTable *core.Table
for _, tb := range tables {
if tb.Name == table.Name {
if equalNoCase(tb.Name, table.Name) {
oriTable = tb
break
}
@ -4023,7 +4023,7 @@ func (s *Session) Sync2(beans ...interface{}) error {
for _, col := range table.Columns() {
var oriCol *core.Column
for _, col2 := range oriTable.Columns() {
if col.Name == col2.Name {
if equalNoCase(col.Name, col2.Name) {
oriCol = col2
break
}
@ -4146,7 +4146,7 @@ func (s *Session) Sync2(beans ...interface{}) error {
for _, table := range tables {
var oriTable *core.Table
for _, structTable := range structTables {
if table.Name == structTable.Name {
if equalNoCase(table.Name, structTable.Name) {
oriTable = structTable
break
}

View File

@ -17,7 +17,7 @@ import (
)
const (
Version string = "0.4.5.0112"
Version string = "0.4.5.0113"
)
func regDrvsNDialects() bool {