bug fixed for soft delete and resolved #359 and disable warning when found non-sync tables
This commit is contained in:
parent
15386d2d2f
commit
862d4e0586
18
session.go
18
session.go
|
@ -1240,7 +1240,7 @@ func (session *Session) Find(rowsSlicePtr interface{}, condiBean ...interface{})
|
|||
}
|
||||
colName = session.Engine.Quote(nm) + "." + colName
|
||||
}
|
||||
session.Statement.ConditionStr = fmt.Sprintf("%v IS NULL OR %v = '0001-01-01 00:00:00'",
|
||||
session.Statement.ConditionStr = fmt.Sprintf("(%v IS NULL OR %v = '0001-01-01 00:00:00')",
|
||||
colName, colName)
|
||||
}
|
||||
}
|
||||
|
@ -1426,18 +1426,6 @@ func (session *Session) Ping() error {
|
|||
return session.DB().Ping()
|
||||
}
|
||||
|
||||
/*
|
||||
func (session *Session) isColumnExist(tableName string, col *core.Column) (bool, error) {
|
||||
defer session.resetStatement()
|
||||
if session.IsAutoClose {
|
||||
defer session.Close()
|
||||
}
|
||||
return session.Engine.dialect.IsColumnExist(tableName, col)
|
||||
//sqlStr, args := session.Engine.dialect.ColumnCheckSql(tableName, colName)
|
||||
//results, err := session.query(sqlStr, args...)
|
||||
//return len(results) > 0, err
|
||||
}*/
|
||||
|
||||
func (engine *Engine) tableName(beanOrTableName interface{}) (string, error) {
|
||||
v := rValue(beanOrTableName)
|
||||
if v.Type().Kind() == reflect.String {
|
||||
|
@ -1596,7 +1584,7 @@ func (session *Session) dropAll() error {
|
|||
func (session *Session) getField(dataStruct *reflect.Value, key string, table *core.Table, idx int) *reflect.Value {
|
||||
var col *core.Column
|
||||
if col = table.GetColumnIdx(key, idx); col == nil {
|
||||
session.Engine.LogWarn(fmt.Sprintf("table %v's has not column %v. %v", table.Name, key, table.Columns()))
|
||||
session.Engine.LogWarn(fmt.Sprintf("table %v has no column %v. %v", table.Name, key, table.ColumnsSeq()))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -4223,7 +4211,7 @@ func (s *Session) Sync2(beans ...interface{}) error {
|
|||
}
|
||||
|
||||
if oriTable == nil {
|
||||
engine.LogWarnf("Table %s has no struct to mapping it", table.Name)
|
||||
//engine.LogWarnf("Table %s has no struct to mapping it", table.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ func buildConditions(engine *Engine, table *core.Table, bean interface{},
|
|||
}
|
||||
|
||||
if col.IsDeleted && !unscoped { // tag "deleted" is enabled
|
||||
colNames = append(colNames, fmt.Sprintf("%v IS NULL or %v = '0001-01-01 00:00:00'",
|
||||
colNames = append(colNames, fmt.Sprintf("(%v IS NULL OR %v = '0001-01-01 00:00:00')",
|
||||
colName, colName))
|
||||
}
|
||||
|
||||
|
|
6
xorm.go
6
xorm.go
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
Version string = "0.5.0.0216"
|
||||
Version string = "0.5.1.0228"
|
||||
)
|
||||
|
||||
func regDrvsNDialects() bool {
|
||||
|
@ -87,7 +87,9 @@ func NewEngine(driverName string, dataSourceName string) (*Engine, error) {
|
|||
TZLocation: time.Local,
|
||||
}
|
||||
|
||||
engine.SetLogger(NewSimpleLogger(os.Stdout))
|
||||
logger := NewSimpleLogger(os.Stdout)
|
||||
logger.SetLevel(core.LOG_INFO)
|
||||
engine.SetLogger(logger)
|
||||
engine.SetMapper(core.NewCacheMapper(new(core.SnakeMapper)))
|
||||
|
||||
runtime.SetFinalizer(engine, close)
|
||||
|
|
Loading…
Reference in New Issue