parsePartitionOf handles CREATE TABLE ... PARTITION OF statements
(mode GeneratorMode, stmt *parser.DDL, defaultSchema string, rawDDL string)
| 347 | |
| 348 | // parsePartitionOf handles CREATE TABLE ... PARTITION OF statements |
| 349 | func parsePartitionOf(mode GeneratorMode, stmt *parser.DDL, defaultSchema string, rawDDL string) (*CreatePartitionOf, error) { |
| 350 | tableName := normalizeQualifiedName(mode, stmt.NewName, defaultSchema) |
| 351 | parentTable := normalizeQualifiedName(mode, stmt.PartitionOf.ParentTable, defaultSchema) |
| 352 | |
| 353 | bound := PartitionBound{} |
| 354 | if stmt.PartitionOf.BoundSpec != nil { |
| 355 | if stmt.PartitionOf.BoundSpec.IsDefault { |
| 356 | bound.IsDefault = true |
| 357 | } else if stmt.PartitionOf.BoundSpec.In != nil { |
| 358 | bound.In = stmt.PartitionOf.BoundSpec.In |
| 359 | } else if stmt.PartitionOf.BoundSpec.From != nil { |
| 360 | bound.From = stmt.PartitionOf.BoundSpec.From |
| 361 | bound.To = stmt.PartitionOf.BoundSpec.To |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | return &CreatePartitionOf{ |
| 366 | statement: rawDDL, |
| 367 | tableName: tableName, |
| 368 | parentTable: parentTable, |
| 369 | boundSpec: bound, |
| 370 | }, nil |
| 371 | } |
| 372 | |
| 373 | func parseTable(mode GeneratorMode, stmt *parser.DDL, defaultSchema string, rawDDL string) (Table, error) { |
| 374 | var columns = map[string]*Column{} |
no test coverage detected