Executes the given {@link KeyQueryRequest} and returns the response.

@param request
the key query request
@return the query response
974830
public QueryResponse<DatastoreKey> executeKeyQueryRequest(KeyQueryRequest request) {
    try {
      GqlQuery.Builder<Key> queryBuilder = Query.newGqlQueryBuilder(ResultType.KEY,
          request.getQuery());
      queryBuilder.setNamespace(entityManager.getEffectiveNamespace());
      queryBuilder.setAllowLiteral(request.isAllowLiterals());
      QueryUtils.applyNamedBindings(queryBuilder, request.getNamedBindings());
      QueryUtils.applyPositionalBindings(queryBuilder, request.getPositionalBindings());
      GqlQuery<Key> gqlQuery = queryBuilder.build();
      QueryResults<Key> results = nativeReader.run(gqlQuery);
      List<DatastoreKey> entities = new ArrayList<>();
      DefaultQueryResponse<DatastoreKey> response = new DefaultQueryResponse<>();
      response.setStartCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      while (results.hasNext()) {
        Key result = results.next();
        DatastoreKey datastoreKey = new DefaultDatastoreKey(result);
        entities.add(datastoreKey);
      }
      response.setResults(entities);
      response.setEndCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      response.setQueryResponseMetadata(
          new DefaultQueryResponseMetadata(
              QueryResponseMetadata.QueryState.forMoreResultsType(results.getMoreResults())));
      return response;
    } catch (DatastoreException exp) {
      throw new EntityManagerException(exp);
    }
  }
847063
private Response execute(final Builder theRequestBuilder, final String methodKey)
            throws IOException {
        final JaxRsRequest theRequest = theRequestBuilder.build();
        final BaseMethodBinding<?> method = getBinding(theRequest.getRestOperationType(), methodKey);
        try {
            return (Response) method.invokeServer(this, theRequest);
        }
        catch (final Throwable theException) {
            return handleException(theRequest, theException);
        }
    }
73441
public <T> T execute(final String query, Object connection) {
        try {
            org.apache.cassandra.thrift.Cassandra.Client conn =
                (org.apache.cassandra.thrift.Cassandra.Client) connection;
            conn.set_cql_version(CassandraConstants.CQL_VERSION_3_0);
            KunderaCoreUtils.printQuery(query, showQuery);
            return (T) conn.execute_cql3_query(ByteBuffer.wrap(query.getBytes(Constants.CHARSET_UTF8)),
                Compression.NONE, getConsistencyLevel());
        } catch (Exception e) {
            log.error("Error while executing query {}", query);
            throw new KunderaException(e);
        }
    }
331189
private HttpResponse execute( HttpUriRequest request ) throws RestException
    {
        log.debug( ">>>> " + request.getRequestLine() );
        for ( Header header : request.getAllHeaders() )
        {
            log.trace( ">>>> " + header.getName() + ": " + header.getValue() );
        }

        HttpResponse response;
        try
        {
            response = getHttpClient().execute( request );
            log.debug( "<<<< " + response.getStatusLine() );
            for ( Header header : response.getAllHeaders() )
            {
                log.trace( "<<<< " + header.getName() + ": " + header.getValue() );
            }

            if ( response.getStatusLine().getStatusCode() == 204 )
            {
                log.debug( "Consuming quietly the response entity since server returned no content" );
                EntityUtils.consumeQuietly( response.getEntity() );
            }

            checkError( response );
            return response;
        }
        catch ( KeyManagementException | NoSuchAlgorithmException | IOException e )
        {
            throw new RuntimeRestException( e );
        }
        finally
        {
            // https://issues.apache.org/jira/browse/HTTPCLIENT-1523
            DateUtils.clearThreadLocal();
        }
    }
1362000
public HttpResponse execute( final HttpUriRequest request ) throws IOException, ReadOnlyException {
        if ( readOnly ) {
            switch ( request.getMethod().toLowerCase() ) {
                case "copy": case "delete": case "move": case "patch": case "post": case "put":
                    throw new ReadOnlyException();
                default:
                    break;
            }
        }

        return httpClient.execute(request, httpContext);
    }
933983
public ResultSet execute(String keyspace, @NotNull Statement statement) {
        Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE.name());

        getMetricsFactory().getCounter(MetricsType.CASSANDRA_QUERIES_COUNT.name()).inc();

        ResultSet resultSetFuture = getOrCreateSession(keyspace).execute(statement);

        time.stop();

        return resultSetFuture;
    }
815540
public QueryResponse executeQueryPost(Query query) throws ApiException {
        ApiResponse<QueryResponse> resp = executeQueryPostWithHttpInfo(query);
        return resp.getData();
    }
264526
public CommandResponse execute(GwtCommand request) {
		if (request != null) {
			return commandDispatcher.execute(request.getCommandName(), request.getCommandRequest(),
					request.getUserToken(), request.getLocale());
		}
		return null;
	}
406727
private Map<String, String> getQueryParams(Request request) {
        final Map<String, String> queryParams = new HashMap<>();
        request.queryMap().toMap().forEach((k, v) -> {
            queryParams.put(k, v[0]);
        });
        return queryParams;
    }
898921
@Override
    public Response execute(Request request) throws IOException {
        HttpURLConnection connection = openConnection(request);
        sendRequest(connection, request);
        return readResponse(connection);
    }
385238
public SearchTerm searchTerm(ImapRequestLineReader request)
            throws ProtocolException, CharacterCodingException {
        SearchTerm resultTerm = null;
        SearchTermBuilder b = null;
        SearchKey key = null;
	boolean orKey = false;
        boolean negated = false;
        // Dummy implementation
        // Consume to the end of the line.
        char next = request.nextChar();
        StringBuilder sb = new StringBuilder();
        boolean quoted = false;
        Charset charset = null;

        while (next != '\n') {
            if (next != '\"' && (quoted || (next != '\"' && next != CHR_SPACE && next != CHR_CR))) {
                sb.append(next);
            }
            request.consume();
            next = request.nextChar();
            if (next == '\"') {
                quoted = !quoted;
                if (quoted) {
                    continue;
                }
            }
            if (!quoted && (next == CHR_SPACE || next == '\n') && sb.length() > 0) {
                log.debug("Search request is '{}'", sb);
                // Examples:
                // HEADER Message-ID <747621499.0.1264172476711.JavaMail.tbuchert@dev16.int.consol.de> ALL
                // FLAG SEEN ALL
                if (null == b) {
                    try {
                        String keyValue = sb.toString();
                        // Parentheses?
                        if (keyValue.charAt(0) == '('
                                && keyValue.charAt(keyValue.length() - 1) == ')') {
                            keyValue = keyValue.substring(1, keyValue.length() - 1);
                        }

                        // Message set?
                        if (SEQUENCE.matcher(keyValue).matches()) {
                            b = SearchTermBuilder.create(SearchKey.SEQUENCE_SET);

                            // Try to get additional number sequences.
                            // Sequence can be a whitespace separated list of either a number or number range
                            // Example: '2 5:9 9'
                            next = request.nextChar();
                            while (next == CHR_SPACE || Character.isDigit(next) || next == ':') {
                                request.consume();
                                sb.append(next);
                                next = request.nextChar();
                            }
                            b.addParameter(sb.toString());
                        }
                        else if (CHARSET_TOKEN.equals(keyValue)) { // Charset handling
                            request.nextWordChar(); // Skip spaces
                            String c = this.atom(request);
                            log.debug("Searching with given CHARSET <{}>", c);
                            charset = Charset.forName(c);
                        } else {
                            // Term?
                            key = SearchKey.valueOf(keyValue);
                            if (SearchKey.NOT == key) {
                                negated = true;
                            } else {
                                b = SearchTermBuilder.create(key);
                            }

                            if (null!=b && b.expectsParameter() && key.isCharsetAware() && null != charset && next == CHR_SPACE) {
                                next = request.nextWordChar();
                                if (next == '{') {
                                    String textOfCharset = new String(consumeLiteralAsBytes(request), charset);
                                    b.addParameter(textOfCharset);
                                    log.debug("Searching for text <{}> of charset {}", textOfCharset, charset);
                                }
                            }
                        }
                    } catch (IllegalArgumentException ex) {
                        // Ignore for now instead of breaking. See issue#35 .
                        log.warn("Ignoring not yet implemented search command '{}'", sb, ex);
                        negated = false;
                    }
                } else if (b.expectsParameter()) {
                    if (b.isCharsetAware() && null != charset) {
                        request.consume(); // \n
                        next = request.nextChar();
                        final Integer capacity = Integer.valueOf(sb.substring(1, sb.length() - 1));
                        ByteBuffer bb = ByteBuffer.allocate(capacity);
                        while (next != CHR_CR) {
                            request.consume(); // \n
                            sb.append(next);
                            next = request.nextChar();
                        }
                        final String decoded = charset.decode(bb).toString();
                        log.info("Decoded <{}> into <{}>", bb, decoded);
                        b = b.addParameter(decoded);
                    } else {
                        b = b.addParameter(sb.toString());
                    }
                }
                if (b != null && !b.expectsParameter()) {
                    SearchTerm searchTerm = b.build();
                    if (negated) {
                        searchTerm = new NotTerm(searchTerm);
                        negated = false;
                    }
                    b = null;
					if (SearchKey.OR == key) {
					resultTerm = resultTerm == null ? searchTerm : new OrTerm(resultTerm, searchTerm);
					orKey = true;
					} else {
						if (orKey) {
							if (SearchKey.ALL == key) {
                    resultTerm = resultTerm == null ? searchTerm : new AndTerm(resultTerm, searchTerm);

							} else {
								resultTerm = resultTerm == null ? searchTerm : new OrTerm(resultTerm, searchTerm);
							}
						} else {
							resultTerm = resultTerm == null ? searchTerm : new AndTerm(resultTerm, searchTerm);
						}
					}                }
                sb.setLength(0);
                next = request.nextChar();
            }
        }
        return resultTerm;
    }
844084
public ApiResponse<Integer> executeDeletePostWithHttpInfo(Query query) throws ApiException {
        com.squareup.okhttp.Call call = executeDeletePostValidateBeforeCall(query, null, null);
        Type localVarReturnType = new TypeToken<Integer>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
1133526
public <Result> Result call(TDApiRequest apiRequest, Optional<String> apiKeyCache, final Function<InputStream, Result> contentStreamHandler)
    {
        return submitRequest(apiRequest, apiKeyCache, newByteStreamHandler(contentStreamHandler));
    }
740599
@Override
  public final void executeQuery(final String pQuery) throws Exception {
    try {
      if (getLogger().getIsShowDebugMessagesFor(getClass())
        && getLogger().getDetailLevel() > 30000) {
        getLogger().debug(null, SrvDatabase.class, "try to execute query: "
          + pQuery);
      }
      this.sqliteDatabase.execSQL(pQuery);
    } catch (Exception ex) {
      String msg = ex.getMessage() + ", query:\n" + pQuery;
      ExceptionWithCode ewc = new ExceptionWithCode(SrvDatabase.SQL_EXEC_ERROR,
        msg);
      ewc.setStackTrace(ex.getStackTrace());
      throw ewc;
    }
  }
31390
protected RestResponse performRequest(final HttpUriRequest request) throws IOException, AppPlatformException {

        if (this.usersUri == null || this.usersUri.isEmpty()
                || this.token == null || this.token.isEmpty()
                || this.secret == null || this.secret.isEmpty()) {

            throw new MissingCredentialsException();
        }

        RestResponse restResponse = RestResponse.createRestResponse(httpClient.execute(request));

        if (restResponse.getStatus() >= 400) {
            throw new AppPlatformException(restResponse.getResponseText(), restResponse.getStatus());
        }

        return restResponse;
    }
1120925
private HttpResponse executeRequest(HttpPost request) throws Exception {
        try {
            HttpClient httpClient = connection.getHttpClient();
            HttpContext httpContext = connection.getHttpContext();
            HttpResponse response = httpClient.execute(request, httpContext);
            return response;
        } catch (Exception e) {
            throw MwsUtl.wrap(e);
        }
    }
899283
private void addQueryParams(final Request request) {
        if (end != null) {
            request.addQueryParam("End", end);
        }

        if (start != null) {
            request.addQueryParam("Start", start);
        }
    }