original_string: private function doExecute($fetch = false, $fetchMode = null, $fetchClass = null)
      {
          if ($fetch) {
              $fetchMode = Database::normalizeFetchType($fetchMode);
          }
  
          // Parse SQL and Bind
          $sql = $this->query->getSQL();
          $bind = $this->query->getBind();
  
          // Connection and execute
          $statement = $this->connection->prepare($sql);
  
          foreach ($bind as $idx => $value) {
              $statement->bindValue(($idx+1), $value, Database::typeOfValue($value));
          }
  
          // Fetch
          if ($fetch) {
              if ($fetchMode === Database::FETCH_CLASS) {
                  // Verify class
                  new \ReflectionClass($fetchClass);
  
                  $statement->setFetchMode($fetchMode, $fetchClass);
              } else {
                  $statement->setFetchMode($fetchMode);
              }
          }
  
          // Execute
          $success = $statement->execute();
          if (! $success) {
              return false;
          }
  
          if ($fetch && $fetch === 'single') {
              return $statement->fetch();
          }
          if ($fetch) {
              return $statement->fetchAll();
          }
  
          return true;
      }
code: private function doExecute($fetch = false, $fetchMode = null, $fetchClass = null)
      {
          if ($fetch) {
              $fetchMode = Database::normalizeFetchType($fetchMode);
          }
  
          // Parse SQL and Bind
          $sql = $this->query->getSQL();
          $bind = $this->query->getBind();
  
          // Connection and execute
          $statement = $this->connection->prepare($sql);
  
          foreach ($bind as $idx => $value) {
              $statement->bindValue(($idx+1), $value, Database::typeOfValue($value));
          }
  
          // Fetch
          if ($fetch) {
              if ($fetchMode === Database::FETCH_CLASS) {
                  // Verify class
                  new \ReflectionClass($fetchClass);
  
                  $statement->setFetchMode($fetchMode, $fetchClass);
              } else {
                  $statement->setFetchMode($fetchMode);
              }
          }
  
          // Execute
          $success = $statement->execute();
          if (! $success) {
              return false;
          }
  
          if ($fetch && $fetch === 'single') {
              return $statement->fetch();
          }
          if ($fetch) {
              return $statement->fetchAll();
          }
  
          return true;
      }
code_tokens: private function doExecute ( $ fetch = false , $ fetchMode = null , $ fetchClass = null ) { if ( $ fetch ) { $ fetchMode = Database :: normalizeFetchType ( $ fetchMode ) ; } // Parse SQL and Bind $ sql = $ this -> query -> getSQL ( ) ; $ bind = $ this -> query -> getBind ( ) ; // Connection and execute $ statement = $ this -> connection -> prepare ( $ sql ) ; foreach ( $ bind as $ idx => $ value ) { $ statement -> bindValue ( ( $ idx + 1 ) , $ value , Database :: typeOfValue ( $ value ) ) ; } // Fetch if ( $ fetch ) { if ( $ fetchMode === Database :: FETCH_CLASS ) { // Verify class new \ ReflectionClass ( $ fetchClass ) ; $ statement -> setFetchMode ( $ fetchMode , $ fetchClass ) ; } else { $ statement -> setFetchMode ( $ fetchMode ) ; } } // Execute $ success = $ statement -> execute ( ) ; if ( ! $ success ) { return false ; } if ( $ fetch && $ fetch === 'single' ) { return $ statement -> fetch ( ) ; } if ( $ fetch ) { return $ statement -> fetchAll ( ) ; } return true ; }
docstring: Execute the query, fetch if provided details to do so.
  
  @param bool $fetch       Fetch on or off?
  @param null $fetchMode   Fetch mode (null for default)
  @param null $fetchClass  Fetch class (null for none)
  
  @throws QueryBuilderParseException
  @throws QueryBuilderException
  @throws QueryException
  @throws DatabaseException
  
  @throws \Exception
  
  @return bool Boolean when fetching is off.
  @return array|object|null Result when fetching is on.
docstring_tokens: Execute the query fetch if provided details to do so .