| @@ 2609-2634 (lines=26) @@ | ||
| 2606 | * @param $tablespace The new tablespace for the table ('' means leave as is) |
|
| 2607 | * @return bool|int 0 success |
|
| 2608 | */ |
|
| 2609 | public function alterTable($table, $name, $owner, $schema, $comment, $tablespace) |
|
| 2610 | { |
|
| 2611 | $data = $this->getTable($table); |
|
| 2612 | ||
| 2613 | if ($data->recordCount() != 1) { |
|
| 2614 | return -2; |
|
| 2615 | } |
|
| 2616 | ||
| 2617 | $status = $this->beginTransaction(); |
|
| 2618 | if ($status != 0) { |
|
| 2619 | $this->rollbackTransaction(); |
|
| 2620 | ||
| 2621 | return -1; |
|
| 2622 | } |
|
| 2623 | ||
| 2624 | $status = $this->_alterTable($data, $name, $owner, $schema, $comment, $tablespace); |
|
| 2625 | ||
| 2626 | if ($status != 0) { |
|
| 2627 | $this->rollbackTransaction(); |
|
| 2628 | ||
| 2629 | return $status; |
|
| 2630 | } |
|
| 2631 | ||
| 2632 | return $this->endTransaction(); |
|
| 2633 | } |
|
| 2634 | ||
| 2635 | /** |
|
| 2636 | * Protected method which alter a table |
|
| 2637 | * SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION |
|
| @@ 4181-4205 (lines=25) @@ | ||
| 4178 | * @param $comment The comment on the view |
|
| 4179 | * @return bool|int 0 success |
|
| 4180 | */ |
|
| 4181 | public function alterView($view, $name, $owner, $schema, $comment) |
|
| 4182 | { |
|
| 4183 | $data = $this->getView($view); |
|
| 4184 | if ($data->recordCount() != 1) { |
|
| 4185 | return -2; |
|
| 4186 | } |
|
| 4187 | ||
| 4188 | $status = $this->beginTransaction(); |
|
| 4189 | if ($status != 0) { |
|
| 4190 | $this->rollbackTransaction(); |
|
| 4191 | ||
| 4192 | return -1; |
|
| 4193 | } |
|
| 4194 | ||
| 4195 | $status = $this->_alterView($data, $name, $owner, $schema, $comment); |
|
| 4196 | ||
| 4197 | if ($status != 0) { |
|
| 4198 | $this->rollbackTransaction(); |
|
| 4199 | ||
| 4200 | return $status; |
|
| 4201 | } |
|
| 4202 | ||
| 4203 | return $this->endTransaction(); |
|
| 4204 | } |
|
| 4205 | ||
| 4206 | /** |
|
| 4207 | * Returns all details for a particular view |
|
| 4208 | * |
|