Skip to content

Commit

Permalink
MySQL certainly does have schemas
Browse files Browse the repository at this point in the history
* I'd wager it was a copy/paste job from SQLite.
* http://dev.mysql.com/doc/refman/5.1/en/create-database.html
  • Loading branch information
losinggeneration authored and James Cooper committed May 16, 2014
1 parent 86bc8f6 commit 108d32d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ func (d MySQLDialect) QuoteField(f string) string {
return "`" + f + "`"
}

// MySQL does not have schemas like PostgreSQL does, so just escape it like normal
func (d MySQLDialect) QuotedTableForQuery(schema string, table string) string {
return d.QuoteField(table)
if strings.TrimSpace(schema) == "" {
return d.QuoteField(table)
}

return schema + "." + d.QuoteField(table)
}

0 comments on commit 108d32d

Please sign in to comment.