| @@ 1427-1443 (lines=17) @@ | ||
| 1424 | * |
|
| 1425 | * @see Alpha\Model\ActiveRecordProviderInterface::rebuildTable() |
|
| 1426 | */ |
|
| 1427 | public function rebuildTable() |
|
| 1428 | { |
|
| 1429 | self::$logger->debug('>>rebuildTable()'); |
|
| 1430 | ||
| 1431 | $sqlQuery = 'DROP TABLE IF EXISTS '.$this->BO->getTableName().';'; |
|
| 1432 | ||
| 1433 | $this->BO->setLastQuery($sqlQuery); |
|
| 1434 | ||
| 1435 | if (!$result = self::getConnection()->query($sqlQuery)) { |
|
| 1436 | throw new AlphaException('Failed to drop the table ['.$this->BO->getTableName().'] for the class ['.get_class($this->BO).'], database error is ['.self::getConnection()->error.']'); |
|
| 1437 | self::$logger->debug('<<rebuildTable'); |
|
| 1438 | } |
|
| 1439 | ||
| 1440 | $this->BO->makeTable(); |
|
| 1441 | ||
| 1442 | self::$logger->debug('<<rebuildTable'); |
|
| 1443 | } |
|
| 1444 | ||
| 1445 | /** |
|
| 1446 | * (non-PHPdoc). |
|
| @@ 1448-1465 (lines=18) @@ | ||
| 1445 | * |
|
| 1446 | * @see Alpha\Model\ActiveRecordProviderInterface::rebuildTable() |
|
| 1447 | */ |
|
| 1448 | public function rebuildTable() |
|
| 1449 | { |
|
| 1450 | self::$logger->debug('>>rebuildTable()'); |
|
| 1451 | ||
| 1452 | // the use of "IF EXISTS" here requires SQLite 3.3.0 or above. |
|
| 1453 | $sqlQuery = 'DROP TABLE IF EXISTS '.$this->BO->getTableName().';'; |
|
| 1454 | ||
| 1455 | $this->BO->setLastQuery($sqlQuery); |
|
| 1456 | ||
| 1457 | if (!$result = self::getConnection()->query($sqlQuery)) { |
|
| 1458 | self::$logger->debug('<<rebuildTable'); |
|
| 1459 | throw new AlphaException('Failed to drop the table ['.$this->BO->getTableName().'] for the class ['.get_class($this->BO).'], database error is ['.self::getLastDatabaseError().']'); |
|
| 1460 | } |
|
| 1461 | ||
| 1462 | $this->BO->makeTable(); |
|
| 1463 | ||
| 1464 | self::$logger->debug('<<rebuildTable'); |
|
| 1465 | } |
|
| 1466 | ||
| 1467 | /** |
|
| 1468 | * (non-PHPdoc). |
|