MCPcopy
hub / github.com/github/gh-ost / EscapeName

Function EscapeName

go/sql/builder.go:29–34  ·  view source on GitHub ↗

EscapeName will escape a db/table/column/... name by wrapping with backticks. It is not fool proof. I'm just trying to do the right thing here, not solving SQL injection issues, which should be irrelevant for this tool.

(name string)

Source from the content-addressed store, hash-verified

27// It is not fool proof. I'm just trying to do the right thing here, not solving
28// SQL injection issues, which should be irrelevant for this tool.
29func EscapeName(name string) string {
30 if unquoted, err := strconv.Unquote(name); err == nil {
31 name = unquoted
32 }
33 return fmt.Sprintf("`%s`", name)
34}
35
36// TruncateColumnName truncates a name so it can be used as a MySQL
37// column name, taking into account UTF-8 characters.

Callers 15

GetTableColumnsFunction · 0.92
validateGrantsMethod · 0.92
validateTableMethod · 0.92
validateTableTriggersMethod · 0.92
CountTableRowsMethod · 0.92
showCreateTableMethod · 0.92
readChangelogStateMethod · 0.92
MigrateMethod · 0.92
RevertMethod · 0.92
cutOverTwoStepMethod · 0.92

Calls

no outgoing calls

Tested by 1

TestEscapeNameFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…