@param bool $isTransactional

@throws PDOConnectionException
175026
public function setIsTransactional(bool $isTransactional) : void
    {
        if ($this->isConnected()) {
            if (!$isTransactional && $this->isTransactional) {
                $this->connection->commit();
            } elseif ($isTransactional && !$this->isTransactional) {
                $this->beginTransaction();
            }
        }

        $this->isTransactional = $isTransactional;
    }
505096
protected function reconcileDatabaseConfiguration($isInteractive)
    {
        $db = $this->app['db'];
        $confirmMessage = 'Continue with these database settings?';
        $hasSqliteFile = $this->app['filesystem']->has('app://database/bolt.db');
        $platform = $this->app['config']->get('general/database/driver');
        $isSqlite = (bool) strpos($platform, 'sqlite');
        $ask = false;
        $note = [];

        if ($isSqlite && !$hasSqliteFile) {
            $this->isDbSetup = false;
            $note[] = 'Your database is configured as Sqlite, but does not exist yet.';
            $note[] = 'This might not be your intended configuration.';
            $ask = true;
        }
        if ($isSqlite && $hasSqliteFile) {
            $this->isDbSetup = true;
            if (empty($db->getSchemaManager()->listTableNames())) {
                $this->isDbSetup = false;
                $note[] = 'Your database is configured as Sqlite, but is empty.';
                $note[] = 'This might not be your intended database.';
                $ask = true;
            }
        }
        try {
            if (!$isSqlite) {
                $db->connect();
                $this->isDbSetup = true;
            }
        } catch (DatabaseConnectionException $e) {
            $this->isDbSetup = false;
            $note[] = 'Can not connect to your database as configured';
            $ask = true;
            if ($this->io->isVeryVerbose()) {
                throw $e;
            }
        }

        if ($ask && $isInteractive) {
            $this->step(++$this->step, 'Checking Database Configuration');
            $this->io->note($note);
            $confirm = $this->io->confirm($confirmMessage, false);
            if ($confirm === false) {
                $this->io->note([
                    'Further database checks will be skipped this time!',
                    'Please update the "database" section in your config.yml file',
                ]);
            }

            return $this->isDbSetup = $confirm;
        }

        return true;
    }
1246503
private function connect()
    {
        if (!$this->isConnected) {
            parent::__construct(
                $this->dsn,
                $this->server->getUsername(),
                $this->server->getPassword(),
                $this->driverOptions
            );
            parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            parent::setAttribute(
                PDO::ATTR_STATEMENT_CLASS,
                [__NAMESPACE__ . '\\' . self::PDO_STATEMENT_CLASS, [$this]]
            );

            $this->isConnected = true;
        }
    }
813362
public function execBound(\PDOStatement $stmt, array $values)
    {
        $ord = 1;
        foreach ($values as $val) {

            if (is_bool($val)) {

                $stmt->bindValue($ord, $val, \PDO::PARAM_BOOL);

            } elseif (is_resource($val)) {

                $stmt->bindValue($ord, $val, \PDO::PARAM_LOB);

            } elseif ((string)$val === ((string)(int)$val)) {

                $stmt->bindValue($ord, $val, \PDO::PARAM_INT);

            } else {

                $stmt->bindValue($ord, $val, \PDO::PARAM_STR);
            }
            $ord++;
        }

        return $stmt->execute();
    }
684792
protected function bindParams(PDOStatement &$stmt, array $values){
		$param_no = 1;

		foreach($values as $v){
			$t    = gettype($v);
			$type = PDO::PARAM_STR;

			if($t === 'boolean'){
				$type = PDO::PARAM_BOOL; // @codeCoverageIgnore
			}
			elseif($t === 'integer'){
				$type = PDO::PARAM_INT;
			}
			elseif($t === 'NULL'){
				$type = PDO::PARAM_NULL; // @codeCoverageIgnore
			}

			$stmt->bindValue($param_no, $v, $type);
			$param_no++;
		}
	}
1010545
private function openConnection($persistent=FALSE) {

		// continue only if not already connected
		if (is_a($this->handler, 'PDO')) {
			return;
		}
		
		switch (DBMS) {
			
			default:
			case 'mysql':
				$dsn = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME;
				$options = array(
					\PDO::ATTR_PERSISTENT			=> (bool)$persistent,
					\PDO::MYSQL_ATTR_INIT_COMMAND	=> "SET NAMES utf8",
					\PDO::MYSQL_ATTR_FOUND_ROWS		=> TRUE);
				break;

			case 'mssql':
				$dsn = 'dblib:host=' . DB_HOST . ';dbname=' . DB_NAME;
				$options = [];
				break;
		
		}
		
		try {
				
			$this->handler = new \PDO($dsn, DB_USER, DB_PASS, $options);
				
			if (is_a($this->handler, 'PDO')) {
				$this->handler->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
			} else {
				throw new \PDOException('Db handler is not valid, connection failed');
			}
			
		} catch (\Exception $e) {

			exit($e->getMessage());
			
		}
		
	}
883406
public function connect(): void
    {
        try {
            $this->tryConnect();
        } catch (\PDOException $firstException) {
            $this->pdo = null;

            // todo: implement backup connections
            throw new AdapterException($firstException->getMessage(), (int) $firstException->getCode(), $firstException);
        }
    }
164401
public function close(): void
    {
        if ($this->pdo instanceof PDO) {

            if ($this->stmt !== null) {
                $this->stmt->closeCursor();
            }

            $this->stmt = null;
            $this->pdo = null;

        } else if ($this->pdo === null) {
            // to nothing
        } else {
            throw new AdapterException('Unable to close database connection when PDO handler is not an instance of PDO');
        }
    }
264585
public static function setIsDebug(bool $bool): void
    {
        if (self::isCliApp()) {
            self::$IS_DEBUG = $bool;
        } else {
            MSession::set(MCoreApplication::DEBUG, $bool);
        }
    }
1247499
protected function setData($data, $datasource = '', $isActionBoundDatasource = false)
    {
        if(empty($datasource) && !empty($this->currentDatasource))
            $datasource = $this->currentDatasource;

        if(!is_array($data) && !empty($data))
            $data = array($data);

        if($isActionBoundDatasource) {
            self::$actionBoundDatasource = $datasource;

            // NOTE: referenceData always overrides data
            if(count($refData = (array)$this->referenceData()) > 0)
                $data = ArrayUtils::arrayMultiMergeKeys($data, $refData);
        }

        self::$data[$datasource] = $data;
    }
18370
private function getOriginalConnection(bool $isChannel = true): ConnectionInterface
    {
        if ($isChannel) {
            return $this->channel->pop();
        }

        return $this->queue->shift();
    }
1325300
void closeTransactionalBranch(Xid xid) {

        if (this.transactionBinding.getTransactionBindingType() != TransactionBindingType.GlobalTransaction) {
            throw new IllegalStateException("XAConnection not associated to a global transaction");
        }

        GlobalTransactionProxy<C> globalTransactionProxy = this.transactionBinding.getEnlistedGlobalTransaction();
        globalTransactionProxy.close();

        delistTransaction();
    }
1290910
@Override
    public boolean isTransacted()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(this, tc, "isTransacted");
            SibTr.exit(this, tc, "isTransacted", Boolean.valueOf(transacted));
        }
        return transacted;
    }
948537
public function connect($debug = false)
    {
        if (isset($this->options['dsn'])) {
            if ($this->options['verbose']) {
                echo "<p>Connecting to dsn:<br><code>" . $this->options['dsn'] . "</code>";
            }

            try {
                $this->db = new \PDO(
                    $this->options['dsn'],
                    $this->options['username'],
                    $this->options['password'],
                    $this->options['driver_options']
                );

                $this->db->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, $this->options['fetch_mode']);
                $this->db->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);

            } catch(\Exception $e) {

                if ($debug || $this->options['debug_connect']) {
                    // For debug purpose, shows all connection details
                    throw $e;
                } else {
                    // Hide connection details.
                    throw new \PDOException("Could not connect to database, hiding connection details. Connect using 'debug' to see the full exception message.");
                }
            }

        } else {
            throw new \Exception("You can not connect, missing dsn.");
        }

        $this->loadHistory();
    }
782821
public function doBind( PDOStatement $stmt )
    {
        foreach ( $this->boundValues as $key => $value )
        {
            try
            {
                $stmt->bindValue( $key, $value, $this->boundValuesType[$key] );
            }
            catch ( PDOException $e )
            {
                // see comment below
            }
        }
        foreach ( $this->boundParameters as $key => &$value )
        {
            try
            {
                $stmt->bindParam( $key, $value, $this->boundParametersType[$key] );
            }
            catch ( PDOException $e )
            {
                // we are ignoring this exception since it may only occur when
                // a bound parameter is not found in the query anymore.
                // this can happen if either drop an expression with a bound value
                // created with this query or if you remove a bind in a query by
                // replacing it with another one.
                // the only other way to avoid this problem is parse the string for the
                // bound variables. Note that a simple search will not do since the variable
                // name may occur in a string.
            }
        }
    }
84483
public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null)
    {
        $sourceNode = $this->createNode($sourceId, $sourceValue);
        $destNode = $this->createNode($destId, $destValue);
        $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference);

        $sourceNode->addOutEdge($edge);
        $destNode->addInEdge($edge);
    }
1055842
public function startTrans() {
        $this->connect();
        $this->transTimes++;
        if (1 == $this->transTimes) {
            $this->pdo->beginTransaction();
        }
    }