Função responsável por fazer a conexão com o banco.
@throws PhiberException
975348
public function getConnection()
    {
        try {
            if ($this->instancia == null) {

                $json = new JsonReader(BASE_DIR . self::PATH_CONFIG_FILE);

                if (!empty(glob(dirname(__DIR__, 4) . self::PATH_CONFIG_FILE )[0])) {
                    $json = new JsonReader(glob(dirname(__DIR__, 4) . PATH_CONFIG_FILE)[0]);
                }

                $json= $json->read();
                try {

                    $connectionCache = $json->phiber->link->connection_cache == 1 ? true : false;

                    $this->instancia = new PDO(
                        $json->phiber->link->url,
                        $json->phiber->link->user,
                        $json->phiber->link->password,
                        array(
                            PDO::ATTR_PERSISTENT => $connectionCache
                        )
                    );
                } catch (PhiberException $e) {
                    throw new PhiberException(new Internationalization("database_connection_error"));
                }
            }

            return $this->instancia;

        } catch (PhiberException $e) {
            throw new PhiberException(new Internationalization("database_connection_error"));
        }
    }
1312089
protected function _commit()
    {
        if (!db2_commit($this->_connection)) {
            /**
             * @see Zend_Db_Adapter_Db2_Exception
             */
            // require_once 'Zend/Db/Adapter/Db2/Exception.php';
            throw new Zend_Db_Adapter_Db2_Exception(
                db2_conn_errormsg($this->_connection),
                db2_conn_error($this->_connection));
        }

        $this->_setExecuteMode(DB2_AUTOCOMMIT_ON);
    }
999324
public function callbackAction()
    {
        try {
            $response = $this->getPaymentHandler()->getPaymentCallbackResponse($this->getCurrentRequest());
        } catch (EntityNotFoundException $ex) {
            throw new NotFoundHttpException($ex->getMessage());
        } catch (InvalidTransactionException $ex) {
            throw new UnauthorizedHttpException($ex->getMessage());
        }

        return $response;
    }
1067619
public function commit()
    {
        $this->assertIsSupported($this->supportsTransactions, __METHOD__);
        $this->wrapped->getConnection()->commit();
    }
595900
public function beginTransaction()
    {
        if ( $this->link == null ) {
            $this->connect();
        }
        ++$this->transactions;

        if ( $this->transactions == 1 ) {
            $this->link->beginTransaction();
        }


    }
8169
private function AssertSuccess()
    {
        if ($this->db)
        {
            if ($this->IsConnected())
            {
                $errorCode = $this->db->errno;
                if ($errorCode != 0)
                {
                    if ($this->inTransaction)
                        $this->RollBack();

                    throw new DBExceptions\DatabaseException($this->db->error, $errorCode, $this->lastQuery);
                }
            }
            else
            {
                $errorCode = $this->db->connect_errno;
                if ($errorCode != 0)
                {
                    throw new DBExceptions\DatabaseException($this->db->connect_error, $errorCode);
                }
            }
        }
    }
307064
private void addConnection() throws SQLException {

    //create new connection
    Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo);
    MariaDbConnection connection = new MariaDbConnection(protocol);
    MariaDbPooledConnection pooledConnection = createPoolConnection(connection);

    if (options.staticGlobal) {
      //on first connection load initial state
      if (globalInfo == null) {
        initializePoolGlobalState(connection);
      }
      //set default transaction isolation level to permit resetting to initial state
      connection.setDefaultTransactionIsolation(globalInfo.getDefaultTransactionIsolation());
    } else {
      //set default transaction isolation level to permit resetting to initial state
      connection.setDefaultTransactionIsolation(connection.getTransactionIsolation());
    }

    if (poolState.get() == POOL_STATE_OK
        && totalConnection.incrementAndGet() <= options.maxPoolSize) {
      idleConnections.addFirst(pooledConnection);

      if (logger.isDebugEnabled()) {
        logger.debug("pool {} new physical connection created (total:{}, active:{}, pending:{})",
            poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
      }
      return;
    }

    silentCloseConnection(pooledConnection);
  }
817730
public function gerar()
    {
        if (!$this->isValid($messages)) {
            throw new \Exception('Campos requeridos pelo banco, aparentam estar ausentes ' . $messages);
        }

        $stringRemessa = '';
        if ($this->iRegistros < 1) {
            throw new \Exception('Nenhuma linha detalhe foi adicionada');
        }

        $this->header();
        $stringRemessa .= $this->valida($this->getHeader()) . $this->fimLinha;

        $this->headerLote();
        $stringRemessa .= $this->valida($this->getHeaderLote()) . $this->fimLinha;

        foreach ($this->getDetalhes() as $i => $detalhe) {
            $stringRemessa .= $this->valida($detalhe) . $this->fimLinha;
        }

        $this->trailerLote();
        $stringRemessa .= $this->valida($this->getTrailerLote()) . $this->fimLinha;

        $this->trailer();
        $stringRemessa .= $this->valida($this->getTrailer()) . $this->fimArquivo;

        return Encoding::toUTF8($stringRemessa);
    }
838257
public function commit() {
		if ($this->_transactionDepth === 0) {
			throw new PDOException('Rollback error : There is no transaction started');
		}

		$this->_transactionDepth--;

		if ($this->_transactionDepth === 0) {
			parent::commit();
		} else {
			$this->exec("RELEASE SAVEPOINT LEVEL{$this->_transactionDepth}");
		}
	}
341333
public function probe(): void
    {
        if(!isset($this->settings["constraints"])) 
            return;
        $constraints = $this->settings["constraints"];
        foreach($constraints as $constraint=>$constraint_val) {
            if(is_null($constraint_val))
                continue;
            switch($constraint) {
                case "format":
                    if(!in_array($constraint_val, [
                         "numeric",
                         "ip",
                         "email",
                         "url",
                         "creditCard",
                         "alpha",
                         "alphaNum"
                         // "date" // there is already the Date field
                    ])) {
                        /*
                        if($constraint_val == "uuid" || $constraint_val == "udid") {
                            try {
                                ID::fromString($this->value);
                            }
                            catch(LibGraph\Exceptions\MalformedIDException $e) {
                                throw new \InvalidArgumentException;
                            }
                        }
                        else {
                            throw new \InvalidArgumentException;
                        }
                        */
                        throw new \InvalidArgumentException;
                    }
                    $v = new Validator(["field"=>$this->value]);
                    $v->rule($constraint_val, "field");
                    if(!$v->validate()) {
                        throw new \InvalidArgumentException;
                    }
                    break;
                //case "dateFormat":
                case "dateBefore":
                case "dateAfter":
                    $v = new Validator(["field"=>$this->value]);
                    $v->rule($constraint, "field", $constraint_val);
                    if(!$v->validate()) {
                        throw new \InvalidArgumentException;
                    }
                    break;
                case "minLength":
                case "maxLength":
                case "greaterThan":
                case "lessThan":
                    Assert::$constraint($this->value, $constraint_val);
                    break;
                               
                case "id":
                    try {
                        ID::fromString($this->value);
                    }
                    catch(LibGraph\Exceptions\MalformedIDException $e) {
                        throw new \InvalidArgumentException;
                    }
                    break;
                
                case "regex":
                    /*
                    if($constraint_val[0]!="/")
                        Assert::$constraint($this->value, "/".addslashes($constraint_val)."/");
                    else*/
                        Assert::$constraint($this->value, $constraint_val);
                    break;
             } 
        }
    }
612410
function StartTransaction()
	{
		if ($this->IsTransactionInProgress())
			throw new Exception('Transaction is already in progress.  Commit or rollback must be called before beginning a new transaction');
		
		if ($this->ConnectionSetting->IsReadOnlySlave)
			throw new Exception('Transactions are not allowed on a read-only slave');
		
		$this->RequireConnection(true);
		$this->Observe("DataAdapter ($this->_label) (DataAdapter.StartTransaction)", OBSERVE_QUERY);
		$this->_transactionInProgress = true;
		return $this->_driver->StartTransaction($this->_dbconn);
	}
737706
final public function begin()
    {
        if (!$this->pdo) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        if ($this->_begintransaction) {
            throw new Exception("已经开启了一个事务，请勿重新开启", Exception::CODE_DATABASE_ERROR);
        }
        $this->pdo->beginTransaction();
        $this->_begintransaction = true;
        return $this;
    }
948230
public function commit() {
		if (!$this->inTransaction()) {
			throw new Exception('There is no active transaction');
		}

		$res = @oci_commit($this->_dbh);
		$this->checkError($res);

		$this->_inTransaction = false;
		$this->_commitMode = null;

		return $res;
	}
1087082
public function execute() {
        // Get the card token from request
        $ckoCardToken = $this->getCardToken();

        // Get the customer id from request
        $customerId = $this->getCustomerId();

        try {
            $this->storeCardService
                 ->setCardToken($ckoCardToken)
                 ->setCustomerId($customerId)
                 ->setCustomerEmail()
                 ->test()
                 ->setCardData()
                 ->save();

            $this->messageManager->addSuccessMessage( __('The payment card has been stored successfully.'));
        }
        catch(\Exception $e) {
            $this->messageManager->addErrorMessage($e->getMessage());
        }
        
        return $this->_redirect('vault/cards/listAction');
    }
148538
public function beginTransaction()
    {
        if ($this->isTransactionEnabled() === false) {
            throw new ServiceException(sprintf(
                'The repository for %s doesn\'t support Transactions',
                $this->getEntityServiceName()
            ));
        }

        $this->getRepository()->beginTransaction();
    }
139726
private function execute()
    {
        $this->connect();
        try {
            $this->update->execute(array_merge($this->dados, $this->places));
            $this->result = true;
        } catch (\PDOException $e) {
            $this->result = null;
            $this->erro = "<b>(Update) Erro ao Ler: ({$this->tabela})</b> {$e->getMessage()}";
        }

        parent::setDefault();
    }
1278747
final public function rollBack()
    {
        if (!$this->pdo) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        if ($this->_begintransaction) {
            $this->pdo->rollBack();
            $this->_begintransaction = false;
        }
        return $this;
    }