public function execute($stmt, $values = null)
    {
        if (isset($this->prepared[$stmt])) {
            if (!is_array($values)) {
                $values = ($this->prepared[$stmt]['params'] == 1) ? array($values) : array();
            }
            $start = microtime(true);
            if ($this->dbExecute($this->prepared[$stmt]['obj'], array_values($values), $stmt)) {
                static::$logs[$this->id][$stmt]['executed'] += microtime(true) - $start;
                static::$logs[$this->id][$stmt]['count']++;
                switch ($this->prepared[$stmt]['type']) {
                    case 'SELECT':
                        return true;
                    break;
                    case 'INSERT':
                        return $this->dbInserted();
                    default:
                        return $this->dbAffected($this->prepared[$stmt]['obj']);
                }
            } elseif ($error = $this->dbExecuteError($this->prepared[$stmt]['obj'])) {
                static::$logs[$this->id][$stmt]['errors'][] = $error;
            }
        }

        return false;
    }
public function execute($stmt, $values = null)
    {
        if (isset($this->prepared[$stmt])) {
            if (!is_array($values)) {
                $values = ($this->prepared[$stmt]['params'] == 1) ? array($values) : array();
            }
            $start = microtime(true);
            if ($this->dbExecute($this->prepared[$stmt]['obj'], array_values($values), $stmt)) {
                static::$logs[$this->id][$stmt]['executed'] += microtime(true) - $start;
                static::$logs[$this->id][$stmt]['count']++;
                switch ($this->prepared[$stmt]['type']) {
                    case 'SELECT':
                        return true;
                    break;
                    case 'INSERT':
                        return $this->dbInserted();
                    default:
                        return $this->dbAffected($this->prepared[$stmt]['obj']);
                }
            } elseif ($error = $this->dbExecuteError($this->prepared[$stmt]['obj'])) {
                static::$logs[$this->id][$stmt]['errors'][] = $error;
            }
        }

        return false;
    }
public function execute ( $ stmt , $ values = null ) { if ( isset ( $ this -> prepared [ $ stmt ] ) ) { if ( ! is_array ( $ values ) ) { $ values = ( $ this -> prepared [ $ stmt ] [ 'params' ] == 1 ) ? array ( $ values ) : array ( ) ; } $ start = microtime ( true ) ; if ( $ this -> dbExecute ( $ this -> prepared [ $ stmt ] [ 'obj' ] , array_values ( $ values ) , $ stmt ) ) { static :: $ logs [ $ this -> id ] [ $ stmt ] [ 'executed' ] += microtime ( true ) - $ start ; static :: $ logs [ $ this -> id ] [ $ stmt ] [ 'count' ] ++ ; switch ( $ this -> prepared [ $ stmt ] [ 'type' ] ) { case 'SELECT' : return true ; break ; case 'INSERT' : return $ this -> dbInserted ( ) ; default : return $ this -> dbAffected ( $ this -> prepared [ $ stmt ] [ 'obj' ] ) ; } } elseif ( $ error = $ this -> dbExecuteError ( $ this -> prepared [ $ stmt ] [ 'obj' ] ) ) { static :: $ logs [ $ this -> id ] [ $ stmt ] [ 'errors' ] [ ] = $ error ; } } return false ; }
Execute a prepared statement.

@param int          $stmt   A ``$db->prepare(...)``d statement's return value.
@param string|array $values The query parameters.  If there is only one or none, then this can be a string.

@return mixed Either ``false`` if there was an error, ``true`` for a SELECT query, the inserted ``$id`` for an INSERT query, or the ``$num`` of affected rows for everything else.
Execute a prepared statement .