Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type (
// DropKey is used to drop a key in an alter table statement
DropKey struct {
Type DropKeyType
Name string
Name ColIdent
}

// Force is used to specify force alter option in an alter table statement
Expand All @@ -182,8 +182,8 @@ type (

// RenameIndex clause is used to rename indexes in an alter table statement
RenameIndex struct {
OldName string
NewName string
OldName ColIdent
NewName ColIdent
}

// Validation clause is used to specify whether to use validation or not
Expand Down Expand Up @@ -338,7 +338,7 @@ type (
// DropDatabase represents a DROP database statement.
DropDatabase struct {
Comments Comments
DBName string
DBName TableIdent
IfExists bool
}

Expand All @@ -355,15 +355,15 @@ type (
// CreateDatabase represents a CREATE database statement.
CreateDatabase struct {
Comments Comments
DBName string
DBName TableIdent
IfNotExists bool
CreateOptions []CollateAndCharset
FullyParsed bool
}

// AlterDatabase represents a ALTER database statement.
AlterDatabase struct {
DBName string
DBName TableIdent
UpdateDataDirectory bool
AlterOptions []CollateAndCharset
FullyParsed bool
Expand Down Expand Up @@ -1224,17 +1224,17 @@ func (node *AlterDatabase) IsFullyParsed() bool {

// GetDatabaseName implements the DBDDLStatement interface
func (node *DropDatabase) GetDatabaseName() string {
return node.DBName
return node.DBName.String()
}

// GetDatabaseName implements the DBDDLStatement interface
func (node *CreateDatabase) GetDatabaseName() string {
return node.DBName
return node.DBName.String()
}

// GetDatabaseName implements the DBDDLStatement interface
func (node *AlterDatabase) GetDatabaseName() string {
return node.DBName
return node.DBName.String()
}

// ParenSelect can actually not be a top level statement,
Expand Down Expand Up @@ -1269,7 +1269,7 @@ type (
Command ShowCommandType
Full bool
Tbl TableName
DbName string
DbName TableIdent
Filter *ShowFilter
}

Expand Down Expand Up @@ -1413,7 +1413,7 @@ type VindexParam struct {

// ConstraintDefinition describes a constraint in a CREATE TABLE statement
type ConstraintDefinition struct {
Name string
Name ColIdent
Details ConstraintInfo
}

Expand Down
8 changes: 8 additions & 0 deletions go/vt/sqlparser/ast_clone.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions go/vt/sqlparser/ast_equals.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (node *DropDatabase) Format(buf *TrackedBuffer) {
if node.IfExists {
exists = "if exists "
}
buf.astPrintf(node, "%s database %v%s%s", DropStr, node.Comments, exists, node.DBName)
buf.astPrintf(node, "%s database %v%s%v", DropStr, node.Comments, exists, node.DBName)
}

// Format formats the node.
Expand Down Expand Up @@ -565,8 +565,8 @@ func (node VindexParam) Format(buf *TrackedBuffer) {

// Format formats the node.
func (c *ConstraintDefinition) Format(buf *TrackedBuffer) {
if c.Name != "" {
buf.astPrintf(c, "constraint %s ", c.Name)
if !c.Name.IsEmpty() {
buf.astPrintf(c, "constraint %v ", c.Name)
}
c.Details.Format(buf)
}
Expand Down Expand Up @@ -1307,8 +1307,8 @@ func (node *ShowBasic) Format(buf *TrackedBuffer) {
if !node.Tbl.IsEmpty() {
buf.astPrintf(node, " from %v", node.Tbl)
}
if node.DbName != "" {
buf.astPrintf(node, " from %s", node.DbName)
if !node.DbName.IsEmpty() {
buf.astPrintf(node, " from %v", node.DbName)
}
buf.astPrintf(node, "%v", node.Filter)
}
Expand Down Expand Up @@ -1336,7 +1336,7 @@ func (node *CreateDatabase) Format(buf *TrackedBuffer) {
if node.IfNotExists {
buf.WriteString("if not exists ")
}
buf.astPrintf(node, "%s", node.DBName)
buf.astPrintf(node, "%v", node.DBName)
if node.CreateOptions != nil {
for _, createOption := range node.CreateOptions {
if createOption.IsDefault {
Expand All @@ -1351,8 +1351,8 @@ func (node *CreateDatabase) Format(buf *TrackedBuffer) {
// Format formats the node.
func (node *AlterDatabase) Format(buf *TrackedBuffer) {
buf.WriteString("alter database")
if node.DBName != "" {
buf.astPrintf(node, " %s", node.DBName)
if !node.DBName.IsEmpty() {
buf.astPrintf(node, " %v", node.DBName)
}
if node.UpdateDataDirectory {
buf.WriteString(" upgrade data directory name")
Expand Down Expand Up @@ -1588,8 +1588,8 @@ func (node *DropColumn) Format(buf *TrackedBuffer) {
// Format formats the node
func (node *DropKey) Format(buf *TrackedBuffer) {
buf.astPrintf(node, "drop %s", node.Type.ToString())
if node.Name != "" {
buf.astPrintf(node, " %s", node.Name)
if !node.Name.IsEmpty() {
buf.astPrintf(node, " %v", node.Name)
}
}

Expand Down Expand Up @@ -1620,7 +1620,7 @@ func (node *RenameTableName) Format(buf *TrackedBuffer) {

// Format formats the node
func (node *RenameIndex) Format(buf *TrackedBuffer) {
buf.astPrintf(node, "rename index %s to %s", node.OldName, node.NewName)
buf.astPrintf(node, "rename index %v to %v", node.OldName, node.NewName)
}

// Format formats the node
Expand Down
24 changes: 12 additions & 12 deletions go/vt/sqlparser/ast_format_fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading