Reconnect to the database.

@return void

@throws \LogicException
764710
public function reconnect()
    {
        if (is_callable($this->reconnector)) {
            $this->doctrineConnection = null;

            return call_user_func($this->reconnector, $this);
        }

        throw new LogicException('Lost connection and no reconnector available.');
    }
1032128
public function reconnect() {
        $this->disconnect();
        $this->connect();
        $stats = $this->stats();
        return $stats === false ? false : true;
    }
371302
protected function connect()
    {
        if ($this->databaseHandle !== null) {
            return;
        }
        try {
            $splitdsn = explode(':', $this->dataSourceName, 2);
            $this->pdoDriver = $splitdsn[0];

            if ($this->pdoDriver === 'sqlite' && !file_exists($splitdsn[1])) {
                if (!file_exists(dirname($splitdsn[1]))) {
                    Files::createDirectoryRecursively(dirname($splitdsn[1]));
                }
                $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password);
                $this->createCacheTables();
            } else {
                $this->databaseHandle = new \PDO($this->dataSourceName, $this->username, $this->password);
            }
            $this->databaseHandle->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

            if ($this->pdoDriver === 'mysql') {
                $this->databaseHandle->exec('SET SESSION sql_mode=\'ANSI\';');
            }
        } catch (\PDOException $exception) {
            throw new Exception('Could not connect to cache table with DSN "' . $this->dataSourceName . '". PDO error: ' . $exception->getMessage(), 1334736164);
        }
    }
100129
public function disconnect() {
    if ($this->connected) {
      if (is_a($this->link, 'SQLite3')) {
        $this->link->exec("PRAGMA optimize;");
        $this->link->close();
      }
      $this->connected = false;
    }
    return $this->connected;
  }
1102344
public function resetConnection(): void
    {
        if (! \is_null($this->defaultConnection)) {
            $this->resolver->connection($this->connection)->disconnect();

            $this->setConnection($this->defaultConnection);
        }
    }
706090
public function delete()
    {
        $this->brokenOnDelete = true;
        $this->onBeforeDelete();
        if ($this->brokenOnDelete) {
            user_error(static::class . " has a broken onBeforeDelete() function."
                . " Make sure that you call parent::onBeforeDelete().", E_USER_ERROR);
        }

        // Deleting a record without an ID shouldn't do anything
        if (!$this->ID) {
            throw new LogicException("DataObject::delete() called on a DataObject without an ID");
        }

        // TODO: This is quite ugly.  To improve:
        //  - move the details of the delete code in the DataQuery system
        //  - update the code to just delete the base table, and rely on cascading deletes in the DB to do the rest
        //    obviously, that means getting requireTable() to configure cascading deletes ;-)
        $srcQuery = DataList::create(static::class)
            ->filter('ID', $this->ID)
            ->dataQuery()
            ->query();
        $queriedTables = $srcQuery->queriedTables();
        $this->extend('updateDeleteTables', $queriedTables, $srcQuery);
        foreach ($queriedTables as $table) {
            $delete = SQLDelete::create("\"$table\"", array('"ID"' => $this->ID));
            $this->extend('updateDeleteTable', $delete, $table, $queriedTables, $srcQuery);
            $delete->execute();
        }
        // Remove this item out of any caches
        $this->flushCache();

        $this->onAfterDelete();

        $this->OldID = $this->ID;
        $this->ID = 0;
    }
1094483
def reconnect(self):
        """"""
        try:
            self.conn.close()
        except Exception,e:
            self.logger.warn(e)

        self.createConnection()

        return True
1201253
public function cleanup()
    {
        if (!$this->memory) {
            throw new \LogicException("Cleanup should be used after allocate.");
        }

        $this->memory->delete();
        $this->memory = null;
    }
818383
def _reconnect(self):
        """"""
        self._wrapped = self._client.read_rows(
            _copy_stream_position(self._position), **self._read_rows_kwargs
        )
54586
public function delete()
    {
        if( !$this->tableName ) {
            throw new LogicException('No table name specified');
        }
        return $this->database->delete()
                ->table($this->tableName);
    }
59906
public function query()
    {
        // Pre-execute callbacks
        if( !empty($this->preExecuteCallbacks) ) {
            foreach( $this->preExecuteCallbacks as $callable ) {
                call_user_func($callable, $this);
            }
        }
        // Execute
        if( $this->database ) {
            //$this->interpolateParams();
            $result = $this->database->query($this);
        } else if( $this->queryCallback ) {
            $query = $this->toString();
            $params = $this->params();
            if( $this->interpolation ) {
                $result = call_user_func($this->queryCallback, $query);
            } else {
                $result = call_user_func($this->queryCallback, $query, $params);
            }
        } else {
            throw new LogicException('query() called when no callback or database adapter set');
        }
        // Post-execute callbacks
        if( !empty($this->postExecuteCallbacks) ) {
            foreach( $this->postExecuteCallbacks as $callable ) {
                call_user_func($callable, $result, $this);
            }
        }
        return $result;
    }
944549
public function save()
    {
        if (!$this->path)
        {
            return;
        }
        while (count($this->actionQueue))
        {
            $action = array_shift($this->actionQueue);
            $methodName = 'action' . $action['action'];
            if (!method_exists($this, $methodName))
            {
                throw new LogicException('Unknown action: ' . $action['action']);
            }
            call_user_func_array(array($this, $methodName), $action['args']);
        }
        if ($this->phpThumb)
        {
            $this->phpThumb->save($this->path);
        }
    }
124731
public function terminate()
    {

        if( $this->isTerminated() ) {
            return true;
        }

        // remove from the instances array (ie, we no longer wish to maintain or keep this connection up)
        if( false === $key = array_search( $this, self::$instances, true ) ) {
            throw new \LogicException( "Trying to terminate a connection that isn't in instances store. This is a problem - talk to Pete." );
        }
        unset( self::$instances[$key] );

        // remove from its creating connection factory if it exists there
        if( $this->connectionFactory ) {
            $this->connectionFactory->remove($this);
        }

        try {
            $output = pg_close( $this->resource );
        } catch ( \Exception $e ) {
            $output = false;
        }

        // mark the resource a terminated
        $this->terminated = array(
            'time' => time(),
//            'backtrace' => sane_debug_backtrace(),
        );

        return $output;

    }
1251048
protected function _connect(){

		$this->_connection = @mysqli_connect(
			$this->_server, $this->_username, $this->_password);

		if(!@mysqli_select_db($this->_connection, $this->_database)){

			// Connection established, but unable to access the database

			if(!$this->_connection){

				throw new ConnectionException('Could not open the
					requested database');
			}
			else{

				throw new ConnectionException('Could not connect to the
					MySQL server');
			}
		}
	}
571784
protected static function bootCascadeSoftDeletes()
    {
        static::deleting(function ($model) {
            if (! $model->implementsSoftDeletes()) {
                throw new LogicException(sprintf(
                    '%s does not implement Illuminate\Database\Eloquent\SoftDeletes',
                    get_called_class()
                ));
            }

            if ($invalidCascadingRelationships = $model->hasInvalidCascadingRelationships()) {
                throw new LogicException(sprintf(
                    '%s [%s] must exist and return an object of type Illuminate\Database\Eloquent\Relations\Relation',
                    str_plural('Relationship', count($invalidCascadingRelationships)),
                    join(', ', $invalidCascadingRelationships)
                ));
            }

            $delete = $model->forceDeleting ? 'forceDelete' : 'delete';

            foreach ($model->getActiveCascadingDeletes() as $relationship) {
                if ($model->{$relationship} instanceof Model) {
                    $model->{$relationship}->{$delete}();
                } else {
                    foreach ($model->{$relationship} as $child) {
                        $child->{$delete}();
                    }
                }
            }
        });
    }
980696
protected function connect()
    {
        // Build a database connection if we don't have one connected

        $adapter = '\\Pixie\\ConnectionAdapters\\' . ucfirst(strtolower($this->adapter));

        $adapterInstance = $this->container->build($adapter, array($this->container));

        $pdo = $adapterInstance->connect($this->adapterConfig);
        $this->setPdoInstance($pdo);

        // Preserve the first database connection with a static property
        if (!static::$storedConnection) {
            static::$storedConnection = $this;
        }
    }
498346
public function connect() {
		try {
			$this->_connect ();
			return true;
		} catch ( \PDOException $e ) {
			throw new DBException ( $e->getMessage (), $e->getCode (), $e->getPrevious () );
		}
	}