Drop all views from the database
12783
protected function dropViews()
    {
        $views = $this->db->query(
            'SHOW FULL TABLES WHERE TABLE_TYPE LIKE "VIEW"',
            DbAdapter::QUERY_MODE_EXECUTE
        );

        foreach ($views as $view) {
            $this->db->query(
                'DROP VIEW '.reset($view),
                DbAdapter::QUERY_MODE_EXECUTE
            );
        }
    }
635281
private void dropDatabase() throws IOException, ClientProtocolException, URISyntaxException
    {
        HttpResponse delRes = null;
        try
        {
            URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
                    CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase(), null, null);
            HttpDelete delete = new HttpDelete(uri);
            delRes = httpClient.execute(httpHost, delete, CouchDBUtils.getContext(httpHost));
        }
        finally
        {
            CouchDBUtils.closeContent(delRes);
        }
    }
112049
def clear_db():
    """"""
    cursor = '0'
    while cursor != 0:
        cursor, keys = DB.scan(cursor, match='*', count=5000)
        if keys:
            DB.delete(*keys)
485804
def dropdb():
    """"""
    manager.db.engine.echo = True
    if prompt_bool("Are you sure you want to lose all your data"):
        manager.db.drop_all()
        metadata, alembic_version = alembic_table_metadata()
        alembic_version.drop()
        manager.db.session.commit()
924368
public static function cleanupDatabase()
    {
        // Grab any extensions sitting in the database
        $rows = Symphony::Database()->fetch("SELECT `name` FROM `tbl_extensions`");

        // Iterate over each row
        if (is_array($rows) && !empty($rows)) {
            foreach ($rows as $r) {
                $name = $r['name'];
                $status = isset($r['status']) ? $r['status'] : null;

                // Grab the install location
                $path = self::__getClassPath($name);
                $existing_id = self::fetchExtensionID($name);

                // If it doesnt exist, remove the DB rows
                if (!@is_dir($path)) {
                    Symphony::Database()->delete("tbl_extensions_delegates", sprintf(" `extension_id` = %d ", $existing_id));
                    Symphony::Database()->delete('tbl_extensions', sprintf(" `id` = %d LIMIT 1", $existing_id));
                } elseif ($status == 'disabled') {
                    Symphony::Database()->delete("tbl_extensions_delegates", sprintf(" `extension_id` = %d ", $existing_id));
                }
            }
        }
    }
931782
def clear_database(engine: Connectable, schemas: Iterable[str] = ()) -> None:
    
    assert check_argument_types()
    metadatas = []
    all_schemas = (None,)  # type: Tuple[Optional[str], ...]
    all_schemas += tuple(schemas)
    for schema in all_schemas:
        # Reflect the schema to get the list of the tables, views and constraints
        metadata = MetaData()
        metadata.reflect(engine, schema=schema, views=True)
        metadatas.append(metadata)

    for metadata in metadatas:
        metadata.drop_all(engine, checkfirst=False)
598114
public function clearAllData()
    {
        $tables = $this->getSchemaManager()->tableList();
        foreach ($tables as $table) {
            $this->clearTable($table);
        }
    }
20727
def drop(self, force=False):
        
        self.client.drop_database(self.name, force=force)
426360
public function removeAll()
    {
        $pdo = $this->entityManager->getConnection()->getWrappedConnection();
        $pdo->beginTransaction();

        try {

            $pdo->exec('SET FOREIGN_KEY_CHECKS=0');
            $pdo->exec('TRUNCATE role_permission');
            $pdo->exec('TRUNCATE role_hierarchy');
            $pdo->exec('TRUNCATE role');
            $pdo->exec('TRUNCATE permission');
            $pdo->exec('TRUNCATE user_role');
            $pdo->exec('SET FOREIGN_KEY_CHECKS=1');

            $pdo->commit();

        } catch (\Exception $e) {
            $pdo->rollBack();
            throw new DatabaseException($e->getMessage());
        }
    }
531255
@InterfaceAudience.Public
    public void delete() {
        if (viewStore != null)
            viewStore.deleteView();
        if (database != null && name != null)
            database.forgetView(name);
        close();
    }
867570
private function dropRoutine(): void
  {
    if (isset($this->rdbmsOldRoutineMetadata))
    {
      MetaDataLayer::dropRoutine($this->rdbmsOldRoutineMetadata['routine_type'], $this->routineName);
    }
  }
39874
def purge(self):
        '''
        
        '''
        for table_name in self._db.list_tables():
            self._db.flush(table_name)

        self._run_init_queries()
830069
protected function dropDbTables()
    {
        // NOTE: This is optimized to avoid trying to delete tables over & over again.
        // If the app is network-wide and this is a network, there is only one set of tables.

        if ($this->App->Config->§specs['§is_network_wide'] && $this->Wp->is_multisite && $this->site_counter === 1) {
            $this->s::dropDbTables(); // Drop the network-wide tables for this app, just once.
            //
        } elseif (!$this->App->Config->§specs['§is_network_wide'] || !$this->Wp->is_multisite) {
            $this->s::dropDbTables(); // The table prefix changes for each site.
            // And, of course, this covers a standard WP installation also.
        }
    }
1098593
def unregister_view(self):
        
        for handler_id in self.handler_ids.keys():
            self.view[handler_id].disconnect(self.handler_ids[handler_id])
363975
def drop_db():
    "  "

    from ..ext import db

    if prompt_bool("Are you sure? You will lose all your data!"):
        db.drop_all()

        # Evolution support
        from flask import current_app
        from flaskext.evolution import db as evolution_db
        evolution_db.init_app(current_app)
        evolution_db.drop_all()

        print "Database clearing"
768410
def cleardb(force=False):
    """"""

    # Drop database, if it exists
    if db_exists():
        try:
            dropdb(force)
        except subprocess.CalledProcessError as error:
            output = error.output.decode("utf-8")
            if "is being accessed by other users" in output:
                raise ValueError(
                    "{}\n"
                    "To forcibly terminate other sessions, run "
                    "this command again with --force".format(output)
                )
            else:
                raise
    else:
        logger.info(
            "Database %s does not currently exist; no need to drop", repr(DB["NAME"])
        )
    createdb()
1185791
public function cleanup()
  {
    // Has to be done, otherwise sqlite-file is locked on Windows-OS
    $this->PDO = null;
    $this->PreparedInsertStatement = null;

    unlink($this->sqlite_db_file);
  }