Executes a statement
@return ResultSet
331899
public function execute($sql, $params=array())
    {
        if(!is_array($params))
            $params = array_slice(func_get_args(),1);

        $mysqli = $this->_mysqli();
        $debug = $this->_debug;
        $sql = count($params) ? $this->binder()->bind($sql, $params) : $sql;

        // delegate execution to the filter chain
        return $this->_filter->execute($sql, function($sql) use ($mysqli, $debug) {
            \Pheasant\Database\Mysqli\Connection::$counter++;

            if($debug) {
                $timer = microtime(true);
            }

            $r = $mysqli->query($sql, MYSQLI_STORE_RESULT);

            if($debug) {
                \Pheasant\Database\Mysqli\Connection::$timer += microtime(true)-$timer;
            }

            if ($debug) {
                printf("<pre>Pheasant executed <code>%s</code> on thread #%d in %.2fms, returned %d rows</pre>\n\n",
                    $sql, $mysqli->thread_id, (microtime(true)-$timer)*1000, is_object($r) ? $r->num_rows : 0);
            }

            if ($mysqli->error) {
                if ($mysqli->errno === 1213 || $mysqli->errno === 1479) {
                    throw new DeadlockException($mysqli->error, $mysqli->errno);
                } else {
                    throw new Exception($mysqli->error, $mysqli->errno);
                }
            }

            return new ResultSet($mysqli, $r === true ? false : $r);
        });
    }
1145953
public function execute()
    {
        $this->result_set = new \FreeFW\Model\ResultSet();
        switch ($this->type) {
            case self::QUERY_SELECT:
                $model            = \FreeFW\DI\DI::get($this->main_model);
                $this->result_set = $this->strategy->select($model, $this->conditions);
                return true;
                break;
            case self::QUERY_DELETE:
                $model = \FreeFW\DI\DI::get($this->main_model);
                return $this->strategy->delete($model, $this->conditions);
                break;
            default:
                var_dump('error query execute');
                die;
        }
        return false;
    }
1079738
public function select()
    {
        $query     = 'SELECT ' . $this->getQueryFields() . ' FROM ' . $this->getTable() . ' ' . $this->getQueryWhere() . ' ' . $this->getQueryOrderBy() . ' ' . $this->getQueryLimit();
        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        $this->clear();

        $collection = array();

        while (false !== ($row = $statement->fetchObject())) {
            $collection[] = $this->newDataInstance($row, true);
        }

        return $collection;
    }
293719
public function execute()
    {
        if($this->db === null) {
            $this->db = DB::getInstance();
        }
        return $this->db->execQuery($this);
    }
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;
    }
882977
public function execute() {
        $curr = null;
        foreach($this->results as $result) {
            if(!is_null($curr)) {
                $result->setSource($curr);
            }

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

        return $curr;
    }
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();
	}
159435
protected function runSelect()
    {
        return $this->connection->select(
            $this->toSql(), $this->getBindings(), ! $this->useWritePdo
        );
    }
241069
public boolean execute(final int[] columnIndexes) throws SQLException {
        return execute(new Executor() {
            
            @Override
            public boolean execute(final Statement statement, final String sql) throws SQLException {
                return statement.execute(sql, columnIndexes);
            }
        });
    }
931568
public function execute()
	{
		$this->connect();

		if (!is_object($this->connection))
		{
			$this->log(
				Log\LogLevel::ERROR,
				'Database query failed (error #{code}): {message}',
				array('code' => $this->errorNum, 'message' => $this->errorMsg)
			);
			throw new \RuntimeException($this->errorMsg, $this->errorNum);
		}

		// Take a local copy so that we don't modify the original query and cause issues later
		$sql = $this->replacePrefix((string) $this->sql);

		if ($this->limit > 0 || $this->offset > 0)
		{
			// @TODO
			$sql .= ' LIMIT ' . $this->offset . ', ' . $this->limit;
		}

		// Increment the query counter.
		$this->count++;

		// If debugging is enabled then let's log the query.
		if ($this->debug)
		{
			// Add the query to the object queue.
			$this->log(
				Log\LogLevel::DEBUG,
				'{sql}',
				array('sql' => $sql, 'category' => 'databasequery', 'trace' => debug_backtrace())
			);
		}

		// Reset the error values.
		$this->errorNum = 0;
		$this->errorMsg = '';

		// Execute the query.
		$this->executed = false;

		if ($this->prepared instanceof \PDOStatement)
		{
			// Bind the variables:
			if ($this->sql instanceof PreparableInterface)
			{
				$bounded =& $this->sql->getBounded();

				foreach ($bounded as $key => $obj)
				{
					$this->prepared->bindParam($key, $obj->value, $obj->dataType, $obj->length, $obj->driverOptions);
				}
			}

			$this->executed = $this->prepared->execute();
		}

		// If an error occurred handle it.
		if (!$this->executed)
		{
			// Get the error number and message before we execute any more queries.
			$errorNum = (int) $this->connection->errorCode();
			$errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());

			// Check if the server was disconnected.
			if (!$this->connected())
			{
				try
				{
					// Attempt to reconnect.
					$this->connection = null;
					$this->connect();
				}
				catch (\RuntimeException $e)
				// If connect fails, ignore that exception and throw the normal exception.
				{
					// Get the error number and message.
					$this->errorNum = (int) $this->connection->errorCode();
					$this->errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());

					// Throw the normal query exception.
					$this->log(
						Log\LogLevel::ERROR,
						'Database query failed (error #{code}): {message}',
						array('code' => $this->errorNum, 'message' => $this->errorMsg)
					);
					throw new \RuntimeException($this->errorMsg, $this->errorNum);
				}

				// Since we were able to reconnect, run the query again.
				return $this->execute();
			}
			else
			// The server was not disconnected.
			{
				// Get the error number and message from before we tried to reconnect.
				$this->errorNum = $errorNum;
				$this->errorMsg = $errorMsg;

				// Throw the normal query exception.
				$this->log(
					Log\LogLevel::ERROR,
					'Database query failed (error #{code}): {message}',
					array('code' => $this->errorNum, 'message' => $this->errorMsg)
				);
				throw new \RuntimeException($this->errorMsg, $this->errorNum);
			}
		}

		return $this->prepared;
	}
329723
public function execute()
    {
        try {
            $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
            $pdo = new PDO('sqlite:' . $this->path, $opts);

            foreach ($this->queries as $query) {
                $pdo->query($this->phpci->interpolate($query));
            }
        } catch (\Exception $ex) {
            $this->phpci->logFailure($ex->getMessage());
            return false;
        }
        return true;
    }
802357
public function execute()
    {
        $qe = new QueryExecuter($this->repo, $this->predicate, $this->limit, $this->orderBy);

        return $qe->run();
    }
1324346
public function exec() {
        try {
            $query = $this->db->prepare($this->q->get());
            $this->bindValues($query);
            $query->execute();

            // Set the last inserted id but only
            // of $this->db->lastInsertId() is not empty
            if (!empty($this->db->lastInsertId())) {
                $this->lastInsertId = $this->db->lastInsertId();
            }

            $this->clear();

            return true;
        } catch (\PDOException $e) {
            $this->setError('d', $e->getMessage());
            return false;
        }
    }
436421
public function execute() {

		foreach($this -> stmt as $stmt) {
			$this -> executeStatement($stmt);
		}

		$this -> shadow = $this -> stmt;
		$this -> reset();

		//Write time for debugging
		$this -> trace = microtime(true) - $this -> trace;

		return true;
	}
108605
public function execute()
    {
        $db = $this->db;

        $qp = array();

        if (isset($this->q['query'])) {
            $sth = $db->prepare($this->q['query']);
        } else {
            $qp = $this->makeQuery();
            $sth = $db->prepare($qp['query']);
            foreach ($qp['params'] as $key => $val) {
                if (is_int($val)) {
                    $sth->bindValue("$key", $val, $db::PARAM_INT);
                } else {
                    $sth->bindValue("$key", $val);
                }
            }
        }

        $sth->execute();

        return $sth;
    }
249851
static ResultSet executeStatement(SQL sql) throws SQLException {
    try (SqlSession session = sqlSessionFactory.openSession(true)) {
      try (Connection conn = session.getConnection()) {
        try (Statement stmt = conn.createStatement()) {
          return stmt.executeQuery(sql.toString());
        }
      }
    }
  }
695156
function execute() {

        if ( isset( $this->rows ) ) return $this;

        if ( $this->parent_ ) {

            // restrict to parent
            $this->where[] = $this->db->is( $this->key, $this->parent_->getGlobalKeys( $this->parentKey ) );

        }

        $root = $this->getRoot();
        $definition = $this->getDefinition();

        $cached = $root->getCache( $definition );

        if ( !$cached ) {

            // fetch all rows
            $statement = $this->db->select( $this->table, array(
                'expr' => $this->select,
                'where' => $this->where,
                'orderBy' => $this->orderBy,
                'limitCount' => $this->limitCount,
                'limitOffset' => $this->limitOffset,
                'params' => $this->whereParams
            ) );

            $rows = $statement->fetchAll();
            $cached = array();

            // build row objects
            foreach ( $rows as $row ) {

                $row = $this->createRow( $row );
                $row->setClean();

                $cached[] = $row;

            }

            $root->setCache( $definition, $cached );

        }

        $this->globalRows = $cached;

        if ( !$this->parent_ ) {

            $this->rows = $cached;

        } else {

            $this->rows = array();
            $keys = $this->parent_->getLocalKeys( $this->parentKey );

            foreach ( $cached as $row ) {

                if ( in_array( $row->__get( $this->key ), $keys ) ) {

                    $this->rows[] = $row;

                }

            }

        }

        return $this;

    }