Skip to content

Commit 4bb6875

Browse files
committed
support ROW_FORMAT value to string
1 parent 877bed6 commit 4bb6875

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

sqlparser/ast.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,34 @@ const (
543543
TableOptionPackKeys
544544
)
545545

546+
// RowFormatType is the type for RowFormat
547+
type RowFormatType uint64
548+
549+
// RowFormat types
550+
const (
551+
RowFormatDefault RowFormatType = iota + 1
552+
RowFormatDynamic
553+
RowFormatFixed
554+
RowFormatCompressed
555+
RowFormatRedundant
556+
RowFormatCompact
557+
)
558+
559+
func (r RowFormatType) String() string {
560+
switch r {
561+
case RowFormatDynamic:
562+
return "DYNAMIC"
563+
case RowFormatCompressed:
564+
return "COMPRESSED"
565+
case RowFormatRedundant:
566+
return "REDUNDANT"
567+
case RowFormatCompact:
568+
return "COMPACT"
569+
default:
570+
}
571+
return ""
572+
}
573+
546574
func (t TableOptionType) String() string {
547575
switch t {
548576
case TableOptionEngine:
@@ -585,6 +613,9 @@ func (t TableOptionType) String() string {
585613
}
586614

587615
func (o *TableOption) String() string {
616+
if o.Type == TableOptionRowFormat {
617+
return fmt.Sprintf("%s=%s", o.Type, RowFormatType(o.UintValue))
618+
}
588619
if o.StrValue != "" {
589620
return fmt.Sprintf("%s=%s", o.Type, o.StrValue)
590621
}

0 commit comments

Comments
 (0)