Method: OrientSupport::OrientQuery#compose

Defined in:
lib/support/orientquery.rb

#compose(destination: :batch) ⇒ Object Also known as: to_s

Output the compiled query

Parameter: destination (rest, batch )
If the query is submitted via the REST-Interface (as get-command), the limit parameter is extracted.


390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/support/orientquery.rb', line 390

def compose(destination: :batch)
	if kind.to_sym == :update 
		return_statement = "return after " + ( @q[:aliases].empty? ?  "$current" : @q[:aliases].first.to_s)
		[ 'update', target, set, remove, return_statement , where, limit ].compact.join(' ')
	elsif kind.to_sym == :update!
		[ 'update', target, set,  where, limit, misc ].compact.join(' ')
	elsif kind.to_sym == :create
		[ "CREATE VERTEX", target, set ].compact.join(' ')
	#	[ kind, target, set,  return_statement ,where,  limit, misc ].compact.join(' ')
	elsif kind.to_sym == :upsert 
		return_statement = "return after " + ( @q[:aliases].empty? ?  "$current" : @q[:aliases].first.to_s)
		[ "update", target, set,"upsert",  return_statement , where, limit, misc  ].compact.join(' ')
		#[ kind,  where, return_statement ].compact.join(' ')
	elsif destination == :rest
		[ kind, projection, from, let, where, subquery,  misc, order, group_by, unwind, skip].compact.join(' ')
	else
		[ kind, projection, from, let, where, subquery,  while_s,  misc, order, group_by, limit, unwind, skip].compact.join(' ')
	end
end