Stops a database.

@param string $database The name of the database to stop.
359040
public function stopDatabase($database)
    {
        assert($this->_platform instanceof SQLAnywherePlatform);
        $this->_execSql($this->_platform->getStopDatabaseSQL($database));
    }
763033
@InterfaceAudience.Public
    public void close() {
        synchronized (lockDatabases) {
            Log.d(Database.TAG, "Closing " + this);

            // Close all database:
            // Snapshot of the current open database to avoid concurrent modification as
            // the database will be forgotten (removed from the databases map) when it is closed:
            Database[] openDbs = databases.values().toArray(new Database[databases.size()]);
            for (Database database : openDbs)
                database.close();
            databases.clear();

            // Stop reachability:
            context.getNetworkReachabilityManager().stopListening();

            // Shutdown ScheduledExecutorService:
            if (workExecutor != null && !workExecutor.isShutdown())
                Utils.shutdownAndAwaitTermination(workExecutor);

            Log.d(Database.TAG, "Closed " + this);
        }
    }
591927
public void stop() {
		if (state.compareAndSet(RUNNING, STOPPING)){
			log.debug("Stopping...");
			if ( (StringUtils.isBlank(stopSqlCondition) || isInCondition(stopSqlCondition))
					&& (StringUtils.isBlank(stopSqlConditionResource) || isInConditionResource(stopSqlConditionResource))
					){
				if (StringUtils.isNotBlank(stopSQL)){
					executeSQL(stopSQL);
				} else if (StringUtils.isNotBlank(stopSqlResource)){
					executeSqlResource(stopSqlResource);
				}
			}
			state.set(UNKNOWN);
		}else{
			log.warn("Stop request ignored. Current state is: " + stateNames[state.get()]);
		}
	}
347504
public function stop($instance = 'current')
    {
        // Get (current or old) service info
        if ($serviceInfo = $this->getServiceInfo($instance)) {
            list($pid, $managerPid, $port) = array_values($serviceInfo);
            // Get serving connection numbers
            $connections = $this->sendCommand('connections', $port, $error);

            // Wait while all connections are served
            // @codeCoverageIgnoreStart
            while (!$error && $connections > 0) {
                usleep(5e5);
                $connections = $this->sendCommand('connections', $port, $error);
            }
            // @codeCoverageIgnoreEnd

            // Send TERM signal to master process to stop service
            posix_kill($pid, SIGTERM);

            // Kill master process in Mac OS
            // @codeCoverageIgnoreStart
            if (PHP_OS == 'Darwin') {
                sleep(1);
                posix_kill($pid, SIGKILL);
            }
            // @codeCoverageIgnoreEnd
        }
        $this->cliOutput('info', 'Service stopped.');
    }
407010
public void shutdown() {
        // If shutdown has already been called then we don't need to shutdown again
        if (acceptTasks.getAndSet(false)) {
            //pass straight to queue, tasks passed via submitTaskToQueue will now be blocked.
            Future<?> close = queue.submit(new Runnable() {
                @Override
                public void run() {
                    db.close();
                }
            });
            queue.shutdown();
            try {
                close.get();
                queue.awaitTermination(5, TimeUnit.MINUTES);
            } catch (InterruptedException e) {
                logger.log(Level.SEVERE, "Interrupted while waiting for queue to terminate", e);
            } catch (ExecutionException e) {
                logger.log(Level.SEVERE, "Failed to close database", e);
            }
        } else {
            logger.log(Level.WARNING, "Database is already closed.");
        }
    }
776325
public function deleteReserved($id)
    {
        $this->db->transaction(function () use ($id) {
            if ($this->db->name($this->table)->lock(true)->find($id)) {
                $this->db->name($this->table)->where('id', $id)->delete();
            }
        });
    }
154915
public function stop($signal = null)
    {
        if (null !== $signal) {
            $this->getLogger()->info('[SERVICE] Stop called, because of signal #'.$signal.'.');
        } else {
            $this->getLogger()->info('[SERVICE] Stop called');
        }
        $this->running = false;
    }
675433
public function select($database)
	{
		if (empty($database))
		{
			return false;
		}

		$this->connection->exec('USE ' . $this->quoteName($database));

		$this->database = $database;

		return true;
	}
303969
public static function drop_db($database = null)
	{
		if (empty($database))
		{
			throw new \Mongo_DbException('Failed to drop MongoDB database because name is empty');
		}

		else
		{
			try
			{
				static::instance()->connection->{$database}->drop();
				return true;
			}
			catch (\Exception $e)
			{
				throw new \Mongo_DbException("Unable to drop Mongo database `{$database}`: {$e->getMessage()}", $e->getCode());
			}

		}
	}
795525
public function stop($name = null)
    {
        $section = $this->end($name);
        $section->stop();
        $this->events->fire('f.sections.content', $this->last, $section->content());
    }
1092999
public function select($database)
	{
		$this->connect();

		$this->setQuery('USE ' . $this->quoteName($database));

		$this->execute();

		return $this;
	}
1283370
protected function stopSession()
	{
		if ( $this->_session === null ) {
			return;
		}

		$this->_session->stop();
		$this->_session = null;
	}
1040066
def _Close(self):
    """"""
    if self._database_object:
      self._database_object.Close()

    self._blob = None
    self._current_offset = 0
    self._size = 0
    self._table_name = None
480170
public function stop()
    {

        // load the queue keys
        $queues = get_object_vars($this->getQueues());

        // iterate over the queues and shut them down
        /** @var AppserverIo\Psr\Pms\QueueInterface $queue */
        foreach ($queues as $queue) {
            $queue->stop();
        }
    }
740452
public function select($database)
	{
		$this->connect();

		if (!$database)
		{
			return false;
		}

		if (!$this->connection->select_db($database))
		{
			throw new ConnectionFailureException('Could not connect to database.');
		}

		return true;
	}
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()
1000973
public function stop($key)
    {
        $benchmark = $this->get($key);

        $benchmark['stop_time'] = microtime(true);
        $benchmark['avg_time']  = $benchmark['stop_time'] - $benchmark['start_time'];
        $benchmark['stop_memory']   = memory_get_usage(true);
        $benchmark['avg_memory']    = ( ($benchmark['stop_memory'] - $benchmark['start_memory']) / 1024 ) / 1024;
        $benchmark['peak_memory']   = memory_get_peak_usage(true) / 1024 / 1024;
        $benchmark['running']       = false;

        $this->benchmarks[$key] = $benchmark;
    }