Module odi

Data Types

error()

error() = {error, [{ExceptionClass::binary(), ExceptionMessage::binary()}]}

Result type for an error

fetched_record()

fetched_record() = {Key::true | rid(), document, Version::integer(), Class::string(), Data::#{}} | {Key::true | rid(), raw, Version::integer(), Class::raw, Data::binary()}

The result of a record fetch

mode()

mode() = sync | async | no_response

record()

record() = {Class::string(), Data::#{string() => any()}}

record_type()

record_type() = raw | flat | document

rid()

rid() = {ClusterId::integer(), ClusterPosition::integer()}

A record ID

tx_operation()

tx_operation() = {update, Rid::rid(), RecordType::record_type(), Version::integer(), UpdateContent::boolean(), Record::record()} | {delete, Rid::rid(), RecordType::record_type(), Version::integer()} | {create, Rid::rid(), RecordType::record_type(), Record::record()}

A transaction operation

Function Index

close/1Close the connection.
command/2Syncronous SQL command.
command/4Syncronous SQL command with parameters.
connect/4Connect to a server.
datacluster_add/3Add a new data cluster.
datacluster_remove/2Remove a cluster.
db_close/1Closes the database and the network connection to the OrientDB Server instance.
db_countrecords/1Asks for the number of records in a database in the OrientDB Server instance.
db_create/5Creates a database in the remote OrientDB server instance.
db_delete/3Removes a database from the OrientDB Server instance.
db_exist/3Asks if a database exists in the OrientDB Server instance.
db_open/5Open a database.
db_reload/1Reloads database information.
db_size/1Returns size of the opened database.
live_query/3Live SELECT query.
live_query/4Live SELECT query with parameters.
query/4SQL query (SELECT or TRAVERSE).
query/5SQL query with parameters (SELECT or TRAVERSE).
record_create/5Create a new record.
record_delete/4Delete a record by its RecordID.
record_load/4Load a record by RecordID, according to a fetch plan.
record_update/6Update a record.
record_update/7Update a record.
script/3Syncronous script.
script/5Syncronous script with parameters.
tx_commit/4Commits a transaction.

Function Details

close/1

close(C::pid()) -> ok

Close the connection.

command/2

command(C::pid(), SQL::string()) -> [fetched_record()] | error()

Syncronous SQL command.

command/4

command(C::pid(), SQL::string(), SimpleParams::#{string() => any()} | null, ComplexParams::#{string() => {embedded_list, []}} | null) -> [fetched_record()] | error()

Syncronous SQL command with parameters.

connect/4

connect(Host::string(), Username::string(), Password::string(), Opts::[{timeout, Timeout::integer()} | {port, Port::integer()}]) -> {ok, Con::pid()} | error()

Connect to a server.

This is the first operation requested by the client when it needs to work with the server instance without openning a database.

datacluster_add/3

datacluster_add(C::pid(), Name::string(), ClusterId::integer()) -> integer() | error()

Add a new data cluster.

datacluster_remove/2

datacluster_remove(C::pid(), ClusterId::integer()) -> boolean() | error()

Remove a cluster.

db_close/1

db_close(C::pid()) -> {stop, closed}

Closes the database and the network connection to the OrientDB Server instance.

db_countrecords/1

db_countrecords(C::pid()) -> integer() | error()

Asks for the number of records in a database in the OrientDB Server instance.

db_create/5

db_create(C::pid(), DatabaseName::string(), DatabaseType::string(), StorageType::string(), BackupPath::string()) -> ok | error()

Creates a database in the remote OrientDB server instance.

Works in connect-mode.

db_delete/3

db_delete(C::pid(), DatabaseName::string(), StorageType::string()) -> ok | error()

Removes a database from the OrientDB Server instance.

Works in connect-mode.

db_exist/3

db_exist(C::pid(), DatabaseName::string(), StorageType::string()) -> boolean() | error()

Asks if a database exists in the OrientDB Server instance.

It returns true (non-zero) or false (zero). Works in connect-mode.

db_open/5

db_open(Host::string(), Dbname::string(), Username::string(), Password::string(), Opts::[{timeout, Timeout::integer()} | {port, Port::integer()}]) -> {Clusters::[{ClusterName::string(), ClusterId::integer()}], Con::pid()} | error()

Open a database

This is the first operation the client should call. It opens a database on the remote OrientDB Server.

db_reload/1

db_reload(C::pid()) -> [{ClusterName::string(), ClusterId::integer()}] | error()

Reloads database information.

db_size/1

db_size(C::pid()) -> integer() | error()

Returns size of the opened database.

live_query/3

live_query(C::pid(), SQL::string(), CallBack::fun((live | live_unsubscription, {loaded | updated | deleted | created, fetched_record()} | {}) -> any())) -> {ok, Token::integer()} | error()

Live SELECT query.

live_query/4

live_query(C::pid(), SQL::string(), Params::#{string() => any()} | null, CallBack::fun((live, {loaded | updated | deleted | created, fetched_record()}) -> any())) -> {ok, Token::integer()} | error()

Live SELECT query with parameters.

query/4

query(C::pid(), SQL::string(), Limit::integer(), FetchPlan::string() | default) -> {Results::[fetched_record()], Cached::[fetched_record()]} | error()

SQL query (SELECT or TRAVERSE).

query/5

query(C::pid(), SQL::string(), Limit::integer(), FetchPlan::string() | default, Params::#{string() => any()} | null) -> {Results::[fetched_record()], Cached::[fetched_record()]} | error()

SQL query with parameters (SELECT or TRAVERSE).

record_create/5

record_create(C::pid(), ClusterId::integer(), RecordContent::binary(), RecordType::record_type(), Mode::mode()) -> {ClusterId::integer(), ClusterPosition::integer(), RecordVersion::integer(), [{Uuid::integer(), UpdatedFileId::integer(), UpdatePageIndex::integer(), UpdatedPageOffset::integer()}]} | error()

Create a new record.

Returns the position in the cluster of the new record.

record_delete/4

record_delete(C::pid(), RID::rid(), RecordVersion::integer(), Mode::mode()) -> boolean() | error()

Delete a record by its RecordID.

record_load/4

record_load(C::pid(), X2::{ClusterId::integer(), RecordPosition::integer()}, FetchPlan::string() | default, IgnoreCache::boolean()) -> [fetched_record()] | error()

Load a record by RecordID, according to a fetch plan.

record_update/6

record_update(C::pid(), RID::rid(), UpdateContent::boolean(), Record::record(), OldRecordVersion::integer(), Mode::mode()) -> {RecordVersion::integer(), [{Uuid::integer(), UpdatedFileId::integer(), UpdatePageIndex::integer(), UpdatedPageOffset::integer()}]} | error()

Update a record. Returns the new record's version.

record_update/7

record_update(C::pid(), RID::rid(), UpdateContent::boolean(), Record::binary(), OldRecordVersion::integer(), RecordType::record_type(), Mode::mode()) -> {OldRecordVersion::integer(), [{Uuid::integer(), UpdatedFileId::integer(), UpdatePageIndex::integer(), UpdatedPageOffset::integer()}]} | error()

Update a record. Returns the new record's version.

script/3

script(C::pid(), Language::string(), Code::string()) -> {[fetched_record()], [fetched_record()]} | error()

Syncronous script.

script/5

script(C::pid(), Language::string(), Code::string(), SimpleParams::#{string() => any()} | null, ComplexParams::#{string() => {embedded_list, []}} | null) -> {[fetched_record()], [fetched_record()]} | error()

Syncronous script with parameters.

tx_commit/4

tx_commit(C::pid(), TxId::integer(), UsingLog::boolean(), Operations::[tx_operation()]) -> {CreatedRecords::[{ClientSpecifiedRid::rid(), ActualRid::rid()}], UpdatedRecords::[{UpdatedRid::rid(), NewRecordVersion::integer()}], CollectionChanges::[{Uuid::number(), UpdatedFileId::number(), UpdatedPageIndex::number(), UpdatedPageOffset::number()}]} | error()

Commits a transaction.

This operation flushes all the given changes to the server side in a single transaction.


Generated by EDoc