Run a raw, unprepared query against the PDO connection.

@param  string  $query
@return bool
2212
public function unprepared($query)
    {
        return $this->run($query, [], function ($query) {
            if ($this->pretending()) {
                return true;
            }

            $this->recordsHaveBeenModified(
                $change = $this->getPdo()->exec($query) !== false
            );

            return $change;
        });
    }
623388
protected function runQuery($raw_query, $id)
    {
        $query = str_replace(':id', $id, $raw_query);

        $start = microtime(true);

        // Does not work as a prepared statement; we have to execute it directly
        $results = DB::getReadPdo()->query($query)->fetchAll(\PDO::FETCH_OBJ);

        // Log the query manually
        DB::logQuery($raw_query, [$id], round((microtime(true) - $start) * 1000, 2));

        return $results;
    }
355186
public function fetch($query)
    {
        $db = $this->connection();

        if(method_exists($result = $db->query(rtrim(preg_replace('/\s\s/', ' ', $query), ' ')), 'rowCount')) {

            if($result->rowCount() && $result->setFetchMode($db::FETCH_ASSOC)) {

                return $result->fetchAll();
            }

            return false;
        }
    }
1157552
public function runRequest($query)
    {
        $request = Yii::createObject([
            'class'  => Request::class,
            'params' => is_array($query) ? $query : array_filter(explode(' ', $query)),
        ]);

        return Yii::$app->handleRequest($request);
    }
1019946
public function &getOneRow($query)
    {
        $result = $this->execute($query);
        if ( $result != false ) {
            return $result->fetch(PDO::FETCH_ASSOC);
        }
        return false;
    }
410207
public function fetch($query)
    {
        $result = $this->query($query);

        return $result->fetch(\PDO::FETCH_ASSOC);
    }
676434
public function exec($query)
    {
        if ($this->isConnected()) {
            try {
                return $this->pdo->exec($query);
            } catch (PDOException $e) {
                throw new \Exception($e->getMessage());
                return false;
            }
        } else {
            return false;
        }
    }
783908
public function query($query, $parameters = array())
    {
        if (is_null($this->connection)) {
            return false;
        }

        try {
            if (self::$profiling) {
                $timer = $this->initProfiler();
            }

            $query = $this->prepare($query, $parameters);
            $result = mysqli_query($this->connection, $query);
            if (!is_bool($result)) {
                mysqli_free_result($result);
            }

            if (self::$profiling && isset($timer)) {
                $this->recordQueryProfile($query, $timer);
            }
            return $result;
        } catch (Exception $e) {
            throw new DbException("Error query: " . $e->getMessage() . "
                                   In query: $query
                                   Parameters: " . var_export($parameters, true), $e->getCode());
        }
    }
559639
public function prepare($query)
    {
        $this->connect();
        $options = [PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL];
        $isObject = $query instanceof Query;
        if ($isObject && $query->isBufferedResultsEnabled() === false) {
            $options = [];
        }
        $statement = $this->_connection->prepare($isObject ? $query->sql() : $query, $options);

        return new SqlserverStatement($statement, $this);
    }
834826
public function query($query) {
    if(method_exists($this->db, 'query')) {
      return $this->db->query($query);
    } else {
      throw new Exception(__METHOD__ . " not implemented");
    }
  }
332589
protected function exec($query)
    {
        if (!$query) {
            throw new Exceptions\RPCException("Empty query.");
        }
        
        $url = sprintf("http://%s:%d", $this->conf["host"], $this->conf["port"]);
        $web = $this->getWebClient();
        $web->setMethod(HttpMethods::POST);
        $web->addHeader("Content-Type", "application/json");
        $web->setBasicAuth($this->conf["user"], $this->conf["pass"]);
        $web->setData($query);
        $response    = $web->request($url);
        $status_code = $response->getCode();
        
        if (isset(self::$exceptions[$status_code])) {
            $error = $this->getResponseError($response, $status_code);
            throw new self::$exceptions[$status_code](
                $error["message"],
                $error["code"]
            );
        }

        return $response;
    }
215356
public function statement($query, $bindings = [])
    {
        return $this->run($query, $bindings, function ($query, $bindings) {
            if ($this->pretending()) {
                return true;
            }

            $statement = $this->getPdo()->prepare($query);

            $this->bindValues($statement, $this->prepareBindings($bindings));

            return $statement->execute();
        });
    }
1285334
public function run($query = false, $exception = true)
    {

        if (true === $query) {
            return $this->resolveQuery($this->query);
        }

        list($prepare, $resolved) = $this->resolvePreparedStatement($this->query, $this->params);

        if (false === $resolved) {
            if (true === $exception) {
                $this->resolveQueryException();
            }
        }

        return $prepare;
    }
1340078
public function query($query)
	{
        Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
		$db = Eresus_DB::getHandler();
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, $query);
		$db->exec($query);
		return true;
	}
116044
public static function exec($query)
    {
        $ret = false;

        $res = self::query($query);

        if ($res) {
            $ret = self::connection()->sql_affected_rows();
            self::free($res);
        }

        return $ret;
    }
542844
public function prepare($query)
	{
		if (!$this->isOpen) { $this->throwError("It's not connected to the database",""); return null; }
		$this->lastParam=[];
		$this->lastQuery = $query;
		if ($this->readonly) {
			if (stripos($query, 'insert ') === 0 || stripos($query, 'update ') === 0 || stripos($query, 'delete ') === 0) {
				// we aren't checking SQL-DCL queries.
				$this->throwError("Database is in READ ONLY MODE","");
			}
		}
		if ($this->logLevel>=2) {
			$this->storeInfo($query);
		}

		try {
			$stmt = $this->conn1->prepare($query);
		} catch (Exception $ex) {
			$stmt=false;
			$this->throwError("Failed to prepare",$ex->getMessage(),json_encode($this->lastParam));
		}
		if ($stmt === false) {
			$this->throwError("Unable to prepare query",$this->lastQuery,json_encode($this->lastParam));
		}
		return $stmt;
	}
889856
public function runQuery(Query $query): Result {
        $query = $query->getQuery();

        echo self::$debugSparql ? $query . "\n" : '';

        return $this->runSparql($query);
    }