bug fixed for go-xorm/xorm#261
This commit is contained in:
parent
7623fc1c67
commit
bacc62db6e
10
dialect.go
10
dialect.go
|
@ -267,16 +267,16 @@ func (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset stri
|
|||
}
|
||||
|
||||
var (
|
||||
dialects = map[DbType]Dialect{}
|
||||
dialects = map[DbType]func() Dialect{}
|
||||
)
|
||||
|
||||
func RegisterDialect(dbName DbType, dialect Dialect) {
|
||||
if dialect == nil {
|
||||
func RegisterDialect(dbName DbType, dialectFunc func() Dialect) {
|
||||
if dialectFunc == nil {
|
||||
panic("core: Register dialect is nil")
|
||||
}
|
||||
dialects[dbName] = dialect // !nashtsai! allow override dialect
|
||||
dialects[dbName] = dialectFunc // !nashtsai! allow override dialect
|
||||
}
|
||||
|
||||
func QueryDialect(dbName DbType) Dialect {
|
||||
return dialects[dbName]
|
||||
return dialects[dbName]()
|
||||
}
|
||||
|
|
2
type.go
2
type.go
|
@ -254,7 +254,7 @@ func Type2SQLType(t reflect.Type) (st SQLType) {
|
|||
case reflect.String:
|
||||
st = SQLType{Varchar, 255, 0}
|
||||
case reflect.Struct:
|
||||
if t.ConvertibleTo(reflect.TypeOf(c_TIME_DEFAULT)) {
|
||||
if t.ConvertibleTo(TimeType) {
|
||||
st = SQLType{DateTime, 0, 0}
|
||||
} else {
|
||||
// TODO need to handle association struct
|
||||
|
|
Loading…
Reference in New Issue