| @@ 676-699 (lines=24) @@ | ||
| 673 | * @param string $viewName Name of view to export |
|
| 674 | * @return null |
|
| 675 | */ |
|
| 676 | private function getViewStructureTable($viewName) |
|
| 677 | { |
|
| 678 | if (!$this->dumpSettings['skip-comments']) { |
|
| 679 | $ret = "--" . PHP_EOL . |
|
| 680 | "-- Stand-In structure for view `${viewName}`" . PHP_EOL . |
|
| 681 | "--" . PHP_EOL . PHP_EOL; |
|
| 682 | $this->compressManager->write($ret); |
|
| 683 | } |
|
| 684 | $stmt = $this->typeAdapter->show_create_view($viewName); |
|
| 685 | ||
| 686 | // create views as tables, to resolve dependencies |
|
| 687 | foreach ($this->dbHandler->query($stmt) as $r) { |
|
| 688 | if ($this->dumpSettings['add-drop-table']) { |
|
| 689 | $this->compressManager->write( |
|
| 690 | $this->typeAdapter->drop_view($viewName) |
|
| 691 | ); |
|
| 692 | } |
|
| 693 | ||
| 694 | $this->compressManager->write( |
|
| 695 | $this->createStandInTable($viewName) |
|
| 696 | ); |
|
| 697 | break; |
|
| 698 | } |
|
| 699 | } |
|
| 700 | ||
| 701 | /** |
|
| 702 | * Write a create table statement for the table Stand-In, show create |
|
| @@ 728-750 (lines=23) @@ | ||
| 725 | * @param string $viewName Name of view to export |
|
| 726 | * @return null |
|
| 727 | */ |
|
| 728 | private function getViewStructureView($viewName) |
|
| 729 | { |
|
| 730 | if (!$this->dumpSettings['skip-comments']) { |
|
| 731 | $ret = "--" . PHP_EOL . |
|
| 732 | "-- View structure for view `${viewName}`" . PHP_EOL . |
|
| 733 | "--" . PHP_EOL . PHP_EOL; |
|
| 734 | $this->compressManager->write($ret); |
|
| 735 | } |
|
| 736 | $stmt = $this->typeAdapter->show_create_view($viewName); |
|
| 737 | ||
| 738 | // create views, to resolve dependencies |
|
| 739 | // replacing tables with views |
|
| 740 | foreach ($this->dbHandler->query($stmt) as $r) { |
|
| 741 | // because we must replace table with view, we should delete it |
|
| 742 | $this->compressManager->write( |
|
| 743 | $this->typeAdapter->drop_view($viewName) |
|
| 744 | ); |
|
| 745 | $this->compressManager->write( |
|
| 746 | $this->typeAdapter->create_view($r) |
|
| 747 | ); |
|
| 748 | break; |
|
| 749 | } |
|
| 750 | } |
|
| 751 | ||
| 752 | /** |
|
| 753 | * Trigger structure extractor |
|