Integer statementId = computeThriftId(queryString, keyspace); thriftPreparedStatements.put(statementId, prepared); return ResultMessage.Prepared.forThrift(statementId, prepared.boundNames); preparedStatements.put(statementId, prepared); SystemKeyspace.writePreparedStatement(keyspace, statementId, queryString); return new ResultMessage.Prepared(statementId, prepared);
public CqlPreparedResult prepare_cql3_query(ByteBuffer query, Compression compression) throws InvalidRequestException, TException { if (logger.isDebugEnabled()) logger.debug("prepare_cql3_query"); validateCQLVersion(3); String queryString = uncompress(query, compression); ThriftClientState cState = state(); try { cState.validateLogin(); return cState.getCQLQueryHandler().prepare(queryString, cState.getQueryState()).toThriftPreparedResult(); } catch (RequestValidationException e) { throw ThriftConversion.toThrift(e); } }
Integer statementId = computeThriftId(queryString, keyspace); thriftPreparedStatements.put(statementId, prepared); return ResultMessage.Prepared.forThrift(statementId, prepared.boundNames); preparedStatements.put(statementId, prepared); SystemKeyspace.writePreparedStatement(keyspace, statementId, queryString); return new ResultMessage.Prepared(statementId, prepared);
Integer statementId = computeThriftId(queryString, keyspace); thriftPreparedStatements.put(statementId, prepared); return ResultMessage.Prepared.forThrift(statementId, prepared.boundNames); preparedStatements.put(statementId, prepared); SystemKeyspace.writePreparedStatement(keyspace, statementId, queryString); return new ResultMessage.Prepared(statementId, prepared);
private static ResultMessage.Prepared storePreparedStatement(String queryString, String keyspace, ParsedStatement.Prepared prepared, boolean forThrift) throws InvalidRequestException { // Concatenate the current keyspace so we don't mix prepared statements between keyspace (#5352). // (if the keyspace is null, queryString has to have a fully-qualified keyspace so it's fine. long statementSize = measure(prepared.statement); // don't execute the statement if it's bigger than the allowed threshold if (statementSize > MAX_CACHE_PREPARED_MEMORY) throw new InvalidRequestException(String.format("Prepared statement of size %d bytes is larger than allowed maximum of %d bytes.", statementSize, MAX_CACHE_PREPARED_MEMORY)); if (forThrift) { Integer statementId = computeThriftId(queryString, keyspace); thriftPreparedStatements.put(statementId, prepared); return ResultMessage.Prepared.forThrift(statementId, prepared.boundNames); } else { MD5Digest statementId = computeId(queryString, keyspace); preparedStatements.put(statementId, prepared); return new ResultMessage.Prepared(statementId, prepared); } }
private static ResultMessage.Prepared getStoredPreparedStatement(String queryString, String keyspace, boolean forThrift) throws InvalidRequestException { if (forThrift) { Integer thriftStatementId = computeThriftId(queryString, keyspace); ParsedStatement.Prepared existing = thriftPreparedStatements.get(thriftStatementId); if (existing == null) return null; checkTrue(queryString.equals(existing.rawCQLStatement), String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement)); return ResultMessage.Prepared.forThrift(thriftStatementId, existing.boundNames); } else { MD5Digest statementId = computeId(queryString, keyspace); ParsedStatement.Prepared existing = preparedStatements.get(statementId); if (existing == null) return null; checkTrue(queryString.equals(existing.rawCQLStatement), String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement)); return new ResultMessage.Prepared(statementId, existing); } }
private static ResultMessage.Prepared getStoredPreparedStatement(String queryString, String keyspace, boolean forThrift) throws InvalidRequestException { if (forThrift) { Integer thriftStatementId = computeThriftId(queryString, keyspace); ParsedStatement.Prepared existing = thriftPreparedStatements.get(thriftStatementId); if (existing == null) return null; checkTrue(queryString.equals(existing.rawCQLStatement), String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement)); return ResultMessage.Prepared.forThrift(thriftStatementId, existing.boundNames); } else { MD5Digest statementId = computeId(queryString, keyspace); ParsedStatement.Prepared existing = preparedStatements.get(statementId); if (existing == null) return null; checkTrue(queryString.equals(existing.rawCQLStatement), String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement)); return new ResultMessage.Prepared(statementId, existing); } }
private static ResultMessage.Prepared getStoredPreparedStatement(String queryString, String keyspace, boolean forThrift) throws InvalidRequestException { if (forThrift) { Integer thriftStatementId = computeThriftId(queryString, keyspace); ParsedStatement.Prepared existing = thriftPreparedStatements.get(thriftStatementId); if (existing == null) return null; checkTrue(queryString.equals(existing.rawCQLStatement), String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement)); return ResultMessage.Prepared.forThrift(thriftStatementId, existing.boundNames); } else { MD5Digest statementId = computeId(queryString, keyspace); ParsedStatement.Prepared existing = preparedStatements.get(statementId); if (existing == null) return null; checkTrue(queryString.equals(existing.rawCQLStatement), String.format("MD5 hash collision: query with the same MD5 hash was already prepared. \n Existing: '%s'", existing.rawCQLStatement)); return new ResultMessage.Prepared(statementId, existing); } }
private static ResultMessage.Prepared getStoredPreparedStatement(String queryString, String keyspace, boolean forThrift) throws InvalidRequestException { if (forThrift) { Integer thriftStatementId = computeThriftId(queryString, keyspace); ParsedStatement.Prepared existing = thriftPreparedStatements.get(thriftStatementId); return existing == null ? null : ResultMessage.Prepared.forThrift(thriftStatementId, existing.boundNames); } else { MD5Digest statementId = computeId(queryString, keyspace); ParsedStatement.Prepared existing = preparedStatements.get(statementId); return existing == null ? null : new ResultMessage.Prepared(statementId, existing); } }
public CqlPreparedResult prepare_cql3_query(ByteBuffer query, Compression compression) throws TException { logger.trace("prepare_cql3_query"); String queryString = uncompress(query, compression); ThriftClientState cState = state(); try { cState.validateLogin(); return ClientState.getCQLQueryHandler().prepare(queryString, cState.getQueryState(), null).toThriftPreparedResult(); } catch (RequestValidationException e) { throw ThriftConversion.toThrift(e); } }
public CqlPreparedResult prepare_cql3_query(ByteBuffer query, Compression compression) throws TException { logger.trace("prepare_cql3_query"); String queryString = uncompress(query, compression); ThriftClientState cState = state(); try { cState.validateLogin(); return ClientState.getCQLQueryHandler().prepare(queryString, cState.getQueryState(), null).toThriftPreparedResult(); } catch (RequestValidationException e) { throw ThriftConversion.toThrift(e); } }
public static Prepared forThrift(int statementId, List<ColumnSpecification> names) { return new Prepared(null, statementId, new ResultSet.PreparedMetadata(names, null), ResultSet.ResultMetadata.EMPTY); }
public static Prepared forThrift(int statementId, List<ColumnSpecification> names) { return new Prepared(null, statementId, new ResultSet.Metadata(names), ResultSet.Metadata.EMPTY); }
public Prepared(MD5Digest statementId, ParsedStatement.Prepared prepared) { this(statementId, -1, new ResultSet.Metadata(prepared.boundNames), extractResultMetadata(prepared.statement)); }
public Prepared(MD5Digest statementId, ParsedStatement.Prepared prepared) { this(statementId, -1, new ResultSet.PreparedMetadata(prepared.boundNames, prepared.partitionKeyBindIndexes), extractResultMetadata(prepared.statement)); }
public Prepared(MD5Digest statementId, ParsedStatement.Prepared prepared) { this(statementId, -1, new ResultSet.PreparedMetadata(prepared.boundNames, prepared.partitionKeyBindIndexes), extractResultMetadata(prepared.statement)); }
public Prepared(MD5Digest statementId, ParsedStatement.Prepared prepared) { this(statementId, -1, new ResultSet.PreparedMetadata(prepared.boundNames, prepared.partitionKeyBindIndexes), extractResultMetadata(prepared.statement)); }
public static Prepared forThrift(int statementId, List<ColumnSpecification> names) { return new Prepared(null, statementId, new ResultSet.PreparedMetadata(names, null), ResultSet.ResultMetadata.EMPTY); }
public ResultMessage.Prepared prepare(String query, QueryState state, Map<String, ByteBuffer> customPayload) { ResultMessage.Prepared prepared = queryProcessor.prepare(query, state, customPayload); prepared.setCustomPayload(customPayload); return prepared; }
public static Prepared forThrift(int statementId, List<ColumnSpecification> names) { return new Prepared(null, statementId, new ResultSet.PreparedMetadata(names, null), ResultSet.ResultMetadata.EMPTY); }