| @@ 1424-1440 (lines=17) @@ | ||
| 1421 | * |
|
| 1422 | * @see Alpha\Model\ActiveRecordProviderInterface::rebuildTable() |
|
| 1423 | */ |
|
| 1424 | public function rebuildTable() |
|
| 1425 | { |
|
| 1426 | self::$logger->debug('>>rebuildTable()'); |
|
| 1427 | ||
| 1428 | $sqlQuery = 'DROP TABLE IF EXISTS '.$this->BO->getTableName().';'; |
|
| 1429 | ||
| 1430 | $this->BO->setLastQuery($sqlQuery); |
|
| 1431 | ||
| 1432 | if (!$result = self::getConnection()->query($sqlQuery)) { |
|
| 1433 | throw new AlphaException('Failed to drop the table ['.$this->BO->getTableName().'] for the class ['.get_class($this->BO).'], database error is ['.self::getConnection()->error.']'); |
|
| 1434 | self::$logger->debug('<<rebuildTable'); |
|
| 1435 | } |
|
| 1436 | ||
| 1437 | $this->BO->makeTable(); |
|
| 1438 | ||
| 1439 | self::$logger->debug('<<rebuildTable'); |
|
| 1440 | } |
|
| 1441 | ||
| 1442 | /** |
|
| 1443 | * (non-PHPdoc). |
|
| @@ 1480-1497 (lines=18) @@ | ||
| 1477 | * |
|
| 1478 | * @see Alpha\Model\ActiveRecordProviderInterface::rebuildTable() |
|
| 1479 | */ |
|
| 1480 | public function rebuildTable() |
|
| 1481 | { |
|
| 1482 | self::$logger->debug('>>rebuildTable()'); |
|
| 1483 | ||
| 1484 | // the use of "IF EXISTS" here requires SQLite 3.3.0 or above. |
|
| 1485 | $sqlQuery = 'DROP TABLE IF EXISTS '.$this->BO->getTableName().';'; |
|
| 1486 | ||
| 1487 | $this->BO->setLastQuery($sqlQuery); |
|
| 1488 | ||
| 1489 | if (!$result = self::getConnection()->query($sqlQuery)) { |
|
| 1490 | throw new AlphaException('Failed to drop the table ['.$this->BO->getTableName().'] for the class ['.get_class($this->BO).'], database error is ['.self::getLastDatabaseError().']'); |
|
| 1491 | self::$logger->debug('<<rebuildTable'); |
|
| 1492 | } |
|
| 1493 | ||
| 1494 | $this->BO->makeTable(); |
|
| 1495 | ||
| 1496 | self::$logger->debug('<<rebuildTable'); |
|
| 1497 | } |
|
| 1498 | ||
| 1499 | /** |
|
| 1500 | * (non-PHPdoc). |
|