fix insert map bug
This commit is contained in:
parent
2a9394e401
commit
491559f34b
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue