NAME

Tamino - Pure Perl Tamino XML DB driver

SYNOPSIS

use Tamino;

my $tamino_client = Tamino->new(
    server      => '127.0.0.1/tamino'
    db          => 'mydb'
);

my $t = $tamino_client->begin_tran
    or die $tamino_client->error;
    
$c = $t->xquery_cursor(q{
    for $x in collection('mycollection')/doctype/xxx[@yyy=%s][zzz='%s']
    return $x
}, "('y1','y2')", "z1") or die $t->error;

while($xml_bare_simple_tree = $c->fetch) {
    print XML::Simple::XMLout($xml_bare_simple_tree, KeyAttr => []);
}

DESCRIPTION

This is just an API wrapper. This driver is based on LWP::UserAgent, XML::Bare, and inherits from Class::Accessor and Class::Data::Inheritable.

CONSTRUCTOR

new
my $tamino_client = Tamino->new(
    server  => $server,
    db      => $db,
    %options
);

server => Tamino server name, without http://, like 'hostname/tamino'

db => database name

Options:

collection => collection name (optional)

user => user name (optional)

password => user's password (optional)

encoding => encoding, 'UTF-8' by default

timeout => timeout for LWP::UserAgent

keep_alive => keep_alive for LWP::UserAgent

METHODS

begin
my $t = $tamino_client->begin() or die $tamino_client->error;
$t->xquery(...);

Returns a new Tamino::Tran object. The transaction session is not established. All operations are made in non-transactional context.

begin_tran
my $t = $tamino_client->begin_tran(%opts) or die $tamino_client->error;
$t->xquery(...);

Returns a new Tamino::Tran object. The transaction session is established. All operations are made in the transaction context.

All objects created with begin() and begin_tran() methods do their networking with the same LWP::UserAgent object, which is initialized in Tamino->new

%opts may include:

isolation_level => $level, which can be one of: uncommittedDocument committedCommand stableCursor stableDocument stableDocument

lock_mode => $mode, which can be one of: unprotected shared protected

lock_wait => $wait, which can be one of: yes no

For What-This-All-Means read Tamino Transaction Guide.

encoding => $enc to tell tamino server that you want $enc encoding.

MISC METHODS

$tamino_client->server('other_server/tamino');
$tamino_client->db('other_db');
$tamino_client->collection('other_collection');
$tamino_client->user('other_user');
$tamino_client->password('his_password');
$tamino_client->encoding('other_encoding');

All of the above change setting for only NEWLY created Tamino::Tran objects.

Note that encoding option only passed to the Tamino DB, this driver does nothing to take care of encoding.

print $tamino_client->error;

SUBCLASSING

You can subclass Tamino class. You can tell Tamino to use subclassed Tamino::Tran and LWP::UserAgent by saying:

Tamino->tran_class('My::Tamino::Tran');
$tamino_client->tran_class('My::Tamino::Tran');

Tamino->lwp_ua_class('My::LWP::UserAgent');

SEE ALSO

Tamino::Tran XML::Twig XML::Bare LWP::UserAgent Class::Accessor Class::Data::Inheritable