MCPcopy Create free account
hub / github.com/apecloud/myduckserver / DecodeCreateindex

Function DecodeCreateindex

catalog/identifier.go:48–67  ·  view source on GitHub ↗
(createIndexSQL string)

Source from the content-addressed store, hash-verified

46}
47
48func DecodeCreateindex(createIndexSQL string) ([]string, error) {
49
50 denormalizedQuery := transpiler.DenormalizeStrings(createIndexSQL)
51 stmt, err := sqlparser.Parse(denormalizedQuery)
52
53 if err != nil {
54 return nil, err
55 }
56
57 switch stmt := stmt.(type) {
58 case *sqlparser.AlterTable:
59 var columnNames []string
60 for _, column := range stmt.Statements[0].IndexSpec.Columns {
61 columnNames = append(columnNames, column.Column.String())
62 }
63 return columnNames, nil
64 }
65
66 return nil, nil
67}
68
69func QuoteIdentifierANSI(identifier string) string {
70 return `"` + strings.ReplaceAll(identifier, `"`, `""`) + `"`

Callers 1

GetIndexesMethod · 0.85

Calls 2

DenormalizeStringsFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected