@ When ( "^I execute a query over fields '(.+?)' with schema '(.+?)' of type '(json|string)' with magic_column '(.+?)' from table: '(.+?)' using keyspace: '(.+?)' with:$" ) public void sendQueryOfType ( String fields , String schema , String type , String magic_column , String table , String keyspace , DataTable modifications ) { try { commonspec . setResultsType ( "cassandra" ) ; commonspec . getCassandraClient ( ) . useKeyspace ( keyspace ) ; commonspec . getLogger ( ) . debug ( "Starting a query of type " + commonspec . getResultsType ( ) ) ; String query = "" ; if ( schema . equals ( "empty" ) && magic_column . equals ( "empty" ) ) { query = "SELECT " + fields + " FROM " + table + ";" ; } else if ( ! schema . equals ( "empty" ) && magic_column . equals ( "empty" ) ) { String retrievedData = commonspec . retrieveData ( schema , type ) ; String modifiedData = commonspec . modifyData ( retrievedData , type , modifications ) . toString ( ) ; query = "SELECT " + fields + " FROM " + table + " WHERE " + modifiedData + ";" ; } else { String retrievedData = commonspec . retrieveData ( schema , type ) ; String modifiedData = commonspec . modifyData ( retrievedData , type , modifications ) . toString ( ) ; query = "SELECT " + fields + " FROM " + table + " WHERE " + magic_column + " = '" + modifiedData + "';" ; } commonspec . getLogger ( ) . debug ( "query: {}" , query ) ; com . datastax . driver . core . ResultSet results = commonspec . getCassandraClient ( ) . executeQuery ( query ) ; commonspec . setCassandraResults ( results ) ; } catch ( Exception e ) { commonspec . getLogger ( ) . debug ( "Exception captured" ) ; commonspec . getLogger ( ) . debug ( e . toString ( ) ) ; commonspec . getExceptions ( ) . add ( e ) ; } }
Execute a query with schema over a cluster