NAME
Metadata::DB::Base
CONSTRUCTOR
new()
argument is hash ref you must pass DBH, database handle, to the object. This is a database handle you opened before instancing the object If you wanted to change the name of the table..
my $m = Metadata::DB::Base({ DBH => $dbh });
$m->table_metadata_name_set('other_metadata_table');
$m->table_metadata_check; # make sure the table is there, if you wanted to setup
SETUP AND DB METHODS
dbh()
returns database handle The DBI handle is passed to the CONSTRUCTOR
table_metadata_exists()
does the metadata table exist or not? returns boolean.
table_metadata_create()
creates metadata table, does not check for existance
table_metadata_dump()
optional argument is limit returns debug string with a pseudo metadata table dump, suitable for printing to STDERR for debug purposes.
table_metadata_layout()
returns what the metadata table is expected to look according to current params could be useful if you're having a hard time with all of this. If you turn DEBUG to on, this is printed to STDERR .
table_metadata_check()
create table if not exists
RECORD METHODS
_record_entries_delete()
arg is id deletes all metadata entries for this record from metadata table (does not commit, etc)
_record_entries_count()
arg is id, returns number of record entries in metadata table
_table_metadata_insert()
arg is id, key, val
_table_metadata_insert_multiple()
arg is id and hashref
_record_entries_hashref()
arg is id returns hashref
SPEEDING UP QUERIES
Make sure you have an index on the metadata table
CREATE INDEX id_index ON metadata(id);