Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
add normalize param to database.Quote [nt]
Browse files Browse the repository at this point in the history
  • Loading branch information
flarco committed Nov 29, 2023
1 parent b2d77a3 commit d34d66b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ type Connection interface {
PropsArr() []string
Query(sql string, options ...map[string]interface{}) (iop.Dataset, error)
QueryContext(ctx context.Context, sql string, options ...map[string]interface{}) (iop.Dataset, error)
Quote(field string) string
Quote(field string, normalize ...bool) string
RenameTable(table string, newTable string) (err error)
Rollback() error
RunAnalysis(string, map[string]interface{}) (iop.Dataset, error)
Expand Down Expand Up @@ -2116,9 +2116,14 @@ func (conn *BaseConn) Unquote(field string) string {
}

// Quote adds quotes to the field name
func (conn *BaseConn) Quote(field string) string {
func (conn *BaseConn) Quote(field string, normalize ...bool) string {
Normalize := true
if len(normalize) > 0 {
Normalize = normalize[0]
}

// always normalize if case is uniform. Why would you quote and not normalize?
if !HasVariedCase(field) {
if !HasVariedCase(field) && Normalize {
if g.In(conn.Type, dbio.TypeDbOracle, dbio.TypeDbSnowflake) {
field = strings.ToUpper(field)
} else {
Expand Down

0 comments on commit d34d66b

Please sign in to comment.