Skip to content

Commit

Permalink
MySQL: sanitize identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyisaev2 committed Oct 3, 2024
1 parent abb6b47 commit 77ce451
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/server/datasource/rdbms/mysql/sql_formatter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package mysql

import (
"fmt"
"strings"

"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"

api_service_protos "github.com/ydb-platform/fq-connector-go/api/service/protos"
Expand Down Expand Up @@ -72,7 +75,7 @@ func (sqlFormatter) GetPlaceholder(_ int) string {
}

func (sqlFormatter) SanitiseIdentifier(ident string) string {
return ident
return fmt.Sprintf("`%s`", strings.Replace(ident, "`", "``", -1))
}

func (f sqlFormatter) FormatFrom(tableName string) string {
Expand Down

0 comments on commit 77ce451

Please sign in to comment.