public function executeInstruction(string $strSQL, ?array $parans = null) : bool
    {
        $this->dbPreparedStatment = $this->dbConnection->prepare($strSQL);
        $this->pdoLastError = null;


        if($parans !== null) {
            foreach($parans as $key => $value) {
                $val = $value;

                // Trata dados de tipos especiais
                if(is_bool($value) === true) { 
                    if($value === true) { $val = 1; }
                    else { $val = 0; }
                }
                else if(is_a($value, "\DateTime") === true) {
                    $val = $value->format("Y-m-d H:i:s");
                }

                $this->dbPreparedStatment->bindValue(":" . $key, $val);
            }
        }


        try {
            $this->dbPreparedStatment->execute();
        } catch (\Exception $ex) {
            $this->pdoLastError = $ex->getMessage();
        }

        return $this->isExecuted();
    }
public function executeInstruction(string $strSQL, ?array $parans = null) : bool
    {
        $this->dbPreparedStatment = $this->dbConnection->prepare($strSQL);
        $this->pdoLastError = null;


        if($parans !== null) {
            foreach($parans as $key => $value) {
                $val = $value;

                // Trata dados de tipos especiais
                if(is_bool($value) === true) { 
                    if($value === true) { $val = 1; }
                    else { $val = 0; }
                }
                else if(is_a($value, "\DateTime") === true) {
                    $val = $value->format("Y-m-d H:i:s");
                }

                $this->dbPreparedStatment->bindValue(":" . $key, $val);
            }
        }


        try {
            $this->dbPreparedStatment->execute();
        } catch (\Exception $ex) {
            $this->pdoLastError = $ex->getMessage();
        }

        return $this->isExecuted();
    }
public function executeInstruction ( string $ strSQL , ? array $ parans = null ) : bool { $ this -> dbPreparedStatment = $ this -> dbConnection -> prepare ( $ strSQL ) ; $ this -> pdoLastError = null ; if ( $ parans !== null ) { foreach ( $ parans as $ key => $ value ) { $ val = $ value ; // Trata dados de tipos especiais if ( is_bool ( $ value ) === true ) { if ( $ value === true ) { $ val = 1 ; } else { $ val = 0 ; } } else if ( is_a ( $ value , "\DateTime" ) === true ) { $ val = $ value -> format ( "Y-m-d H:i:s" ) ; } $ this -> dbPreparedStatment -> bindValue ( ":" . $ key , $ val ) ; } } try { $ this -> dbPreparedStatment -> execute ( ) ; } catch ( \ Exception $ ex ) { $ this -> pdoLastError = $ ex -> getMessage ( ) ; } return $ this -> isExecuted ( ) ; }
Prepara e executa um comando SQL.

@param       string $strSQL
Instrução a ser executada.

@param       ?array $parans
Array associativo contendo as chaves e respectivos
valores que serão substituídos na instrução SQL.

@return      bool
Prepara e executa um comando SQL .