package DBIx::Data::Store::Command;

use Moose::Role;
use Method::Signatures::Simple;

has [ 'run', 'with', 'against' ] => (is => 'ro', required => 1);

requires 'execute';

method _new_sth {
  $self->against->run(sub {
    $_->prepare_cached($self->run, {}, 3);
  });
}

method _execute_sth ($sth) {
  $sth->execute(@{$self->with});
  $sth;
}

method _new_active_sth {
  $self->_execute_sth($self->_new_sth);
}

1;
