This commit is contained in:
Lunny Xiao 2023-12-14 19:47:16 +08:00
parent 12c587faae
commit a7a562c483
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"strings" "strings"
"xorm.io/builder" "xorm.io/builder"
"xorm.io/xorm/schemas"
) )
type ErrInvalidIndexHintOperator struct { type ErrInvalidIndexHintOperator struct {
@ -28,8 +29,12 @@ func (statement *Statement) IndexHint(op, indexName string) error {
} }
func (statement *Statement) writeIndexHints(w *builder.BytesWriter) error { func (statement *Statement) writeIndexHints(w *builder.BytesWriter) error {
if len(statement.indexHints) == 0 {
return nil
}
switch statement.dialect.URI().DBType { switch statement.dialect.URI().DBType {
case "mysql": case schemas.MYSQL:
return statement.writeIndexHintsMySQL(w) return statement.writeIndexHintsMySQL(w)
default: default:
return ErrNotImplemented return ErrNotImplemented