@@ 414-425 (lines=12) @@ | ||
411 | * |
|
412 | * @return bool true if no errors, false if errors encountered |
|
413 | */ |
|
414 | public function dropColumn($table, $column) |
|
415 | { |
|
416 | // Find table def. |
|
417 | if (isset($this->tables[$table])) { |
|
418 | $tableDef = $this->tables[$table]; |
|
419 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP COLUMN `{$column}`"; |
|
420 | } else { |
|
421 | return $this->tableNotEstablished(); |
|
422 | } |
|
423 | ||
424 | return true; |
|
425 | } |
|
426 | ||
427 | /** |
|
428 | * Add drop index operation to the work queue |
|
@@ 435-445 (lines=11) @@ | ||
432 | * |
|
433 | * @return bool true if no errors, false if errors encountered |
|
434 | */ |
|
435 | public function dropIndex($name, $table) |
|
436 | { |
|
437 | if (isset($this->tables[$table])) { |
|
438 | $tableDef = $this->tables[$table]; |
|
439 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP INDEX `{$name}`"; |
|
440 | } else { |
|
441 | return $this->tableNotEstablished(); |
|
442 | } |
|
443 | ||
444 | return true; |
|
445 | } |
|
446 | ||
447 | /** |
|
448 | * Add drop for all (non-PRIMARY) keys for a table to the work |
|
@@ 490-500 (lines=11) @@ | ||
487 | * |
|
488 | * @return bool true if no errors, false if errors encountered |
|
489 | */ |
|
490 | public function dropPrimaryKey($table) |
|
491 | { |
|
492 | if (isset($this->tables[$table])) { |
|
493 | $tableDef = $this->tables[$table]; |
|
494 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP PRIMARY KEY "; |
|
495 | } else { |
|
496 | return $this->tableNotEstablished(); |
|
497 | } |
|
498 | ||
499 | return true; |
|
500 | } |
|
501 | ||
502 | /** |
|
503 | * Add drop of table to the work queue |
|
@@ 509-518 (lines=10) @@ | ||
506 | * |
|
507 | * @return bool true if no errors, false if errors encountered |
|
508 | */ |
|
509 | public function dropTable($table) |
|
510 | { |
|
511 | if (isset($this->tables[$table])) { |
|
512 | $tableDef = $this->tables[$table]; |
|
513 | $this->queue[] = "DROP TABLE `{$tableDef['name']}` "; |
|
514 | unset($this->tables[$table]); |
|
515 | } |
|
516 | // no table is not an error since we are dropping it anyway |
|
517 | return true; |
|
518 | } |
|
519 | ||
520 | ||
521 | /** |
|
@@ 715-725 (lines=11) @@ | ||
712 | * |
|
713 | * @return bool true if no errors, false if errors encountered |
|
714 | */ |
|
715 | public function truncate($table) |
|
716 | { |
|
717 | if (isset($this->tables[$table])) { |
|
718 | $tableDef = $this->tables[$table]; |
|
719 | $this->queue[] = "TRUNCATE TABLE `{$tableDef['name']}`"; |
|
720 | } else { |
|
721 | return $this->tableNotEstablished(); |
|
722 | } |
|
723 | ||
724 | return true; |
|
725 | } |
|
726 | ||
727 | ||
728 |