NAME
DBIx::QuickORM::RowManager - Base row manager mediating row state and storage.
DESCRIPTION
A row manager turns fetched/pending data sets into row objects and drives their state transitions for insert, update, delete, and select against a connection. It tracks the current transaction stack so newly created rows are tagged with the active transaction.
This base class implements no caching: does_cache is false and the cache hooks are no-ops. DBIx::QuickORM::RowManager::Cached subclasses it to add a per-source identity cache.
SYNOPSIS
my $mgr = DBIx::QuickORM::RowManager->new(connection => $connection);
my $row = $mgr->select(source => $source, fetched => \%data);
ATTRIBUTES
- transactions
-
Arrayref of the connection's active transactions; defaults from the connection. The last entry is the innermost active transaction.
- connection
-
The owning connection (held weakly).
PUBLIC METHODS
- $bool = $mgr->does_cache
-
True if this manager keeps a row cache. False for the base class.
- $mgr->cache($source, $row, $old_pk, $new_pk)
- $row = $mgr->uncache($source, $row, $old_pk, $new_pk)
-
Cache hooks. No-ops in the base class; overridden by caching subclasses.
- $row = $mgr->cache_lookup(source => $source, ...)
-
Look up a row in the cache by its parsed parameters. Returns the cached row or undef.
- $row = $mgr->do_cache_lookup($source, $fetched, $old_pk, $new_pk, $row)
-
Backend cache lookup. Returns undef in the base class; caching subclasses override it.
- $mgr->invalidate(source => $source, ...)
-
Mark a row's data invalid, both on any passed-in row and on the cached copy, recording a reason (defaulting to the caller's file and line).
- $state = $mgr->_state(%params)
-
Build a row-state hashref, tagging it with the innermost active transaction.
- $row = $mgr->_vivify($source, $state)
-
Construct a new row object of the appropriate row class wrapping fresh row data for the given state.
- $row = $mgr->vivify(source => $source, ...)
-
Return an existing matching row, or create a new row with the fetched data as its pending (unsaved) state.
- $row = $mgr->insert(source => $source, fetched => \%data, ...)
- $row = $mgr->update(source => $source, fetched => \%data, ...)
- $row = $mgr->delete(source => $source, fetched => \%data, ...)
- $row = $mgr->select(source => $source, fetched => \%data, ...)
-
Apply the named storage operation to a row (creating one if needed), updating the cache accordingly, and return the row.
- $row = $mgr->do_insert($source, $fetched, $old_pk, $new_pk, $row)
- $row = $mgr->do_update($source, $fetched, $old_pk, $new_pk, $row)
- $row = $mgr->do_delete($source, $fetched, $old_pk, $new_pk, $row)
- $row = $mgr->do_select($source, $fetched, $old_pk, $new_pk, $row)
-
Backend state transitions invoked by the matching public method, after parameters have been parsed. They change the row's state and skip cache maintenance.
- ($source, $fetched, $old_pk, $new_pk, $row, $params) = $mgr->parse_params(\%params, %skip)
-
Validate and normalize the common operation parameters: confirm the source role, extract old/new primary keys from the fetched data, validate any passed-in row against the source and connection, and resolve a cached row. Returns the unpacked values plus the original params hashref.
SOURCE
The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.