I would just write it as:

```scala
def quoteForMySQL(c: Connection, s: String): String = {
  val isMySQL = c.getMetaData.getDatabaseProductName contains "MySQL"
  if (isMySQL) s"`$s`" else s
}
```