CopyTableData implements sql.TableCopierDatabase interface.
(ctx *sql.Context, sourceTable string, destinationTable string)
| 449 | return views[0], true, nil |
| 450 | } |
| 451 | |
| 452 | // CreateView implements sql.ViewDatabase. |
| 453 | func (d *Database) CreateView(ctx *sql.Context, name string, selectStatement string, createViewStmt string) error { |
| 454 | d.mu.Lock() |
| 455 | defer d.mu.Unlock() |
| 456 | |
| 457 | statement := fmt.Sprintf(`USE %s; CREATE VIEW "%s" AS %s`, FullSchemaName(d.catalog, d.name), name, selectStatement) |
| 458 | sqlMode := sql.LoadSqlMode(ctx) |
| 459 | if sqlMode.AnsiQuotes() { |
| 460 | meta := ExtraViewInfo{ |
| 461 | TextDefinition: selectStatement, |
| 462 | CreateViewStatement: createViewStmt, |
| 463 | SqlMode: sqlMode.String(), |
| 464 | } |
| 465 | statement += fmt.Sprintf(`; COMMENT ON VIEW %s IS '%s'`, |
| 466 | FullTableName(d.catalog, d.name, name), NewCommentWithMeta("", meta).Encode()) |
| 467 | } |
| 468 | |
| 469 | _, err := adapter.Exec(ctx, statement) |
| 470 | if err != nil { |
| 471 | return ErrDuckDB.New(err) |
| 472 | } |
| 473 | return nil |
nothing calls this directly
no test coverage detected