/** * Execute. * * @param <T> * the generic type * @param query * the query * @param connection * the connection * @return the t */ 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); } }
cassandra_client.set_cql_version(CassandraConstants.CQL_VERSION_3_0); cassandra_client.set_keyspace(databaseName); MetaDataHandler handler = new MetaDataHandler();
try { if (cqlVersion != null) { cassandra.set_cql_version(cqlVersion);
cassandra_client.set_cql_version(CassandraConstants.CQL_VERSION_3_0); cassandra_client.set_keyspace(databaseName); cassandra_client.execute_cql3_query(
try { if (cqlVersion != null) { cassandra.set_cql_version(cqlVersion);
cassandraClient.set_keyspace(op.getKeyspace()); if (asConfig.getCqlVersion() != null) cassandraClient.set_cql_version(asConfig.getCqlVersion()); keyspaceName = op.getKeyspace(); long now = System.nanoTime();
cassandraClient.set_keyspace(op.getKeyspace()); if (asConfig.getCqlVersion() != null) cassandraClient.set_cql_version(asConfig.getCqlVersion()); keyspaceName = op.getKeyspace(); long now = System.nanoTime();
/** * Returns raw cassandra client from thrift connection pool. * * @param persistenceUnit * persistence unit. * @param schema * schema or keyspace. * @return raw cassandra client. */ protected Cassandra.Client getRawClient(final String persistenceUnit, final String schema) { Cassandra.Client client = null; Object pooledConnection; pooledConnection = getConection(); client = getConnection(pooledConnection); try { client.set_cql_version(getCqlVersion()); } catch (Exception e) { log.error("Error during borrowing a connection for persistence unit {}, Caused by: .", persistenceUnit, e); throw new KunderaException(e); } finally { releaseConnection(pooledConnection); } return client; }
/** @deprecated Remove once Cassandra 1.1 support is no longer necessary. */ public void executeCql3Script_1_1(String script) { try { _client.set_cql_version(CQL_VERSION); for (String cqlStatement : toCqlStatements(script)) { if (StringUtils.isNotBlank(cqlStatement)) { cqlStatement += ";"; _log.info("executing cql statement: " + cqlStatement); _client.execute_cql_query(ByteBuffer.wrap(cqlStatement.getBytes("UTF-8")), Compression.NONE); } } } catch (Exception e) { throw Throwables.propagate(e); } }
translator.ensureCase(builder, tableInfo.getTableName(), false); builder.append("LIMIT 1"); cassandra_client.set_cql_version(CassandraConstants.CQL_VERSION_3_0); CqlResult cqlResult = cassandra_client.execute_cql3_query(ByteBufferUtil.bytes(builder.toString()), Compression.NONE, ConsistencyLevel.ONE);
getClient().set_cql_version("3.0.0"); getClient().set_keyspace(keyspaceName); getClient().execute_cql3_query(ByteBuffer.wrap(cqlQuery.getBytes("UTF-8")), Compression.NONE,
getClient().set_cql_version("3.0.0"); getClient().set_keyspace(keyspaceName); getClient().execute_cql3_query(ByteBuffer.wrap(cqlQuery.getBytes("UTF-8")), Compression.NONE,
/** * Returns raw cassandra client from thrift connection pool. * * @param schema * schema or keyspace. * @return raw cassandra client. */ public Cassandra.Client getRawClient(final String schema) { Cassandra.Client client = null; Object pooledConnection; pooledConnection = getConnection(); client = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection); try { client.set_cql_version(getCqlVersion()); } catch (Exception e) { log.error("Error during borrowing a connection , Caused by: {}.", e); throw new KunderaException(e); } finally { releaseConnection(pooledConnection); } return client; }