diff --git a/VERSION b/VERSION index 40bc6907..8c5fb856 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -xorm v0.5.0.0216 +xorm v0.5.1.0228 diff --git a/session.go b/session.go index 39c6a92a..d05456c8 100644 --- a/session.go +++ b/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 } diff --git a/statement.go b/statement.go index 9b9042fa..16b0d392 100644 --- a/statement.go +++ b/statement.go @@ -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)) } diff --git a/xorm.go b/xorm.go index d31e2b11..cc51d441 100644 --- a/xorm.go +++ b/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)