| @@ 27-41 (lines=15) @@ | ||
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| 27 | function dropDatabase() |
|
| 28 | { |
|
| 29 | $result = $this->db->query("SHOW TABLES FROM " . DB_NAME); |
|
| 30 | if (PEAR::isError($result)) { |
|
| 31 | throw new Exception($result->getUserInfo()); |
|
| 32 | } |
|
| 33 | ||
| 34 | while ($line = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) { |
|
| 35 | $drop = $this->db->exec('DROP TABLE ' . $line['tables_in_' . DB_NAME]); |
|
| 36 | if (PEAR::IsError($drop)) { |
|
| 37 | throw new Exception($drop->getUserInfo()); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | return true; |
|
| 41 | } |
|
| 42 | ||
| 43 | function createDatabaseSchema() |
|
| 44 | { |
|
| @@ 69-83 (lines=15) @@ | ||
| 66 | return true; |
|
| 67 | } |
|
| 68 | ||
| 69 | function emptyDatabase() |
|
| 70 | { |
|
| 71 | $result = $this->db->query("SHOW TABLES FROM " . DB_NAME); |
|
| 72 | if (PEAR::isError($result)) { |
|
| 73 | throw new Exception($result->getUserInfo()); |
|
| 74 | } |
|
| 75 | while ($line = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) { |
|
| 76 | $truncate = $this->db->exec('TRUNCATE TABLE ' . $line['Tables_in_'.DB_NAME]); |
|
| 77 | if (PEAR::IsError($truncate)) { |
|
| 78 | throw new Exception($truncate->getUserInfo()); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | return true; |
|
| 82 | ||
| 83 | } |
|
| 84 | ||
| 85 | function createStartingValues() |
|
| 86 | { |
|