Object::Relation::Handle::DB - The Object::Relation database store base class
See Object::Relation::Handle.
This class implements the Object::Relation storage API using DBI to communicate with an RDBMS. RDBMS specific behavior is implemented via the Object::Relation::Handle::DB::Pg and Object::Relation::Handle::DBI::SQLite classes.
Object::Relation::Handle::DB::Pg
Object::Relation::Handle::DBI::SQLite
It should be noted that although many methods in this class may be called as class methods, instances are used internally for bookkeeping while parsing the data and assembling information necessary to respond to user messages. Thus, many public class methods instantiate an object prior to doing work.
$store->save($object);
This method saves an object to the data store. It also saves all contained objects to the data store at the same time, all in a single transaction.
If a transaction has been started manually with begin_work, this method does not attempt to start a new transaction.
begin_work
$store->_begin_work;
Begins a transaction. No effect if we're already in a transaction.
$store->_commit;
Commits a transaction. No effect if we're not in a transaction.
$store->_rollback;
Rolls back an uncommitted transaction. No effect if we're not in a transaction.
my $search_class = $store->search_class; $store->search_class($search_class);
This is an accessor method for the Object::Relation::Meta::Class object representing the class being searched in the current search. This is usually the first argument to the query method.
query
Generally, the programmer will know which search class she is working with, but if not, this method is available. Note that it is only available externally if the programmer first creates an instances of store prior to doing a search.
my $store = Object::Relation::Handle->new; my $iter = $store->query($some_class, name => 'foo'); my $class = $store->search_class; # returns $some_class
my $object = Store->lookup($class_object, $unique_attr, $value);
Returns a single object whose value matches the specified attribute. This method will throw an exception if the attribute does not exist or if it is not unique.
my $iter = $obj_rel_object->query(@search_params);
Returns a Object::Relation::Iterator object containing all objects that match the search params. See Object::Relation::Handle for more information about search params.
my $iter = $obj_rel_object->squery(@search_params);
Identical to query, but uses string search syntax. This method does not expect the value 'STRING' at the front of a query.
my @uuids = Store->query_uuids($search_class, \@attributes, \%constraints); my $uuids = Store->query_uuids($search_class, \@attributes, \%constraints);
This method will return a list of uuids matching the listed criteria. It takes the same arguments as query. In list context it returns a list. In scalar context it returns an array reference.
my @uuids = Store->squery_uuids($search_class, "@attributes", @constraints); my $uuids = Store->squery_uuids($search_class, "@attributes", @constraints);
Identical to query_uuids, but uses string search syntax.
query_uuids
my $count = Store->count($class_object, @search_params);
This method takes the same arguments as query. Returns a count of how many rows a similar query will return.
Any final constraints (such as "LIMIT" or "ORDER BY") will be discarded.
Copyright (c) 2004-2006 Kineticode, Inc. <info@obj_relode.com>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Object::Relation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Object::Relation
CPAN shell
perl -MCPAN -e shell install Object::Relation
For more information on module installation, please visit the detailed CPAN module installation guide.