Add quote dialects

This commit is contained in:
Patrick O'brien 2016-09-10 03:14:18 +10:00
parent 817189fbfd
commit 9e6a3d5ee3
9 changed files with 109 additions and 9 deletions
strmangle

View file

@ -46,6 +46,18 @@ func SchemaTable(driver string, schema string, table string) string {
return fmt.Sprintf(`"%s"`, table)
}
// WrapQuote wraps a quote character in quotes.
func WrapQuote(s string) string {
if s == `"` {
return "`\"`"
}
if s == "`" {
return "\"`\""
}
return fmt.Sprintf("`%s`", s)
}
// IdentQuote attempts to quote simple identifiers in SQL tatements
func IdentQuote(s string) string {
if strings.ToLower(s) == "null" {