Class: OrientDbClient::Protocols::Protocol9
- Inherits:
-
Protocol7
- Object
- Protocol7
- OrientDbClient::Protocols::Protocol9
show all
- Defined in:
- lib/orient_db_client/protocols/protocol9.rb
Defined Under Namespace
Modules: Commands
Constant Summary
collapse
- VERSION =
9
Constants inherited
from Protocol7
OrientDbClient::Protocols::Protocol7::COMMAND_CLASS, OrientDbClient::Protocols::Protocol7::DRIVER_NAME, OrientDbClient::Protocols::Protocol7::DRIVER_VERSION, OrientDbClient::Protocols::Protocol7::NEW_SESSION, OrientDbClient::Protocols::Protocol7::QUERY_CLASS
Class Method Summary
collapse
-
.command(socket, session, command, options = {}) ⇒ Object
-
.db_create(socket, session, database, options = {}) ⇒ Object
-
.db_open(socket, database, options = {}) ⇒ Object
-
.record_load(socket, session, rid, options = {}) ⇒ Object
Methods inherited from Protocol7
connect, count, datacluster_add, datacluster_datarange, datacluster_remove, db_close, db_countrecords, db_delete, db_exist, db_reload, db_size, deserializer, record_create, record_delete, record_update, serializer, version
Class Method Details
.command(socket, session, command, options = {}) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/orient_db_client/protocols/protocol9.rb', line 52
def self.command(socket, session, command, options = {})
options[:query_class_name].tap do |qcn|
if qcn.is_a?(Symbol)
qcn = case qcn
when :query then 'q'
when :command then 'c'
end
end
if qcn.nil? || qcn == 'com.orientechnologies.orient.core.sql.query.OSQLSynchQuery'
qcn = 'q'
end
options[:query_class_name] = qcn
end
super socket, session, command, options
end
|
.db_create(socket, session, database, options = {}) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/orient_db_client/protocols/protocol9.rb', line 71
def self.db_create(socket, session, database, options = {})
if options.is_a?(String)
options = { :storage_type => options }
end
options = {
:database_type => 'document'
}.merge(options)
super
end
|
.db_open(socket, database, options = {}) ⇒ Object
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/orient_db_client/protocols/protocol9.rb', line 83
def self.db_open(socket, database, options = {})
command = Commands::DbOpen9.new :protocol_version => self.version,
:database_name => database,
:database_type => options[:database_type] || 'document',
:user_name => options[:user],
:user_password => options[:password]
command.write(socket)
read_response(socket)
{ :session => read_integer(socket),
:message_content => read_db_open(socket) }
end
|
.record_load(socket, session, rid, options = {}) ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/orient_db_client/protocols/protocol9.rb', line 97
def self.record_load(socket, session, rid, options = {})
command = Commands::RecordLoad9.new :session => session,
:cluster_id => rid.cluster_id,
:cluster_position => rid.cluster_position,
:ignore_cache => options[:ignore_cache] === true ? 1 : 0
command.write(socket)
read_response(socket)
{ :session => read_integer(socket),
:message_content => read_record_load(socket) }
end
|