fix insert map bug

This commit is contained in:
Lunny Xiao 2019-01-21 22:01:56 +08:00
parent 2a9394e401
commit 491559f34b
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import (
"github.com/go-xorm/core" "github.com/go-xorm/core"
) )
// TableNameWithSchema will automatically add schema prefix on table name // tbNameWithSchema will automatically add schema prefix on table name
func (engine *Engine) tbNameWithSchema(v string) string { func (engine *Engine) tbNameWithSchema(v string) string {
// Add schema name as prefix of table name. // Add schema name as prefix of table name.
// Only for postgres database. // Only for postgres database.

View File

@ -669,7 +669,7 @@ func (session *Session) insertMapInterface(m map[string]interface{}) (int64, err
qm := strings.Repeat("?,", len(columns)) qm := strings.Repeat("?,", len(columns))
qm = "(" + qm[:len(qm)-1] + ")" qm = "(" + qm[:len(qm)-1] + ")"
tableName := session.statement.TableName() tableName := session.engine.Quote(session.statement.TableName())
if len(tableName) <= 0 { if len(tableName) <= 0 {
return 0, ErrTableNotFound return 0, ErrTableNotFound
} }
@ -705,7 +705,7 @@ func (session *Session) insertMapString(m map[string]string) (int64, error) {
qm := strings.Repeat("?,", len(columns)) qm := strings.Repeat("?,", len(columns))
qm = "(" + qm[:len(qm)-1] + ")" qm = "(" + qm[:len(qm)-1] + ")"
tableName := session.statement.TableName() tableName := session.engine.Quote(session.statement.TableName())
if len(tableName) <= 0 { if len(tableName) <= 0 {
return 0, ErrTableNotFound return 0, ErrTableNotFound
} }