bug fixed

This commit is contained in:
Lunny Xiao 2015-03-03 15:14:44 +08:00
parent 26932e9b90
commit ede84cde60
2 changed files with 5 additions and 2 deletions

View File

@ -3367,7 +3367,7 @@ func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int6
if session.Statement.ColumnStr == "" {
colNames, args = buildUpdates(session.Engine, table, bean, false, false,
false, false, session.Statement.allUseBool, session.Statement.useAllCols,
session.Statement.mustColumnMap, true)
session.Statement.mustColumnMap, session.Statement.columnMap, true)
} else {
colNames, args, err = genCols(table, session, bean, true, true)
if err != nil {

View File

@ -286,7 +286,7 @@ func (statement *Statement) Table(tableNameOrBean interface{}) *Statement {
func buildUpdates(engine *Engine, table *core.Table, bean interface{},
includeVersion bool, includeUpdated bool, includeNil bool,
includeAutoIncr bool, allUseBool bool, useAllCols bool,
mustColumnMap map[string]bool, update bool) ([]string, []interface{}) {
mustColumnMap map[string]bool, columnMap map[string]bool, update bool) ([]string, []interface{}) {
colNames := make([]string, 0)
var args = make([]interface{}, 0)
@ -306,6 +306,9 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
if col.IsDeleted {
continue
}
if use, ok := columnMap[col.Name]; ok && !use {
continue
}
if engine.dialect.DBType() == core.MSSQL && col.SQLType.Name == core.Text {
continue