remove one database
@param string $dbconfiguration Database configuration name
@return Renderer
@throws \Exception
499860
public function removeActivity(string $dbconfiguration):Renderer
    {
        $remove = false;
        $file = JL::open(FEnv::get("framework.config.db.file"));
        foreach ($file as $one => $value) {
            if ($one == $dbconfiguration) {
                unset($file->$one);
                $remove = true;
                break;
            }
        }

        if ($remove == false) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" =>
                "Database configuration does not exist")));
        }
        $file = json_encode((object) $file, JSON_PRETTY_PRINT);
        JL::put(FEnv::get("framework.config.db.file"), $file);


        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
1032982
public function deleteTable($tableName)
    {
        try {
            $this->db->deleteTable($tableName);
        } catch (\Exception $e) {
            throw new DbException($e->getMessage());
        }
    }
332313
public function build(): DeleteDatabaseRequest
	{
		$instance = new DeleteDatabaseRequest();
		if ($this->securityOrigin === null) {
			throw new BuilderException('Property [securityOrigin] is required.');
		}
		$instance->securityOrigin = $this->securityOrigin;
		if ($this->databaseName === null) {
			throw new BuilderException('Property [databaseName] is required.');
		}
		$instance->databaseName = $this->databaseName;
		return $instance;
	}
68730
public function dropDatabase($connectionName)
    {
        $configuration = $this->getConfiguration($connectionName);
        $database = $this->getConnection($connectionName);

        $database->DBDelete(
            $configuration->getDatabase()
        );
    }
719549
public static function drop_database($database, $db = null)
	{
		return \DB::query('DROP DATABASE '.\DB::quote_identifier($database, $db ? $db : static::$connection), \DB::DELETE)->execute($db ? $db : static::$connection);
	}
125247
public function drop_database($database) {
		$query = 'DROP DATABASE ' . $this->quote_identifier($database);
		$statement = $this->get_statement($query);

		$statement->execute();
	}
737658
public static function createDatabaseObject($dbConfig = null)
    {
        $dbConfig = self::getDatabaseConfig($dbConfig);

        $db = @Adapter::factory($dbConfig['adapter'], $dbConfig);

        self::$connection = $db;
    }
382090
public function compile($db = null)
	{
		if ( ! $db instanceof \Database_Connection)
		{
			// Get the database instance
			$db = \Database_Connection::instance($db);
		}

		// Start a deletion query
		$query = 'DELETE FROM '.$db->quote_table($this->_table);

		if ( ! empty($this->_where))
		{
			// Add deletion conditions
			$query .= ' WHERE '.$this->_compile_conditions($db, $this->_where);
		}

		if ( ! empty($this->_order_by))
		{
			// Add sorting
			$query .= ' '.$this->_compile_order_by($db, $this->_order_by);
		}

		if ($this->_limit !== NULL && substr($db->_db_type, 0, 6) !== 'sqlite')
		{
			// Add limiting
			$query .= ' LIMIT '.$this->_limit;
		}

		return $query;
	}
876034
public function doDelete(ConnectionInterface $con = null)
    {
        if (null === $con) {
            $con = Propel::getServiceContainer()->getWriteConnection($this->getDbName());
        }

        $adapter = Propel::getServiceContainer()->getAdapter($this->getDbName());
        $dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());

        // join are not supported with DELETE statement
        if (count($this->getJoins())) {
            throw new PropelException('Delete does not support join');
        }

        // Set up a list of required tables (one DELETE statement will
        // be executed per table)
        $tables = $this->getTablesColumns();
        if (empty($tables)) {
            throw new PropelException("Cannot delete from an empty Criteria");
        }

        $affectedRows = 0; // initialize this in case the next loop has no iterations.

        foreach ($tables as $tableName => $columns) {

            $whereClause = [];
            $params = [];
            $stmt = null;
            try {
                $sql = $adapter->getDeleteFromClause($this, $tableName);

                foreach ($columns as $colName) {
                    $sb = '';
                    $this->getCriterion($colName)->appendPsTo($sb, $params);
                    $this->replaceNames($sb);
                    $whereClause[] = $sb;
                }
                $sql .= ' WHERE ' .  implode(' AND ', $whereClause);

                $stmt = $con->prepare($sql);

                $adapter->bindValues($stmt, $params, $dbMap);
                $stmt->execute();
                $affectedRows = $stmt->rowCount();
            } catch (\Exception $e) {
                Propel::log($e->getMessage(), Propel::LOG_ERR);
                throw new PropelException(sprintf('Unable to execute DELETE statement [%s]', $sql), 0, $e);
            }

        } // for each table

        return $affectedRows;
    }
129194
public function delete()
    {
        $this->defaultTable();
        $this->eq($this->primary, $this->__get($this->primary));

        return DB::delete($this->sql);
    }
465753
protected function removeConnection($db_sock) {
        swoole_event_del($db_sock);
        $this->idle_pool[$db_sock]['object']->close();
        unset($this->idle_pool[$db_sock]);
        $this->connection_num--;
    }
268741
public function dropDatabase($databaseName, array $options = [])
    {
        $cursor = $this
            ->getCommandExecutor()
            ->executeCommand(
                $this->manager,
                $databaseName,
                ['dropDatabase' => 1],
                $options
            );

        return $cursor->current();
    }
675940
public static function getInstance(DBFactoryConfig $config)
    {

        if (self::$instances[$config->getHash()] === null) {

            self::$instances[$config->getHash()] = new DB(
                $config->getHost(),
                $config->getDatabase(),
                $config->getUsername(),
                $config->getPassword(),
                $config->getPort()
            );
        }
        return self::$instances[$config->getHash()];
    }
352043
public static function db(ConfigInterface $dbConfig)
    {
        $key = md5(json_encode($dbConfig->get()));
        if (!isset(self::$dbInstances[$key])) {
            self::$dbInstances[$key] = new DB($dbConfig);
        }

        return self::$dbInstances[$key];
    }
166907
public function setDatabase($dbname)
    {
        $this->config->setDatabase($dbname);
        if ($this->connection) {
            try {
                $this->query('USE ' . $this->quote()->identifier($dbname));
            } catch (RuntimeException $exception) {
                /** @var \PDOException $prevException */
                $prevException = $exception->getPrevious();
                if (UnknownDatabaseException::isUnknownDatabase($prevException)) {
                    throw UnknownDatabaseException::createFromUnknownDatabase($dbname, $prevException);
                }

                throw $exception;
            }
        }

        return $this;
    }
1253097
public function free(): bool
    {
        try {
            return $this->pdoStatement->closeCursor();
        } catch (PDOException $pdoe) {
            throw new DatabaseException($pdoe->getMessage(), $pdoe);
        }
    }
851426
public function destroy($id)
    {
        try {
            $sessionSQL = sprintf(
                'delete from `%s`.`%s` where `id` = ? and `site` = ? limit 1',
                $this->database,
                $this->table
            );

            $statement = $this->databaseResource->prepare($sessionSQL);

            if (empty($statement)) {
                throw new \Exception("Could not prepare session destroy statement.");
            }

            $statement->bind_param('ss', $id, $this->siteName);

            $statement->execute();

            $statement->close();

            return true;

        } catch (\Exception $exception) {
            // We can return false
        }

        return false;
    }