Module: OrientdbBinary::DatabaseOperations::Query

Included in:
OrientdbBinary::Database
Defined in:
lib/orientdb_binary/database_operations/query.rb

Instance Method Summary collapse

Instance Method Details

#command(text, params = {}) ⇒ Object

def script(text)

class_name = 'com.orientechnologies.orient.core.sql.OCommandSQL'

end



19
20
21
22
23
24
25
26
27
# File 'lib/orientdb_binary/database_operations/query.rb', line 19

def command(text, params={})
  class_name = 'com.orientechnologies.orient.core.sql.OCommandSQL'
  fetch_plan = nil
  serialized_params = OrientdbBinary::Parser::Serializer.new.serialize_document({params: params})
  q = OrientdbBinary::Protocols::SqlCommandPayload.new text: text, serialized_params: serialized_params,
                                                      fetch_plan: fetch_plan,
                                                      class_name: class_name
  _command(q.to_binary_s, class_name)
end

#query(text, params, fetch_plan = "*:0") ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/orientdb_binary/database_operations/query.rb', line 6

def query(text, params, fetch_plan="*:0")
  class_name = 'com.orientechnologies.orient.core.sql.query.OSQLSynchQuery'
  serialized_params = OrientdbBinary::Parser::Serializer.new.serialize_document({params: params})
  q = OrientdbBinary::Protocols::SqlCommandPayload.new text: text, serialized_params: serialized_params,
                                                      fetch_plan: fetch_plan,
                                                      class_name: class_name
  _command(q.to_binary_s, class_name)
end