This commit is contained in:
Lunny Xiao 2016-07-11 07:21:12 +08:00
parent 99af33e20b
commit b8b1711cde
4 changed files with 7 additions and 17 deletions

View File

@ -1 +1 @@
xorm v0.5.5.0709
xorm v0.5.5.0711

16
rows.go
View File

@ -94,7 +94,7 @@ func (rows *Rows) Err() error {
return rows.lastError
}
// scan row record to bean properties
// Scan row record to bean properties
func (rows *Rows) Scan(bean interface{}) error {
if rows.lastError != nil {
return rows.lastError
@ -105,22 +105,8 @@ func (rows *Rows) Scan(bean interface{}) error {
}
return rows.session.row2Bean(rows.rows, rows.fields, rows.fieldsCount, bean)
// result, err := row2map(rows.rows, rows.fields) // !nashtsai! TODO remove row2map then scanMapIntoStruct conversation for better performance
// if err == nil {
// err = rows.session.scanMapIntoStruct(bean, result)
// }
// return err
}
// // Columns returns the column names. Columns returns an error if the rows are closed, or if the rows are from QueryRow and there was a deferred error.
// func (rows *Rows) Columns() ([]string, error) {
// if rows.lastError == nil && rows.rows != nil {
// return rows.rows.Columns()
// }
// return nil, rows.lastError
// }
// close session if session.IsAutoClose is true, and claimed any opened resources
func (rows *Rows) Close() error {
if rows.session.IsAutoClose {

View File

@ -503,6 +503,7 @@ func (session *Session) innerExec(sqlStr string, args ...interface{}) (sql.Resul
func (session *Session) exec(sqlStr string, args ...interface{}) (sql.Result, error) {
for _, filter := range session.Engine.dialect.Filters() {
// TODO: for table name, it's no need to RefTable
sqlStr = filter.Do(sqlStr, session.Engine.dialect, session.Statement.RefTable)
}
@ -4064,6 +4065,7 @@ func (s *Session) Sync2(beans ...interface{}) error {
} else {
session := engine.NewSession()
session.Statement.RefTable = table
session.Statement.tableName = tbName
defer session.Close()
err = session.addColumn(col.Name)
}
@ -4115,11 +4117,13 @@ func (s *Session) Sync2(beans ...interface{}) error {
if index.Type == core.UniqueType {
session := engine.NewSession()
session.Statement.RefTable = table
session.Statement.tableName = tbName
defer session.Close()
err = session.addUnique(tbName, name)
} else if index.Type == core.IndexType {
session := engine.NewSession()
session.Statement.RefTable = table
session.Statement.tableName = tbName
defer session.Close()
err = session.addIndex(tbName, name)
}

View File

@ -17,7 +17,7 @@ import (
const (
// Version show the xorm's version
Version string = "0.5.5.0709"
Version string = "0.5.5.0711"
)
func regDrvsNDialects() bool {