| @@ 647-670 (lines=24) @@ | ||
| 644 | * @param string $viewName Name of view to export |
|
| 645 | * @return null |
|
| 646 | */ |
|
| 647 | private function getViewStructureTable($viewName) |
|
| 648 | { |
|
| 649 | if (!$this->dumpSettings['skip-comments']) { |
|
| 650 | $ret = "--" . PHP_EOL . |
|
| 651 | "-- Stand-In structure for view `${viewName}`" . PHP_EOL . |
|
| 652 | "--" . PHP_EOL . PHP_EOL; |
|
| 653 | $this->compressManager->write($ret); |
|
| 654 | } |
|
| 655 | $stmt = $this->typeAdapter->show_create_view($viewName); |
|
| 656 | ||
| 657 | // create views as tables, to resolve dependencies |
|
| 658 | foreach ($this->dbHandler->query($stmt) as $r) { |
|
| 659 | if ($this->dumpSettings['add-drop-table']) { |
|
| 660 | $this->compressManager->write( |
|
| 661 | $this->typeAdapter->drop_view($viewName) |
|
| 662 | ); |
|
| 663 | } |
|
| 664 | ||
| 665 | $this->compressManager->write( |
|
| 666 | $this->createStandInTable($viewName) |
|
| 667 | ); |
|
| 668 | break; |
|
| 669 | } |
|
| 670 | } |
|
| 671 | ||
| 672 | /** |
|
| 673 | * Write a create table statement for the table Stand-In, show create |
|
| @@ 699-721 (lines=23) @@ | ||
| 696 | * @param string $viewName Name of view to export |
|
| 697 | * @return null |
|
| 698 | */ |
|
| 699 | private function getViewStructureView($viewName) |
|
| 700 | { |
|
| 701 | if (!$this->dumpSettings['skip-comments']) { |
|
| 702 | $ret = "--" . PHP_EOL . |
|
| 703 | "-- View structure for view `${viewName}`" . PHP_EOL . |
|
| 704 | "--" . PHP_EOL . PHP_EOL; |
|
| 705 | $this->compressManager->write($ret); |
|
| 706 | } |
|
| 707 | $stmt = $this->typeAdapter->show_create_view($viewName); |
|
| 708 | ||
| 709 | // create views, to resolve dependencies |
|
| 710 | // replacing tables with views |
|
| 711 | foreach ($this->dbHandler->query($stmt) as $r) { |
|
| 712 | // because we must replace table with view, we should delete it |
|
| 713 | $this->compressManager->write( |
|
| 714 | $this->typeAdapter->drop_view($viewName) |
|
| 715 | ); |
|
| 716 | $this->compressManager->write( |
|
| 717 | $this->typeAdapter->create_view($r) |
|
| 718 | ); |
|
| 719 | break; |
|
| 720 | } |
|
| 721 | } |
|
| 722 | ||
| 723 | /** |
|
| 724 | * Trigger structure extractor |
|