public function execute($params = array())
    {
        $this->mergeParams($params);

        $reconnect = $this->db->getOption('reconnect');
        $reconnectRetries = $this->db->getOption('reconnect_retries', 3);
        $reconnectDelayMS = $this->db->getOption('reconnect_delay_ms', 1000);

        while (true) {
            $e = null;
            $errorCode = null;
            $errorInfo = null;
            $result = null;

            $isReconnectError = false;
            try {
                $this->prepare();
                foreach ($this->positionParams as $index => $value) {
                    $this->statement->bindValue($index + 1, $value);
                }

                $result = $this->statement->execute($this->params?:null);
            } catch (\Exception $e) {
            }

            if ($result === false || !$e) {
                $errorCode = $this->statement->errorCode();
                $errorInfo = $this->statement->errorInfo();
            }

            $isReconnectError = Util::checkReconnectError($errorCode, $errorInfo, $e);

            // reconnect
            if ($reconnect && $isReconnectError && $reconnectRetries > 0) {
                $reconnectRetries--;
                $this->statement = null;
                $this->db->close();
                $reconnectDelayMS && usleep($reconnectDelayMS * 1000);
                continue;
            }

            break;
        }

        if ($e) {
            $this->db->logError(sprintf('Statement exception error #%s: %s', $e->getCode(), $e->getMessage()));
            throw $e;
        }

        if ($result === false) {
            $this->db->logError(sprintf('Statement execute error #%s: %s', $errorInfo[0], $errorInfo[2]));
            return false;
        }

        return $this->statement->rowCount();
    }
public function execute($params = array())
    {
        $this->mergeParams($params);

        $reconnect = $this->db->getOption('reconnect');
        $reconnectRetries = $this->db->getOption('reconnect_retries', 3);
        $reconnectDelayMS = $this->db->getOption('reconnect_delay_ms', 1000);

        while (true) {
            $e = null;
            $errorCode = null;
            $errorInfo = null;
            $result = null;

            $isReconnectError = false;
            try {
                $this->prepare();
                foreach ($this->positionParams as $index => $value) {
                    $this->statement->bindValue($index + 1, $value);
                }

                $result = $this->statement->execute($this->params?:null);
            } catch (\Exception $e) {
            }

            if ($result === false || !$e) {
                $errorCode = $this->statement->errorCode();
                $errorInfo = $this->statement->errorInfo();
            }

            $isReconnectError = Util::checkReconnectError($errorCode, $errorInfo, $e);

            // reconnect
            if ($reconnect && $isReconnectError && $reconnectRetries > 0) {
                $reconnectRetries--;
                $this->statement = null;
                $this->db->close();
                $reconnectDelayMS && usleep($reconnectDelayMS * 1000);
                continue;
            }

            break;
        }

        if ($e) {
            $this->db->logError(sprintf('Statement exception error #%s: %s', $e->getCode(), $e->getMessage()));
            throw $e;
        }

        if ($result === false) {
            $this->db->logError(sprintf('Statement execute error #%s: %s', $errorInfo[0], $errorInfo[2]));
            return false;
        }

        return $this->statement->rowCount();
    }
public function execute ( $ params = array ( ) ) { $ this -> mergeParams ( $ params ) ; $ reconnect = $ this -> db -> getOption ( 'reconnect' ) ; $ reconnectRetries = $ this -> db -> getOption ( 'reconnect_retries' , 3 ) ; $ reconnectDelayMS = $ this -> db -> getOption ( 'reconnect_delay_ms' , 1000 ) ; while ( true ) { $ e = null ; $ errorCode = null ; $ errorInfo = null ; $ result = null ; $ isReconnectError = false ; try { $ this -> prepare ( ) ; foreach ( $ this -> positionParams as $ index => $ value ) { $ this -> statement -> bindValue ( $ index + 1 , $ value ) ; } $ result = $ this -> statement -> execute ( $ this -> params ? : null ) ; } catch ( \ Exception $ e ) { } if ( $ result === false || ! $ e ) { $ errorCode = $ this -> statement -> errorCode ( ) ; $ errorInfo = $ this -> statement -> errorInfo ( ) ; } $ isReconnectError = Util :: checkReconnectError ( $ errorCode , $ errorInfo , $ e ) ; // reconnect if ( $ reconnect && $ isReconnectError && $ reconnectRetries > 0 ) { $ reconnectRetries -- ; $ this -> statement = null ; $ this -> db -> close ( ) ; $ reconnectDelayMS && usleep ( $ reconnectDelayMS * 1000 ) ; continue ; } break ; } if ( $ e ) { $ this -> db -> logError ( sprintf ( 'Statement exception error #%s: %s' , $ e -> getCode ( ) , $ e -> getMessage ( ) ) ) ; throw $ e ; } if ( $ result === false ) { $ this -> db -> logError ( sprintf ( 'Statement execute error #%s: %s' , $ errorInfo [ 0 ] , $ errorInfo [ 2 ] ) ) ; return false ; } return $ this -> statement -> rowCount ( ) ; }
Execute statement and return rows affected

@param array $params
@return  int|boolean
Execute statement and return rows affected