Test::DBChanges::ChangeSet - set of changes to DB tables
version 1.0.0
my $dbchanges = Test::DBChanges::Pg->new({ dbh => $dbh, source_names => [qw(things ledger)], }); # later: my $changeset = $dbchanges->changeset_for_code(sub { do_something($dbh) }); for my $row ($changeset->changes_for_source('things')->inserted_rows->@*) { # $row is a hashref with the inserted data }
Instances of this class are instantiated by a Test::DBChanges::* class. They contain all the data needed to construct hashrefs or objects for each inserted / updated / deleted row in all tracked tables.
Test::DBChanges::*
changed_tables
List of strings, the names of the tables that saw changes.
changes_for_source
my $changes = $changeset->changes_for_source('things');
Given a source name (that was in the source_names attribute of the DBChanges instance that build this object), returns a Test::DBChanges::TableChangeSet instance containing the changes for the corresponding table.
source_names
DBChanges
Test::DBChanges::TableChangeSet
If you pass in a wrong (or just not tracked) name, you get undef.
undef
Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>
This software is copyright (c) 2019 by BroadBean UK, a CareerBuilder Company.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::DBChanges, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::DBChanges
CPAN shell
perl -MCPAN -e shell install Test::DBChanges
For more information on module installation, please visit the detailed CPAN module installation guide.