| @@ 693-716 (lines=24) @@ | ||
| 690 | * @param string $viewName Name of view to export |
|
| 691 | * @return null |
|
| 692 | */ |
|
| 693 | private function getViewStructureTable($viewName) |
|
| 694 | { |
|
| 695 | if (!$this->dumpSettings['skip-comments']) { |
|
| 696 | $ret = "--" . PHP_EOL . |
|
| 697 | "-- Stand-In structure for view `${viewName}`" . PHP_EOL . |
|
| 698 | "--" . PHP_EOL . PHP_EOL; |
|
| 699 | $this->compressManager->write($ret); |
|
| 700 | } |
|
| 701 | $stmt = $this->typeAdapter->show_create_view($viewName); |
|
| 702 | ||
| 703 | // create views as tables, to resolve dependencies |
|
| 704 | foreach ($this->dbHandler->query($stmt) as $r) { |
|
| 705 | if ($this->dumpSettings['add-drop-table']) { |
|
| 706 | $this->compressManager->write( |
|
| 707 | $this->typeAdapter->drop_view($viewName) |
|
| 708 | ); |
|
| 709 | } |
|
| 710 | ||
| 711 | $this->compressManager->write( |
|
| 712 | $this->createStandInTable($viewName) |
|
| 713 | ); |
|
| 714 | break; |
|
| 715 | } |
|
| 716 | } |
|
| 717 | ||
| 718 | /** |
|
| 719 | * Write a create table statement for the table Stand-In, show create |
|
| @@ 745-767 (lines=23) @@ | ||
| 742 | * @param string $viewName Name of view to export |
|
| 743 | * @return null |
|
| 744 | */ |
|
| 745 | private function getViewStructureView($viewName) |
|
| 746 | { |
|
| 747 | if (!$this->dumpSettings['skip-comments']) { |
|
| 748 | $ret = "--" . PHP_EOL . |
|
| 749 | "-- View structure for view `${viewName}`" . PHP_EOL . |
|
| 750 | "--" . PHP_EOL . PHP_EOL; |
|
| 751 | $this->compressManager->write($ret); |
|
| 752 | } |
|
| 753 | $stmt = $this->typeAdapter->show_create_view($viewName); |
|
| 754 | ||
| 755 | // create views, to resolve dependencies |
|
| 756 | // replacing tables with views |
|
| 757 | foreach ($this->dbHandler->query($stmt) as $r) { |
|
| 758 | // because we must replace table with view, we should delete it |
|
| 759 | $this->compressManager->write( |
|
| 760 | $this->typeAdapter->drop_view($viewName) |
|
| 761 | ); |
|
| 762 | $this->compressManager->write( |
|
| 763 | $this->typeAdapter->create_view($r) |
|
| 764 | ); |
|
| 765 | break; |
|
| 766 | } |
|
| 767 | } |
|
| 768 | ||
| 769 | /** |
|
| 770 | * Trigger structure extractor |
|