@param QueryInterface $query

@return Result|null
@throws Exception
773748
public function process(QueryInterface $query)
    {
        if (!$query instanceof ShowQuery || $query->getObject() !== ShowQuery::EXPRESSION_FULL_COLUMNS) {
            return null;
        }

        $fromExpr = $query->getFromExpression();

        if (!$fromExpr) {
            throw new Exception('From expression missing.');
        }

        $tablet = $this->tablet->getTablet();
        $schemaCmd = new GetSchema($tablet->getAlias());
        /* @var $result GetSchemaResult */
        $result = $this->client->executeCommand($schemaCmd);

        return new FullColumnsFrom($result, $fromExpr);
    }
1065982
public function process(QueryInterface $query)
    {
        if (!$query instanceof ShowQuery || $query->getObject() !== ShowQuery::EXPRESSION_DATABASES) {
            return null;
        }

        $command = new GetKeyspaces();
        /* @var $vtCtldResult GetKeyspacesResult */
        $vtCtldResult = $this->client->executeCommand($command);

        return new Databases($vtCtldResult);
    }
582766
protected function setPageFrom( QueryInterface $query )
    {
        if ( $this->pageFromPk )
        {
            $class = $this->query->modelClass;
            $pks = $class::primaryKey();
            if ( count($pks) > 1) {
                throw new NotSupportedException('The "page-from-pk" filter can not be apply for composite primary key.');
            }
            $query->andWhere(['<', $pks[0], $this->pageFromPk]);
        }
        return $query;
    }
600769
public function execute(
        Query $query,
        MapInterface $variables
    ): SetInterface {
        return ($this->makeEntity)(
            $this->connection->execute($query),
            $variables
        );
    }
1023759
public function exec($query)
    {
        try {
            $this->connection->exec($query);
        } catch (DBALException $e) {
            throw new QueryException($e->getMessage(), $e->getCode(), $e);
        }
    }
647158
final public function handle(Query $query): DTO
    {
        $supportedQueryType = $this->getSupportedQueryType();
        if (!\is_a($query, $supportedQueryType)) {
            throw new InvalidQueryException(\sprintf(
                'Query command must be a %s, %s given',
                $supportedQueryType,
                \get_class($query)
            ));
        }

        return $this->handleQuery($query);
    }
913421
public function send(RequestInterface $request)
    {
        $apiResponse = null;

        try {
            $apiResponse = $this->loadResponse($request);

            if ($apiResponse->ok()) {
                return $apiResponse;
            } else {
                throw new Exception('Response has unsuccessful status');
            }
        } catch (Exception $e) {
            // The following means that request failed completely
            if (empty($apiResponse)) {
                $apiResponse = new ApiResponse($request);
            }

            throw new ApiException($apiResponse, $e);
        }
    }
290931
private function getResult(BaseQueryObjectInterface $queryObject, Query $query, $isSelect)
    {
        if ($queryObject instanceof SingleScalarResultQueryObjectInterface) {
            return $query->getSingleScalarResult();
        } elseif ($queryObject instanceof ScalarResultQueryObjectInterface) {
            return $query->getScalarResult();
        } elseif ($queryObject instanceof SingleResultQueryObjectInterface) {
            return $query->getOneOrNullResult();
        } elseif ($isSelect && (null !== $query->getMaxResults() || null !== $query->getFirstResult())) {
            return \iterator_to_array(new Paginator($query, true));
        }
        return $query->getResult();
    }
449416
public function queryWith(QueryInterface $query)
    {
        $this->query($query);
        $queryBuilder = $query->build();

        return $this->findWith($queryBuilder);
    }
1138914
public function selectOne($query, $bindings = [])
    {
        $start = $this->getLogTime();

        try {

            $result = $this->wpdb->get_row($this->bindParams($query, $bindings));

            if ($result === false || $this->wpdb->last_error) {
                throw new QueryException($query, $bindings, new \Exception($this->wpdb->last_error));
            }

            return $result;

        } catch (QueryException $e) {
            throw $e;
        } finally {
            $this->logQuery($query, $bindings, $this->getElapsedTime($start));
        }
    }
922055
public function executeRead(QueryInterface $query, array $params = [])
    {
        $cursor = null;

        try {
            $reader = $this->connection;
            $tabletType = $this->clusterConfig->getReadFrom();

            if ($this->isInTransaction()) {
                $reader = $this->getTransaction();
                $tabletType = TabletType::MASTER;
            }

            $cursor = $reader->execute($this->ctx, $query->getSql(), $params, $tabletType);
        } catch (VitessException $e) {
            $this->handleException($e);

            return new Result(null, $e);
        }

        return new Result(new Cursor($cursor));
    }
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;
	}
694091
protected function exec($query)
    {
        try {
            Connect::getConn()->exec($query);
        } catch (Exception $e) {
            static::$response["status"] = "error";
            static::$response["response"] = $e->getMessage();
            static::$response["code"] = $e->getCode();

            return static::terminate(static::$response);
        }
        return null;
    }
569319
public function getResult(QueryInterface $query)
    {
        $vtCtldResult = $this->client->getVSchema();
        $cursor = new Cursor($vtCtldResult->getData(), $vtCtldResult->getFields());

        return new Result($cursor);
    }
939890
public function buildQuery(QueryInterface $query)
    {
        $searchQuery = false;
        $builder     = $this->getBuilder($query);

        if ($builder !== null) {
            $searchQuery = $builder->buildQuery($query);
        }

        return $searchQuery;
    }
1047596
protected function getResults($query)
    {
         $searchFields = ($this->getSearchFields() ?: singleton($this->sourceObject)->stat('searchable_fields'));

        if(!$searchFields) {
            throw new Exception(
                sprintf('HasOneAutocompleteField: No searchable fields could be found for class "%s"',
                $this->sourceObject));
        }

        $params = [];
        $sort = [];
        
        foreach($searchFields as $searchField) {
            $name = (strpos($searchField, ':') !== FALSE) ? $searchField : "$searchField:PartialMatch:nocase";
            $params[$name] = $query;
            $sort[$searchField] = "ASC";
        }

        $results = DataList::create($this->sourceObject)
            ->filterAny($params)
            ->sort($sort)
            ->limit($this->getResultsLimit());

        return $results;
    }
5277
protected function executeQuery($query)
        {
            $res = @odbc_exec($this->_lnk, $query);
            if(!$res) {
                $error = odbc_errormsg($this->_lnk);
                $this->log('Query failed: '.$error);
                throw new Exception('Executing query failed ' . $error, self::QUERY_FAILED);
            }
            return $res;
        }