Skip to content

Commit

Permalink
MySQL: sanitize identifiers (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyisaev2 authored Oct 3, 2024
1 parent 9bf8848 commit 839259a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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
4 changes: 2 additions & 2 deletions app/server/service_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ func (s *serviceConnector) ReadSplits(
if err := stream.Send(response); err != nil {
return fmt.Errorf("stream send: %w", err)
}
} else {
logger.Info("request handling finished")
}

logger.Info("request handling finished")

return nil
}

Expand Down

0 comments on commit 839259a

Please sign in to comment.