Fix bug
This commit is contained in:
parent
30667e9d38
commit
3aca84268c
|
@ -89,7 +89,7 @@ func (statement *Statement) GenInsertSQL(colNames []string, args []interface{})
|
|||
}
|
||||
|
||||
if statement.Conds().IsValid() {
|
||||
if err := statement.writeString(" SELECT ")(buf); err != nil {
|
||||
if err := statement.writeStrings(" SELECT ")(buf); err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ func (statement *Statement) isUsingLegacyLimitOffset() bool {
|
|||
// write mssql legacy query sql
|
||||
func (statement *Statement) writeMssqlLegacySelect(buf *builder.BytesWriter, columnStr string) error {
|
||||
return statement.writeMultiple(buf,
|
||||
statement.writeString("SELECT"),
|
||||
statement.writeStrings("SELECT"),
|
||||
statement.writeDistinct,
|
||||
statement.writeTop,
|
||||
statement.writeFrom,
|
||||
|
|
|
@ -249,9 +249,9 @@ func (statement *Statement) writeDistinct(w *builder.BytesWriter) error {
|
|||
|
||||
func (statement *Statement) writeSelectColumns(columnStr string) func(w *builder.BytesWriter) error {
|
||||
return statement.groupWriteFns(
|
||||
statement.writeString("SELECT"),
|
||||
statement.writeStrings("SELECT"),
|
||||
statement.writeDistinct,
|
||||
statement.writeString(columnStr),
|
||||
statement.writeStrings(" ", columnStr),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,19 +10,17 @@ import (
|
|||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
func (statement *Statement) writeString(str string) func(w *builder.BytesWriter) error {
|
||||
func (statement *Statement) writeStrings(strs ...string) func(w *builder.BytesWriter) error {
|
||||
return func(w *builder.BytesWriter) error {
|
||||
if _, err := fmt.Fprint(w, str); err != nil {
|
||||
return err
|
||||
for _, str := range strs {
|
||||
if _, err := fmt.Fprint(w, str); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (statement *Statement) writeSpace(w *builder.BytesWriter) error {
|
||||
return statement.writeString(" ")(w)
|
||||
}
|
||||
|
||||
func (statement *Statement) groupWriteFns(writeFuncs ...func(*builder.BytesWriter) error) func(*builder.BytesWriter) error {
|
||||
return func(bw *builder.BytesWriter) error {
|
||||
return statement.writeMultiple(bw, writeFuncs...)
|
||||
|
|
Loading…
Reference in New Issue