Open owendavies93 opened 3 years ago
Mandyville::Database needs to be used like this:
Mandyville::Database
my $db = Mandyville::Database->new; my $countries = Mandyville::Countries->new({ dbh => $db->rw_db_handle(), sqla => SQL::Abstract::More->new, });
If you use it in a more succinct way:
my $countries = Mandyville::Countries->new({ dbh => Mandyville::Database->new->rw_db_handle(), sqla => SQL::Abstract::More->new, });
The handle gets DESTROYed too early, and you get errors like:
DESTROY
DBD::Pg::db selectrow_array failed: Cannot call execute on a disconnected database handle
It'd be nice if you didn't have to pre-declare the database object, although in practice it may never be a problem.
Mandyville::Database
needs to be used like this:If you use it in a more succinct way:
The handle gets
DESTROY
ed too early, and you get errors like:It'd be nice if you didn't have to pre-declare the database object, although in practice it may never be a problem.