[bug] Escape reserved words used as identifier.
This commit is contained in:
parent
63c1fd6430
commit
3019fdbbb2
10 changed files with 226 additions and 4 deletions
|
|
@ -98,7 +98,7 @@ func (s *SQLBuilder) WriteString(str string) {
|
|||
|
||||
// WriteIdentifier adds identifier to output SQL
|
||||
func (s *SQLBuilder) WriteIdentifier(name string, alwaysQuote ...bool) {
|
||||
if shouldQuoteIdentifier(name) || len(alwaysQuote) > 0 {
|
||||
if s.Dialect.IsReservedWord(name) || shouldQuoteIdentifier(name) || len(alwaysQuote) > 0 {
|
||||
identQuoteChar := string(s.Dialect.IdentifierQuoteChar())
|
||||
s.WriteString(identQuoteChar + name + identQuoteChar)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue