Removes the table with the given name.
(self, table)
| 618 | return self.tables[table] |
| 619 | |
| 620 | def drop(self, table): |
| 621 | """ Removes the table with the given name. |
| 622 | """ |
| 623 | if isinstance(table, Table) and table.db == self: |
| 624 | table = table.name |
| 625 | if table in self.tables: |
| 626 | self.tables[table].database = None |
| 627 | self.tables.pop(table) |
| 628 | self.execute("drop table `%s`;" % table, commit=True) |
| 629 | # The SQLite version in Python 2.5 has a drop/recreate table bug. |
| 630 | # Reconnect. This means that any reference to Database.connection |
| 631 | # is no longer valid after Database.drop(). |
| 632 | if self.type == SQLITE and sys.version < "2.6": |
| 633 | self.disconnect() |
| 634 | self.connect() |
| 635 | |
| 636 | remove = drop |
| 637 |