def drop(host='localhost', user='', password='', database_name='', driver='', port=3306, engine=DEFAULT_ENGINE, **kwargs): """Drop (delete) the specified database.""" # Open up a connection try: connect = MySQLdb.connect(host=host, user=user, passwd=password, port=int(port), **kwargs) cursor = connect.cursor() try: cursor.execute("DROP DATABASE %s" % database_name) except _mysql_exceptions.OperationalError: raise weedb.NoDatabase( """Attempt to drop non-existent database %s""" % (database_name, )) finally: cursor.close() except _mysql_exceptions.OperationalError, e: raise weedb.OperationalError(e)
def drop(database_name='', SQLITE_ROOT='', driver='', **argv): file_path = get_filepath(SQLITE_ROOT, database_name, **argv) try: os.remove(file_path) except OSError: raise weedb.NoDatabase("""Attempt to drop non-existent database %s""" % (file_path, ))
def drop(database_name='', root='', driver='', **argv): file_path = os.path.join(root, database_name) try: os.remove(file_path) except OSError: raise weedb.NoDatabase("""Attempt to drop non-existent database %s""" % (file_path, ))