Fix build
This commit is contained in:
parent
ddb51cfe8e
commit
9a5cd536b8
|
@ -616,11 +616,6 @@ func (db *dameng) DropTableSQL(tableName string) (string, bool) {
|
|||
return fmt.Sprintf("DROP TABLE %s", db.quoter.Quote(tableName)), false
|
||||
}
|
||||
|
||||
// SeqName returns sequence name for some table
|
||||
func SeqName(tableName string) string {
|
||||
return "SEQ_" + strings.ToUpper(tableName)
|
||||
}
|
||||
|
||||
func (db *dameng) CreateTableSQL(ctx context.Context, queryer core.Queryer, table *schemas.Table, tableName string) ([]string, bool, error) {
|
||||
if tableName == "" {
|
||||
tableName = table.Name
|
||||
|
@ -653,7 +648,7 @@ func (db *dameng) CreateTableSQL(ctx context.Context, queryer core.Queryer, tabl
|
|||
}
|
||||
b.WriteString(")")
|
||||
|
||||
var seqName = SeqName(tableName)
|
||||
var seqName = utils.SeqName(tableName)
|
||||
if table.AutoIncrColumn() != nil {
|
||||
var cnt int
|
||||
rows, err := queryer.QueryContext(ctx, "SELECT COUNT(*) FROM user_sequences WHERE sequence_name = ?", seqName)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"xorm.io/builder"
|
||||
"xorm.io/xorm/dialects"
|
||||
"xorm.io/xorm/internal/utils"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
|
@ -129,7 +129,7 @@ func (statement *Statement) GenInsertSQL(colNames []string, args []interface{})
|
|||
return "", nil, err
|
||||
}
|
||||
}
|
||||
if _, err := buf.WriteString(dialects.SeqName(tableName) + ".nextval"); err != nil {
|
||||
if _, err := buf.WriteString(utils.SeqName(tableName) + ".nextval"); err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,15 @@ package utils
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// IndexName returns index name
|
||||
func IndexName(tableName, idxName string) string {
|
||||
return fmt.Sprintf("IDX_%v_%v", tableName, idxName)
|
||||
}
|
||||
|
||||
// SeqName returns sequence name for some table
|
||||
func SeqName(tableName string) string {
|
||||
return "SEQ_" + strings.ToUpper(tableName)
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ func (session *Session) insertMultipleStruct(rowsSlicePtr interface{}) (int64, e
|
|||
if i == 0 {
|
||||
colNames = append(colNames, col.Name)
|
||||
}
|
||||
colPlaces = append(colPlaces, dialects.SeqName(tableName)+".nextval")
|
||||
colPlaces = append(colPlaces, utils.SeqName(tableName)+".nextval")
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ func (session *Session) insertStruct(bean interface{}) (int64, error) {
|
|||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
sql = fmt.Sprintf("select %s.currval from dual", dialects.SeqName(tableName))
|
||||
sql = fmt.Sprintf("select %s.currval from dual", utils.SeqName(tableName))
|
||||
} else {
|
||||
sql = sqlStr
|
||||
newArgs = args
|
||||
|
|
Loading…
Reference in New Issue