src/Statement.php
public function execute()
        {
            $values = ($this->getQuery() instanceof QueryInterface) ? $this->getQuery()->getValues() : array();
            if (Core::isDebugMode()) {
                if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) {
                    \caspar\core\Logging::log('executing PDO query (' . Core::getSQLCount() . ') - ' . (($this->getQuery() instanceof Criteria) ? $this->getQuery()->getAction() : 'unknown'), 'B2DB');
                }

                $previous_time = Core::getDebugTime();
            }

            $res = $this->statement->execute($values);

            if (!$res) {
                $error = $this->statement->errorInfo();
                if (Core::isDebugMode()) {
                    Core::sqlHit($this, $previous_time);
                }
                throw new Exception($error[2], $this->printSQL());
            }
            if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) {
                \caspar\core\Logging::log('done', 'B2DB');
            }

            if ($this->getQuery() instanceof Query && $this->getQuery()->isInsert()) {
                if (Core::getDriver() == Core::DRIVER_MYSQL) {
                    $this->insert_id = Core::getDBLink()->lastInsertId();
                } elseif (Core::getDriver() == Core::DRIVER_POSTGRES) {
                    $this->insert_id = Core::getDBLink()->lastInsertId(Core::getTablePrefix() . $this->getQuery()->getTable()->getB2DBName() . '_id_seq');
                    if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) {
                        \caspar\core\Logging::log('sequence: ' . Core::getTablePrefix() . $this->getQuery()->getTable()->getB2DBName() . '_id_seq', 'b2db');
                        \caspar\core\Logging::log('id is: ' . $this->insert_id, 'b2db');
                    }
                }
            }

            $return_value = new Resultset($this);

            if (Core::isDebugMode()) {
                Core::sqlHit($this, $previous_time);
            }

            if (!$this->getQuery() || $this->getQuery()->isSelect()) {
                $this->statement->closeCursor();
            }

            return $return_value;
        }
public function execute()
        {
            $values = ($this->getQuery() instanceof QueryInterface) ? $this->getQuery()->getValues() : array();
            if (Core::isDebugMode()) {
                if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) {
                    \caspar\core\Logging::log('executing PDO query (' . Core::getSQLCount() . ') - ' . (($this->getQuery() instanceof Criteria) ? $this->getQuery()->getAction() : 'unknown'), 'B2DB');
                }

                $previous_time = Core::getDebugTime();
            }

            $res = $this->statement->execute($values);

            if (!$res) {
                $error = $this->statement->errorInfo();
                if (Core::isDebugMode()) {
                    Core::sqlHit($this, $previous_time);
                }
                throw new Exception($error[2], $this->printSQL());
            }
            if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) {
                \caspar\core\Logging::log('done', 'B2DB');
            }

            if ($this->getQuery() instanceof Query && $this->getQuery()->isInsert()) {
                if (Core::getDriver() == Core::DRIVER_MYSQL) {
                    $this->insert_id = Core::getDBLink()->lastInsertId();
                } elseif (Core::getDriver() == Core::DRIVER_POSTGRES) {
                    $this->insert_id = Core::getDBLink()->lastInsertId(Core::getTablePrefix() . $this->getQuery()->getTable()->getB2DBName() . '_id_seq');
                    if (Core::isDebugLoggingEnabled() && class_exists('\\caspar\\core\\Logging')) {
                        \caspar\core\Logging::log('sequence: ' . Core::getTablePrefix() . $this->getQuery()->getTable()->getB2DBName() . '_id_seq', 'b2db');
                        \caspar\core\Logging::log('id is: ' . $this->insert_id, 'b2db');
                    }
                }
            }

            $return_value = new Resultset($this);

            if (Core::isDebugMode()) {
                Core::sqlHit($this, $previous_time);
            }

            if (!$this->getQuery() || $this->getQuery()->isSelect()) {
                $this->statement->closeCursor();
            }

            return $return_value;
        }
public function execute ( ) { $ values = ( $ this -> getQuery ( ) instanceof QueryInterface ) ? $ this -> getQuery ( ) -> getValues ( ) : array ( ) ; if ( Core :: isDebugMode ( ) ) { if ( Core :: isDebugLoggingEnabled ( ) && class_exists ( '\\caspar\\core\\Logging' ) ) { \ caspar \ core \ Logging :: log ( 'executing PDO query (' . Core :: getSQLCount ( ) . ') - ' . ( ( $ this -> getQuery ( ) instanceof Criteria ) ? $ this -> getQuery ( ) -> getAction ( ) : 'unknown' ) , 'B2DB' ) ; } $ previous_time = Core :: getDebugTime ( ) ; } $ res = $ this -> statement -> execute ( $ values ) ; if ( ! $ res ) { $ error = $ this -> statement -> errorInfo ( ) ; if ( Core :: isDebugMode ( ) ) { Core :: sqlHit ( $ this , $ previous_time ) ; } throw new Exception ( $ error [ 2 ] , $ this -> printSQL ( ) ) ; } if ( Core :: isDebugLoggingEnabled ( ) && class_exists ( '\\caspar\\core\\Logging' ) ) { \ caspar \ core \ Logging :: log ( 'done' , 'B2DB' ) ; } if ( $ this -> getQuery ( ) instanceof Query && $ this -> getQuery ( ) -> isInsert ( ) ) { if ( Core :: getDriver ( ) == Core :: DRIVER_MYSQL ) { $ this -> insert_id = Core :: getDBLink ( ) -> lastInsertId ( ) ; } elseif ( Core :: getDriver ( ) == Core :: DRIVER_POSTGRES ) { $ this -> insert_id = Core :: getDBLink ( ) -> lastInsertId ( Core :: getTablePrefix ( ) . $ this -> getQuery ( ) -> getTable ( ) -> getB2DBName ( ) . '_id_seq' ) ; if ( Core :: isDebugLoggingEnabled ( ) && class_exists ( '\\caspar\\core\\Logging' ) ) { \ caspar \ core \ Logging :: log ( 'sequence: ' . Core :: getTablePrefix ( ) . $ this -> getQuery ( ) -> getTable ( ) -> getB2DBName ( ) . '_id_seq' , 'b2db' ) ; \ caspar \ core \ Logging :: log ( 'id is: ' . $ this -> insert_id , 'b2db' ) ; } } } $ return_value = new Resultset ( $ this ) ; if ( Core :: isDebugMode ( ) ) { Core :: sqlHit ( $ this , $ previous_time ) ; } if ( ! $ this -> getQuery ( ) || $ this -> getQuery ( ) -> isSelect ( ) ) { $ this -> statement -> closeCursor ( ) ; } return $ return_value ; }
Performs a query, then returns a resultset

@return Resultset
Performs a query then returns a resultset