module Cassie::Statements::Statement::Relations
Provides support for a set of CQL relations and building the where clause and argument list for a cql statement
CQL Relation
terminology:
"SELECT * FROM table WHERE id = ?", [1]
relation: 'WHERE' identifier: 'id' operation: '=' term: '?' argument: '1'
Public Instance Methods
relations_args()
click to toggle source
a where clause is built up of multiple 'relations'
# File lib/cassie/statements/statement/relations.rb, line 91 def relations_args self.class.relations_args end
Protected Instance Methods
build_where_and_params()
click to toggle source
# File lib/cassie/statements/statement/relations.rb, line 97 def build_where_and_params cql = "" relation_strings = [] arguments = [] relations_args.each do |args| r = Relation.new(self, *args) relation_strings += Array(r.to_cql) arguments << r.argument if r.argument? end cql = "WHERE #{relation_strings.join(' AND ')}" unless relation_strings.empty? # where identifier inequality term AND identifier inequality term; [cql , arguments] end