The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Yote::IO::SQLite - A SQLite persistance engine for Yote.

DESCRIPTION

This can be installed as a singleton of Yote::ObjProvider and does the actual storage and retreival of Yote objects.

The interaction the developer will have with this may be specifying its intialization arguments.

CONFIGURATION

The package name is used as an argument to the Yote::ObjProvider package which also takes the configuration parameters for Yote::IO::SQLiteb.

Yote::ObjProvider::init( datastore => 'Yote::IO::SQLite', db => 'yote_db', uname => 'yote_db_user', pword => 'yote_db_password' );

PUBLIC METHODS

commit_transaction( )
container_type( host_id, container_name )

returns the class name of the given container from a host class.

count( container_id )

returns the number of items in the given container

database( )

Provides a database handle. Used only in testing.

disconnect( )
ensure_datastore( )

Makes sure that the datastore has the correct table structure set up and in place.

fetch( id )

Returns a hash representation of a yote object, hash ref or array ref by id. The values of the object are in an internal storage format and used by Yote::ObjProvider to build the object.

first_id( id )

Returns the id of the first object in the system, the Root.

get_id( obj )

Returns the id for the given hash ref, array ref or yote object. If the argument does not have an id assigned, a new id will be assigned.

hash_delete( hash_id, key )

Removes the key from the hash given by the id

hash_fetch( hash_id, key )
hash_has_key( hash_id, key )
hash_insert( hash_id, key, value )
list_delete( list_id, idx )
list_fetch( list_id, idx )
list_insert( list_id, val, idx )

Inserts the item into the list with an optional index. If not given, this inserts to the end of the list.

max_id( )

Returns the max ID in the yote system. Used for testing.

new
paginate( container_id, args )

Returns a paginated list or hash. Arguments are

    * search_fields - a list of fields to search for in collections of yote objects * search_terms - a list of terms to search for * sort_fields - a list of fields to sort by for collections of yote objects * reversed_orders - a list of true or false values corresponding to the sort_fields list. A true value means that field is sorted in reverse * limit - maximum number of entries to return * skip - skip this many entries before returning the list * return_hash - return the result as a hashtable rather than as a list * reverse - return the result in reverse order

recycle_object( obj_id )

Sets the available for recycle mark on the object entry in the database by object id and removes its data.

recycle_objects( start_id, end_id )

Recycles all objects in the range given if they cannot trace back a path to root.

search_list

Returns a paginated search list

start_transaction( )
stow( id, class, data )

Stores the object of class class encoded in the internal data format into the data store.

stow_all( )

Stows all objects that are marked as dirty. This is called automatically by the application server and need not be explicitly called.

AUTHOR

Eric Wolf coyocanid@gmail.com http://madyote.com

LICENSE AND COPYRIGHT

Copyright (C) 2011 Eric Wolf

This module is free software; it can be used under the same terms as perl itself.