function DatabaseStatementBase::execute

Overrides DatabaseStatementInterface::execute

File

includes/database/database.inc, line 2265

Class

DatabaseStatementBase
Default implementation of DatabaseStatementInterface.

Code

public function execute($args = array(), $options = array()) {
    if (isset($options['fetch'])) {
        if (is_string($options['fetch'])) {
            // Default to an object. Note: db fields will be added to the object
            // before the constructor is run. If you need to assign fields after
            // the constructor is run, see http://drupal.org/node/315092.
            $this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']);
        }
        else {
            $this->setFetchMode($options['fetch']);
        }
    }
    $logger = $this->dbh
        ->getLogger();
    if (!empty($logger)) {
        $query_start = microtime(TRUE);
    }
    $return = parent::execute($args);
    if (!empty($logger)) {
        $query_end = microtime(TRUE);
        $logger->log($this, $args, $query_end - $query_start);
    }
    return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.