From 108d32dba8d839104b061e6ab433051fc2594498 Mon Sep 17 00:00:00 2001 From: Harley Laue Date: Wed, 7 May 2014 16:29:35 -0500 Subject: [PATCH] MySQL certainly does have schemas * I'd wager it was a copy/paste job from SQLite. * http://dev.mysql.com/doc/refman/5.1/en/create-database.html --- dialect.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dialect.go b/dialect.go index 419e5c9c..853bded9 100644 --- a/dialect.go +++ b/dialect.go @@ -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) }