Assure1::OrientDB::Client Perl library

Description

Implements the client methods that are needed in order to to interact with the OrientDB.

Synopsis

use Assure1::OrientDB::Client;

my $odb = Assure1::OrientDB::Client->new(
    host     => '<host>'
    port     => '<port>'
);
$odb->connect(
    database => '<database>',
);
my $dbInfo = $odb->getDatabaseInfo();

Methods

appendOperation

Append operation to current transaction. Valid types: c|CREATE, u|UPDATE, d|DELETE, cmd|COMMAND, script|SCRIPT. Create requires paramameter: @class. Update and delete require parameter: @rid. Command and script support optional parameter: language (defaults to sql).

appendOperation($type, $params)

appendOperation($type, $params, [$params])

appendOperation($type, $script, [$params])

Synopsis

$odb->appendOperation('create', {
    '@class' => 'City',
    name     => 'Venice'
});
$odb->appendOperation('update', {
    '@rid'  => '#14:122',
    name    => 'Luca',
    vehicle => 'Car'
});
$odb->appendOperation('delete', {
    '@rid' => '#14:100'
});
$odb->appendOperation('command', 'CREATE EDGE Friend FROM #10:33 to #11:33');
$odb->appendOperation('script', [
    q{LET account = CREATE VERTEX Account SET name = 'Luke'},
    q{LET city = SELECT FROM City WHERE name = 'London'},
    q{CREATE EDGE Lives FROM $account TO $city RETRY 100}
]);

beginTransaction

Begin transaction by clearing out any existing operations.

command

Execute a command against the database. Returns the records affected or the list of records for queries. Optional parameters: database, fetchPlan (default *:1), language (default sql), limit (default 20), queryParams.

command($command, [$params])

Synopsis

$odb->command(q{SELECT FROM V WHERE name = 'Test' AND city = 'Rome'}, {
    limit => 1000
});
$odb->command(q{INSERT INTO TestV1 SET Name = :name}, {
    queryParams => {
        name => 'Test'
    }
});

commit

Executes a batch of operations in a single call. This is useful to reduce network latency issuing multiple commands as multiple requests. Optional parameter: database.

commit($params)

connect

Connect to database. Required parameter: database.

connect(\%params)

Params

Database -> Name of database (e.g. Graph)

Synopsis

$odb->connect({
    database => 'Graph'
});

disconnect

Disconnect from database.

error

Return the last error.

getClassInfo

Gets information about requested class. Required parameter: class.

getClassInfo(\%params)

Params

class -> Name of class

Synopsis

$odb->getClassInfo({
    class => 'test'
});

getCluster

Gets information about requested cluster. Required parameter: name. Optional parameter: database.

getCluster(\%params)

Params

name -> Name of cluster

Synopsis

$odb->getCluster({
    name => 'Address'
});

getDatabaseInfo

Gets information about requested database. Required parameter: database.

getDatabaseInfo(\%params)

Params

Database -> Name of database (e.g. Graph)

Synopsis

$odb->getDatabaseInfo({
    database => 'Graph'
});