Execute the export

This will return the results as a Cursor. The cursor can then be used to iterate the results.

@throws Exception
@return ExportCursor
5796
public function execute()
    {
        $data = [
            self::ENTRY_FLUSH => $this->_flush,
            self::ENTRY_COUNT => true
        ];

        if ($this->_batchSize > 0) {
            $data[self::ENTRY_BATCHSIZE] = $this->_batchSize;
        }

        if ($this->_limit > 0) {
            $data[self::ENTRY_LIMIT] = $this->_limit;
        }

        if (is_array($this->_restrictions)) {
            $data[self::ENTRY_RESTRICT] = $this->_restrictions;
        }

        $collection = $this->_collection;
        if ($collection instanceof Collection) {
            $collection = $collection->getName();
        }

        $url      = UrlHelper::appendParamsUrl(Urls::URL_EXPORT, ['collection' => $collection]);
        $response = $this->_connection->post($url, $this->getConnection()->json_encode_wrapper($data));

        return new ExportCursor($this->_connection, $response->getJson(), $this->getCursorOptions());
    }
880475
@Override
    public Iterator<T> iterator() {
        return new Iterator<T>() {
            private int cursor = 0;

            @Override
            public boolean hasNext() {
                return size == INFINITE_SIZE || cursor < size;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                cursor++;
                return generator.next();
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException("remove() operation is not supported");
            }
        };
    }
58820
public static function ExecuteEach()
	{
		$arguments = func_get_args();
		$executeQueryBuilders = is_array($arguments[0])? $arguments[0] : $arguments;

		$db = self::connect();
		$db->beginTransaction();
		
		try
		{
			$results = null;

			foreach($executeQueryBuilders as $executeQueryBuilder)
			{				
				$executeQuery = $executeQueryBuilder($results);
				$query = $db->prepare($executeQuery["statement"]);
			
				foreach($executeQuery["parameters"] as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
						
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
					
				$query->execute();
				$rowsAffected = $query->rowCount();
				$lastID = $db->lastInsertId();

				$results = (object) array(
					DatabaseReturn::RowsAffected => $rowsAffected,
					DatabaseReturn::LastInsertID => $lastID
				);
			}
		}
		catch (PDOException $e)
		{
			$db->rollBack();
			$exception = "Sorry, there was a problem with query execution. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		$db->commit();
		return $results;
	}
264353
public function getExporter()
	{
		// Derive the class name from the driver.
		$class = '\\Joomla\\Database\\' . ucfirst($this->name) . '\\' . ucfirst($this->name) . 'Exporter';

		// Make sure we have an exporter class for this driver.
		if (!class_exists($class))
		{
			// If it doesn't exist we are at an impasse so throw an exception.
			throw new \RuntimeException('Database Exporter not found.');
		}

		/* @var  $o  DatabaseExporter */
		$o = new $class;
		$o->setDbo($this);

		return $o;
	}
299227
public function execute()
    {
        $result = null;
        // Only return the result of the primary query
        foreach ($this as $query) {
            /** @var QueryBuilder $query */
            try {
                if ($result === null) {
                    $result = $query->execute();
                    if ($query->getType() === 3) {
                        $this->setLastInsertId($query);
                    }
                    foreach ($this->resultCallbacks as $callback) {
                        $callback($query, $result, $this->getParentId());
                    }
                } else {
                    foreach ($this->resultCallbacks as $callback) {
                        $callback($query, $result, $this->getParentId());
                    }
                    $query->execute();
                }
            } catch (\Exception $e) {
                throw $e;
            }
        }

        return $result;
    }
776067
public function execute()
    {
        $statement = $this->getPdoStatement();
        $result = $statement->execute($this->bindings);
        if (!$result) {
            $errorInfo = $statement->errorInfo();
            throw new RuntimeException(
                $errorInfo[1],
                $errorInfo[2]
            );
        }
        return $statement;
    }
782813
public function getExporter()
	{
		// Derive the class name from the driver.
		$class = '\\Joomla\\Database\\' . ucfirst($this->name) . '\\' . ucfirst($this->name) . 'Exporter';

		// Make sure we have an exporter class for this driver.
		if (!class_exists($class))
		{
			// If it doesn't exist we are at an impasse so throw an exception.
			throw new Exception\UnsupportedAdapterException('Database Exporter not found.');
		}

		/** @var $o DatabaseExporter */
		$o = new $class;
		$o->setDbo($this);

		return $o;
	}
1350266
@Override
    protected boolean moveCursor() throws SQLException, OntopConnectionException {
        boolean foundFreshRow;
        List<Object> currentKey;
        do{
           foundFreshRow = rs.next();
           // Cannot use this in the while condition: limit case where the last row was a duplicate
           if(!foundFreshRow) {
               break;
           }
           currentKey = computeRowKey(rs);
        } while(!rowKeys.add(currentKey));

        return foundFreshRow;
    }
927216
public function getExport()
  {
      if (null === $this->export) {
          $this->export = array();
          $this->fillExport();
      }

      return $this->export;
  }
586495
public function execute()
	{
		$query  = $this->factory->builder($this->insert)->process();
		$result = $this->pdo->query($query);
		if(!$result)
		{
			throw new \Exception('An error is while the insertion occurred! (query: "' . $query . '")');
		}

		return $this->pdo->lastInsertId();
	}
747657
public function selectOne()
    {
        $this->setLimit(1);

        $query = 'SELECT ' . $this->getQueryFields() . ' FROM ' . $this->getTable() . ' ' . $this->getQueryWhere() . ' ' . $this->getQueryOrderBy() . ' ' . $this->getQueryLimit();

        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        $this->clear();

        if ($statement->rowCount() === 0) {
            throw new ExceptionNoData('No data for current query! (query: ' . $query . ', bind: ' . json_encode($this->binds) . ')', 10001);
        }

        //~ Create new object, set data & save it in cache
        return $this->newDataInstance($statement->fetchObject(), true);
    }
1015377
public function useCursor()
    {
        $this->files = array_merge_recursive( array( 'jqplot.cursor.js' ), $this->files );
        $this->setNestedOptVal( $this->options, 'cursor', 'show', true );
        $this->setNestedOptVal( $this->options, 'cursor', 'showTooltip', true );
        
        return $this;
    }
783666
private function execute()
    {
        $data = curl_exec($this->ch);

        if ($data === false) {
            $this->close();

            throw new \Exception('Impossible to pass the result.');
        }

        $this->error = curl_error($this->ch);

        $this->errno = curl_errno($this->ch);

        $this->header = curl_getinfo($this->ch);

        $this->executed = true;

        $this->close();

        return $data;
    }
882977
public function execute() {
        $curr = null;
        foreach($this->results as $result) {
            if(!is_null($curr)) {
                $result->setSource($curr);
            }

            $curr = $result->execute();
        }

        return $curr;
    }
1060489
@Override
    public Void call() throws Exception {
        OutputStream out = null;
        InputStream in = null;
        try {
            out = new FileOutputStream(destination);
            in = new FileInputStream(source);
            JasperCompileManager.compileReportToStream(in, out);
            if (verbose) {
                log.info("Compiling " + source.getName());
            }
        } catch (Exception e) {
            cleanUpAndThrowError(destination, e);
        } finally {
            if (out != null) {
                out.close();
            }
            if (in != null) {
                in.close();
            }
        }
        return null;
    }
234110
public function useCursor()
	{
	    //@codeCoverageIgnoreStart
	    if (! $this->jsWriter instanceOf \AltaMira\JsWriter\Ability\Cursorable ) {
            throw new \BadMethodCallException( "JsWriter cannot use cursor" );
	    }
	    //@codeCoverageIgnoreEnd
	    
	    $this->jsWriter->useCursor();
	    
	    return $this;
	}
1329114
public Result call() throws Exception {
		final String sourceMethod = "call"; //$NON-NLS-1$
		IResourceVisitor visitor = new IResourceVisitor() {
			/* (non-Javadoc)
			 * @see com.ibm.jaggr.service.modules.ResourceVisitor#visitResource(com.ibm.jaggr.service.modules.Resource)
			 */
			@Override
			public boolean visitResource(Resource resource, String pathname) throws IOException {
				if (pathname == null) {
					pathname = ""; //$NON-NLS-1$
				}
				int idx = pathname.lastIndexOf("/"); //$NON-NLS-1$
				String resname = idx == -1 ? pathname : pathname.substring(idx+1);

				if (resource.isFolder()) {
					if (!resname.startsWith(".")) { //$NON-NLS-1$
						root.createOrGet(pathname, resource.getURI());
						return true;
					} else {
						return false;
					}
				}
				if (!resource.getURI().getPath().endsWith(".js")) { //$NON-NLS-1$
					// non-JavaScript resource
					idx = resname.lastIndexOf("."); //$NON-NLS-1$
					String extension = idx == -1 ? "" : resname.substring(idx+1); //$NON-NLS-1$
					if (nonJSExtensions.contains(extension)) {
						DepTreeNode node = root.createOrGet(pathname, resource.getURI());
						node.setDependencies(null, null,  null,  resource.lastModified(), resource.lastModified());
					}
					return false;
				}
				// strip off the .js extension
				if (pathname.endsWith(".js")) {  //$NON-NLS-1$
					pathname = pathname.substring(0, pathname.length()-3);
				}
				DepTreeNode node = (pathname.length() > 0) ? root.createOrGet(pathname, resource.getURI()) : root;
				DepTreeNode cachedNode = null;
				if (cached != null) {
					cachedNode = (pathname.length() > 0) ? cached.getDescendent(pathname) : cached;
				}
				if (cachedNode != null) {
					node.setDependencies(
							cachedNode.getDefineDepArray(),
							cachedNode.getRequireDepArray(),
							cachedNode.getDependentFeatures(),
							cachedNode.lastModified(), cachedNode.lastModifiedDep());
				}
				/*
				 * The path is for a javascript module. Check the timestamp for the
				 * node against the timestamp for the file object to see if the file
				 * has changed and we need to re-parse it.
				 */
				if (node.lastModified() != resource.lastModified()) {
					// File has changed, or is new. Submit an async parser job.
					parserCs.submit(new DepParser(node, resource.newResource(aggregator), compilerOptionsMap));
					parserCount.incrementAndGet();
				}
				return true;
			}
		};

		/*
		 * Process the path. The treeWalker method will queue files
		 * to the parser completion service to parse javascript
		 * files in order to read the require list from the AMD
		 * define() function, and increments parserCount for each
		 * file queued.
		 */
		IResource resource = aggregator.newResource(uri);
		if (resource.exists()) {
			resource.walkTree(visitor);
		}
		/*
		 * Call treeWalker again, this time to add the javascript
		 * module with the same pathname, if it exists.
		 */
		String name = uri.getPath();
		if (!name.endsWith(".js")) { //$NON-NLS-1$
			if (name.endsWith("/")) { //$NON-NLS-1$
				name = name.substring(0, name.length()-1);
			}
			int idx = name.lastIndexOf("/"); //$NON-NLS-1$
			if (idx != -1) {
				name = name.substring(idx + 1);
			}
			name += ".js"; //$NON-NLS-1$

			resource = aggregator.newResource(
					uri.resolve((uri.getPath().endsWith("/") ? "../" : "./") + name)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
			if (resource.exists()) {
				visitor.visitResource(resource.asVisitorResource(), ""); //$NON-NLS-1$
			}
		}
		// Record the count of files queue
		int totalCount = parserCount.get();

		// Pull the completed parser tasks from the completion queue
		// until all files have been parsed
		while (parserCount.decrementAndGet() >= 0) {
			try {
				SignalUtil.take(parserCs, sourceClass, sourceMethod).get();
			} catch (Exception e) {
				if (log.isLoggable(Level.SEVERE))
					log.logp(Level.SEVERE, sourceClass, sourceMethod, e.getMessage(), e);
			}
		}

		// Return the buildReader
		return new Result(uri.toString(), totalCount);
	}