| @@ 2747-2762 (lines=16) @@ | ||
| 2744 | * |
|
| 2745 | * @internal param \PHPPgAdmin\Database\The $name new table's owner |
|
| 2746 | */ |
|
| 2747 | public function alterTableOwner($tblrs, $owner = null) |
|
| 2748 | { |
|
| 2749 | /* vars cleaned in _alterTable */ |
|
| 2750 | if (!empty($owner) && ($tblrs->fields['relowner'] != $owner)) { |
|
| 2751 | $f_schema = $this->_schema; |
|
| 2752 | $this->fieldClean($f_schema); |
|
| 2753 | // If owner has been changed, then do the alteration. We are |
|
| 2754 | // careful to avoid this generally as changing owner is a |
|
| 2755 | // superuser only function. |
|
| 2756 | $sql = "ALTER TABLE \"{$f_schema}\".\"{$tblrs->fields['relname']}\" OWNER TO \"{$owner}\""; |
|
| 2757 | ||
| 2758 | return $this->execute($sql); |
|
| 2759 | } |
|
| 2760 | ||
| 2761 | return 0; |
|
| 2762 | } |
|
| 2763 | ||
| 2764 | /** |
|
| 2765 | * Alter a table's tablespace |
|
| @@ 2775-2790 (lines=16) @@ | ||
| 2772 | * |
|
| 2773 | * @internal param \PHPPgAdmin\Database\The $name new table's tablespace |
|
| 2774 | */ |
|
| 2775 | public function alterTableTablespace($tblrs, $tablespace = null) |
|
| 2776 | { |
|
| 2777 | /* vars cleaned in _alterTable */ |
|
| 2778 | if (!empty($tablespace) && ($tblrs->fields['tablespace'] != $tablespace)) { |
|
| 2779 | $f_schema = $this->_schema; |
|
| 2780 | $this->fieldClean($f_schema); |
|
| 2781 | ||
| 2782 | // If tablespace has been changed, then do the alteration. We |
|
| 2783 | // don't want to do this unnecessarily. |
|
| 2784 | $sql = "ALTER TABLE \"{$f_schema}\".\"{$tblrs->fields['relname']}\" SET TABLESPACE \"{$tablespace}\""; |
|
| 2785 | ||
| 2786 | return $this->execute($sql); |
|
| 2787 | } |
|
| 2788 | ||
| 2789 | return 0; |
|
| 2790 | } |
|
| 2791 | ||
| 2792 | /** |
|
| 2793 | * Alter a table's name |
|
| @@ 2834-2848 (lines=15) @@ | ||
| 2831 | * |
|
| 2832 | * @internal param \PHPPgAdmin\Database\The $name new table's schema |
|
| 2833 | */ |
|
| 2834 | public function alterTableSchema($tblrs, $schema = null) |
|
| 2835 | { |
|
| 2836 | /* vars cleaned in _alterTable */ |
|
| 2837 | if (!empty($schema) && ($tblrs->fields['nspname'] != $schema)) { |
|
| 2838 | $f_schema = $this->_schema; |
|
| 2839 | $this->fieldClean($f_schema); |
|
| 2840 | // If tablespace has been changed, then do the alteration. We |
|
| 2841 | // don't want to do this unnecessarily. |
|
| 2842 | $sql = "ALTER TABLE \"{$f_schema}\".\"{$tblrs->fields['relname']}\" SET SCHEMA \"{$schema}\""; |
|
| 2843 | ||
| 2844 | return $this->execute($sql); |
|
| 2845 | } |
|
| 2846 | ||
| 2847 | return 0; |
|
| 2848 | } |
|
| 2849 | ||
| 2850 | /** |
|
| 2851 | * Empties a table in the database. |
|
| @@ 4001-4016 (lines=16) @@ | ||
| 3998 | * |
|
| 3999 | * @internal param \PHPPgAdmin\Database\The $name new owner for the sequence |
|
| 4000 | */ |
|
| 4001 | public function alterSequenceOwner($seqrs, $owner) |
|
| 4002 | { |
|
| 4003 | // If owner has been changed, then do the alteration. We are |
|
| 4004 | // careful to avoid this generally as changing owner is a |
|
| 4005 | // superuser only function. |
|
| 4006 | /* vars are cleaned in _alterSequence */ |
|
| 4007 | if (!empty($owner) && ($seqrs->fields['seqowner'] != $owner)) { |
|
| 4008 | $f_schema = $this->_schema; |
|
| 4009 | $this->fieldClean($f_schema); |
|
| 4010 | $sql = "ALTER SEQUENCE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" OWNER TO \"{$owner}\""; |
|
| 4011 | ||
| 4012 | return $this->execute($sql); |
|
| 4013 | } |
|
| 4014 | ||
| 4015 | return 0; |
|
| 4016 | } |
|
| 4017 | ||
| 4018 | /** |
|
| 4019 | * Alter a sequence's properties. |
|
| @@ 4120-4132 (lines=13) @@ | ||
| 4117 | * |
|
| 4118 | * @internal param \PHPPgAdmin\Database\The $name new schema for the sequence |
|
| 4119 | */ |
|
| 4120 | public function alterSequenceSchema($seqrs, $schema) |
|
| 4121 | { |
|
| 4122 | /* vars are cleaned in _alterSequence */ |
|
| 4123 | if (!empty($schema) && ($seqrs->fields['nspname'] != $schema)) { |
|
| 4124 | $f_schema = $this->_schema; |
|
| 4125 | $this->fieldClean($f_schema); |
|
| 4126 | $sql = "ALTER SEQUENCE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" SET SCHEMA {$schema}"; |
|
| 4127 | ||
| 4128 | return $this->execute($sql); |
|
| 4129 | } |
|
| 4130 | ||
| 4131 | return 0; |
|
| 4132 | } |
|
| 4133 | ||
| 4134 | /** |
|
| 4135 | * Drops a given sequence. |
|
| @@ 4376-4391 (lines=16) @@ | ||
| 4373 | * |
|
| 4374 | * @internal param \PHPPgAdmin\Database\The $name new view's owner |
|
| 4375 | */ |
|
| 4376 | public function alterViewOwner($vwrs, $owner = null) |
|
| 4377 | { |
|
| 4378 | /* $vwrs and $owner are cleaned in _alterView */ |
|
| 4379 | if ((!empty($owner)) && ($vwrs->fields['relowner'] != $owner)) { |
|
| 4380 | $f_schema = $this->_schema; |
|
| 4381 | $this->fieldClean($f_schema); |
|
| 4382 | // If owner has been changed, then do the alteration. We are |
|
| 4383 | // careful to avoid this generally as changing owner is a |
|
| 4384 | // superuser only function. |
|
| 4385 | $sql = "ALTER TABLE \"{$f_schema}\".\"{$vwrs->fields['relname']}\" OWNER TO \"{$owner}\""; |
|
| 4386 | ||
| 4387 | return $this->execute($sql); |
|
| 4388 | } |
|
| 4389 | ||
| 4390 | return 0; |
|
| 4391 | } |
|
| 4392 | ||
| 4393 | /** |
|
| 4394 | * Rename a view. |
|
| @@ 4430-4444 (lines=15) @@ | ||
| 4427 | * |
|
| 4428 | * @internal param \PHPPgAdmin\Database\The $name new view's schema |
|
| 4429 | */ |
|
| 4430 | public function alterViewSchema($vwrs, $schema) |
|
| 4431 | { |
|
| 4432 | /* $vwrs and $schema are cleaned in _alterView */ |
|
| 4433 | if (!empty($schema) && ($vwrs->fields['nspname'] != $schema)) { |
|
| 4434 | $f_schema = $this->_schema; |
|
| 4435 | $this->fieldClean($f_schema); |
|
| 4436 | // If tablespace has been changed, then do the alteration. We |
|
| 4437 | // don't want to do this unnecessarily. |
|
| 4438 | $sql = "ALTER TABLE \"{$f_schema}\".\"{$vwrs->fields['relname']}\" SET SCHEMA \"{$schema}\""; |
|
| 4439 | ||
| 4440 | return $this->execute($sql); |
|
| 4441 | } |
|
| 4442 | ||
| 4443 | return 0; |
|
| 4444 | } |
|
| 4445 | ||
| 4446 | /** |
|
| 4447 | * Drops a view. |
|
| @@ 349-364 (lines=16) @@ | ||
| 346 | * |
|
| 347 | * @internal param \PHPPgAdmin\Database\The $name new owner for the sequence |
|
| 348 | */ |
|
| 349 | public function alterSequenceOwner($seqrs, $owner) |
|
| 350 | { |
|
| 351 | // If owner has been changed, then do the alteration. We are |
|
| 352 | // careful to avoid this generally as changing owner is a |
|
| 353 | // superuser only function. |
|
| 354 | /* vars are cleaned in _alterSequence */ |
|
| 355 | if (!empty($owner) && ($seqrs->fields['seqowner'] != $owner)) { |
|
| 356 | $f_schema = $this->_schema; |
|
| 357 | $this->fieldClean($f_schema); |
|
| 358 | $sql = "ALTER TABLE \"{$f_schema}\".\"{$seqrs->fields['seqname']}\" OWNER TO \"{$owner}\""; |
|
| 359 | ||
| 360 | return $this->execute($sql); |
|
| 361 | } |
|
| 362 | ||
| 363 | return 0; |
|
| 364 | } |
|
| 365 | ||
| 366 | // Function functions |
|
| 367 | ||