Executes the resulting query against current database
@return mixed
186984
public function exec() {
		list($query, $args) = $this->build();
		if (empty($this->config))
			return call_user_func([$this->fluent->getMapper(), 'sql'], $query, $args);
		return call_user_func([$this->fluent->getMapper()->merge($this->config), 'sql'], $query, $args);
	}
142067
private function execute()
    {
        //Add the start (it it's set)
        if(count($this->start))
        {
            $this->query .= 'start ' . implode(', ', $this->start) . PHP_EOL;
        }

        //Add matches
        if(count($this->match))
        {
            $this->query .= 'match ' . implode(', ', $this->match) . PHP_EOL;
        }

        //Add where's
        if(count($this->where))
        {
            $this->query .= 'where (' . implode(') AND (', $this->where) . ')' . PHP_EOL;
        }

        //Add returns
        if(count($this->return))
        {
            $this->query .= 'return ' . implode(', ', $this->return) . PHP_EOL;
        }

        if (count($this->order))
        {
            $this->query .= 'order by ' . implode(', ', $this->order) . PHP_EOL;
        }

        if ($this->limit)
        {
            $this->query .= 'limit ' . $this->limit . PHP_EOL;
        }

        //Process the parameters
        $this->parameters = $this->processParameters();

        return $this->em->cypherQuery($this->query, $this->parameters);
    }
818678
public function execute() {
		
		// build the query
		$this->buildQuery();

		// prepare the statement
		$this->Prepared = \Polyfony\Database::handle()->prepare($this->Query);
		
		// marker start (after preparation, otherwise we would not be able to read the query, it wouldn't exist yet!)
		$id_marker = Profiler::setMarker(null, 'database', ['Query'=>$this]);

		// if prepare failed
		if(!$this->Prepared) {
			// throw an exception
			$this->throwExceptionOn('prepare');
		}
		
		// execute the statement
		$this->Success = $this->Prepared->execute($this->Values);
		
		// if execution failed
		if($this->Success === false) {
			// throw an exception
			$this->throwExceptionOn('execute');
		}

		// if a forced type of object has been defined
		$this->Object = $this->Object && $this->Object != 'Record' ? 
			'\Models\\'.$this->Object : 
			'\Models\\'.$this->Table;

		// temporary fix, if we don't have an object class at all
		if($this->Object == '\Models\\') {
			$this->Object = '\Polyfony\\Record';
		}

		// tweak for Microsoft SQL Server and MySQL
		$this->Object = str_replace('"','', $this->Object);
		
		// fetch all results as objects
		$this->Result = $this->Prepared->fetchAll(PDO::FETCH_CLASS, $this->Object);

		// format the result
		$this->formatSelectResult();
		$this->formatUpdateOrDeleteResult();
		$this->formatInsertResult();

		// marker end, release after all manipulation has been done
		Profiler::releaseMarker($id_marker);

		// return whatever result we got
		return $this->Result;
	}
1009505
public function execute()
    {
        try {
            /**/$this->app->pr->start('dsql/execute/render');
            $q = $this->render();
            /**/$this->app->pr->next('dsql/execute/query');
            $this->stmt = $this->owner->query($q, $this->params);
            $this->template = $this->mode = null;
            /**/$this->app->pr->stop();

            return $this;
        } catch (PDOException $e) {
            throw $this->exception('Database Query Failed')
                ->addMoreInfo('pdo_error', $e->getMessage())
                ->addMoreInfo('mode', $this->mode)
                ->addMoreInfo('params', $this->params)
                ->addMoreInfo('query', $q)
                ->addMoreInfo('template', $this->template)
                ;
        }
    }
1051564
public function execute() {
        if (!$this->checkExists()) {
            if ($this->current === self::OP_SELECT) {
                return new ArrayCollection();
            }

            return false;
        }
        $this->createQuery();

        $model = ($this->expected) ? $this->getRowModel() : null;
        if ($this->current === self::OP_SELECT && $this->isCached()) {
            $result = $this->getCached();
        }
        if (!$result) {
            if ($this->preserveQueries && $this->current !== self::OP_SELECT) // keep all queries except selects
                    $this->doPreserveQueries();
            $result = $this->connection->doPrepare($this->query, $this->values,
                    array(
                'multipleRows' => $this->multiple,
                'model' => $model
            ));

            if ($this->current === self::OP_SELECT) $this->saveCache($result);
            else $this->removeCache();
        }

        if ($this->current === self::OP_SELECT)
                $result = $this->returnSelect($result);
        $this->lastQuery = $this->query . '<pre><code>' . print_r($this->values,
                        true) . '</code></pre>';
        $this->resetQuery();
        return $result;
    }
550698
protected function _execute()
    {
        $this->triggerBeforeFind();
        if ($this->_results) {
            $decorator = $this->_decoratorClass();

            return new $decorator($this->_results);
        }

        $statement = $this->getEagerLoader()->loadExternal($this, $this->execute());

        return new ResultSet($this, $statement);
    }
340629
public function execute()
    {
        static $apcPrefix = null;
        if($apcPrefix === null) {
            $apcPrefix = function_exists('apcu_fetch') ? 'apcu' : 'apc';
        }

        // Generate a cache key by comparing our parameters to see if we've
        // made this query before
        $key = $this->getParameterHash() . $this->getFileHash();

        // Try and fetch a cached result object from APC
        $funcName = $apcPrefix . '_fetch';
        $success  = false;
        $result   = $funcName($key, $success);

        // If the result isn't in the cache then we run the real query
        if (!$success) {
            $result = parent::execute();
            $funcName = $apcPrefix . '_store';
            $funcName($key, $result);
        }

        return $result;
    }
126577
private function execute()
    {
        $this->connect();
        try {
            $this->getSyntax();
            $this->read->execute();
            $this->result = $this->read->fetchAll();
        } catch (\PDOException $e) {
            $this->result = null;
            parent::error("<b>Erro ao Ler:</b> {$e->getMessage()}", $e->getCode());
        }

        parent::setDatabase(DATABASE);
    }
1069939
protected function _run()
        {
            $query = $this->_buildSelect();
            $caching_enabled = self::$_config[$this->_connection_name]['caching'];

            if ($caching_enabled) {
                $cache_key = self::_createCacheKey($query, $this->_values, $this->_table_name, $this->_connection_name);
                $cached_result = self::_checkQueryCache($cache_key, $this->_table_name, $this->_connection_name);

                if ($cached_result !== false) {
                    return $cached_result;
                }
            }

            self::_execute($query, $this->_values, $this->_connection_name);
            $statement = self::get_last_statement();

            $rows = [];

            while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
                $rows[] = $row;
            }

            if ($caching_enabled) {
                self::_cacheQueryResult($cache_key, $rows, $this->_table_name, $this->_connection_name);
            }

            // reset One after executing the query
            $this->_values = [];
            $this->_resultColumns = array('*');
            $this->_using_default_resultColumns = true;

            return $rows;
        }
699386
public function execute()
	{
		try {
			$this->_stmt->execute();
		} catch ( PDOException $pe ) {
			throw new MW_DB_Exception( $pe->getMessage(), $pe->getCode(), $pe->errorInfo );
		}

		return new MW_DB_Result_PDO( $this->_stmt );
	}
293719
public function execute()
    {
        if($this->db === null) {
            $this->db = DB::getInstance();
        }
        return $this->db->execQuery($this);
    }
1274749
public function execute()
    {
        
        if (null === $this->statement) {
            throw new Exception('The database statement resource is not currently set.');
        }
        if ($this->statement->execute()) {
            
            if (($metaData = $this->statement->result_metadata()) !== false) {
                foreach ($metaData->fetch_fields() as $col) {
                    ${$col->name}   = null;
                    $results[]      = &${$col->name};
                    $cols[]         = $col->name;
                }
                
                call_user_func_array([$this->statement, 'bind_result'], $results);
                
                $this->stmt_results = $results;
                $this->stmt_cols = $cols;
            }
            return true;
        }
        return false;
    }
670550
function executeQuery () {
    return this.model.mysql().query(this.select.sql, this.select.params)
    // decode data
    .then(results => {
        // decode any encoded data columns
        return this.decodeData(results)
    })
    // add custom error handler
    .catch(err => {
        throw this.error('db error', err)
    })
}
1033401
private function dbExec()
    {
        if ($this->transLevel > 0
            && $this->transLevelRolledBack[$this->transLevel]
        ) {
            throw $this->createException('Trying to run query in rolled back transaction');
        }

        if (!empty($this->pendingTransactionBegin[$this->transLevel])) {
            $this->dbBeginTransaction();
        } else {
            if ($this->pendingConnection) {
                $this->connect();
            }
        }

        $result = pg_query($this->pgConn, $this->currentQuery);

        if ($result !== false) {
            return new DB\Result($result, $this->oidTypeNames);
        }

        if ($this->isInDbTransaction()) {
            $this->dbRollback();
            $this->transLevelRolledBack[$this->transLevel] = true;
        }

        throw $this->createException();
    }
769995
public function execute()
    {

        $DB = $this->getDBO();
        //Run the Query;
        $resultId = $DB->exec();
        //\Platform\Debugger::log($resultId);

        $this->setResultId($resultId)->setConnectionId($DB->getResourceId())->setAffectedRows($this->getAffectedRows());

        $DB->resetRun();

        return $this;
    }
652337
protected function executeQuery()
    {
        if (empty($this->queryString)) {
            return $this->builder->execute();
        }

        return $this->connection->executeQuery($this->queryString, $this->queryParams);
    }
906163
public function query()
	{
		if ($this->query_sql === null) {
			$this->compile();
		}

		if (empty($this->query_params)) {
			$t = microtime(true);
			try {
				$result = $this->pdo->query($this->query_sql);
				if ($this->log_query) {
					error_log(sprintf("SQL Query time: %F ms (query), %d rows.", (microtime(true) - $t) * 1000, $result->rowCount()));
				}
			}
			catch (\PDOException $ex) {
				throw new FlupdoException($ex->getMessage(), $ex->getCode(), $ex, $this->query_sql, $this->query_params);
			}
			if (!$result) {
				throw new FlupdoException(vsprintf("SQLSTATE[%s]: Error %s: %s", $this->pdo->errorInfo()),
					$this->pdo->errorCode(), null, $this->query_sql, $this->query_params);
			}
			return $result;
		} else {
			$t = microtime(true);
			try {
				$stmt = $this->prepare();
			}
			catch (\PDOException $ex) {
				throw new FlupdoException($ex->getMessage(), $ex->getCode(), $ex, $this->query_sql, $this->query_params);
			}
			if ($stmt === FALSE) {
				throw new FlupdoException(vsprintf("SQLSTATE[%s]: Error %s: %s", $this->pdo->errorInfo()),
					$this->pdo->errorCode(), null, $this->query_sql, $this->query_params);
			}

			$i = 1;
			foreach ($this->query_params as $param) {
				if (is_bool($param)) {
					$stmt->bindValue($i, $param, \PDO::PARAM_BOOL);
				} else if (is_null($param)) {
					$stmt->bindValue($i, $param, \PDO::PARAM_NULL);
				} else if (is_int($param)) {
					$stmt->bindValue($i, $param, \PDO::PARAM_INT);
				} else {
					// ignore locales when converting to string
					$stmt->bindValue($i, strval($param), \PDO::PARAM_STR);
				}
				$i++;
			}

			try {
				$success = $stmt->execute();
			}
			catch (\PDOException $ex) {
				throw new FlupdoException($ex->getMessage(), $ex->getCode(), $ex, $this->query_sql, $this->query_params);
			}
			if ($success === FALSE) {
				throw new FlupdoException(vsprintf("SQLSTATE[%s]: Error %s: %s", $stmt->errorInfo()),
					$stmt->errorCode(), null, $this->query_sql, $this->query_params);
			}
			if ($this->log_query) {
				error_log(sprintf("SQL Query time: %F ms (prepare + execute), %d rows.", (microtime(true) - $t) * 1000, $stmt->rowCount()));
			}
			if ($this->can_explain && $this->log_explain) {
				$this->explain();
			}
			return $stmt;
		}
	}