Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #74 from talwinder50/issue-73
Browse files Browse the repository at this point in the history
fix: mysql store: need to guard against special characters
  • Loading branch information
George Aristy authored Sep 29, 2020
2 parents 91f4104 + 6bb8ed4 commit 9c16791
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/storage/mysql/mysqlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (p *Provider) CreateStore(name string) (err error) {

// key has max varchar size it can accommodate as per mysql 8.0 spec
createTableStmt := fmt.Sprintf(
"Create TABLE IF NOT EXISTS %s.%s (`key` varchar(255) NOT NULL ,`value` BLOB, PRIMARY KEY (`key`))",
"Create TABLE IF NOT EXISTS `%s`.`%s` (`key` varchar(255) NOT NULL ,`value` BLOB, PRIMARY KEY (`key`))",
name, name)

// creating key-value table inside the database
Expand Down Expand Up @@ -187,7 +187,7 @@ func (p *Provider) OpenStore(name string) (s storage.Store, openErr error) {

store := &sqlDBStore{
db: newDBConn,
tableName: fmt.Sprintf("%s.%s", name, name),
tableName: fmt.Sprintf("`%s`.`%s`", name, name),
}

p.dbs[name] = store
Expand Down

0 comments on commit 9c16791

Please sign in to comment.