This commit is contained in:
Isaac Connor 2015-12-23 14:16:09 -05:00
parent 33a3661958
commit 1328492c64
2 changed files with 9 additions and 3 deletions

View File

@ -31,7 +31,7 @@ use warnings;
require ZoneMinder::Base;
require Date::Manip;
use parent qw(ZoneMinder::Object);;
use parent qw(ZoneMinder::Object);
#our @ISA = qw(ZoneMinder::Object);
use vars qw/ $table $primary_key /;
@ -114,8 +114,8 @@ sub Execute {
$sql =~ s/zmSystemLoad/$load/g;
}
my $sth = $$self{dbh}->prepare_cached( $sql )
or Fatal( "Can't prepare '$sql': ".$$self{dbh}->errstr() );
my $sth = $ZoneMinder::Database::dbh->prepare_cached( $sql )
or Fatal( "Can't prepare '$sql': ".$ZoneMinder::Database::dbh->errstr() );
my $res = $sth->execute();
if ( !$res )
{

View File

@ -49,6 +49,12 @@ sub new {
my $self = {};
bless $self, $parent;
no strict 'refs';
my $primary_key = ${$parent.'::primary_key'};
if ( ! $primary_key ) {
Error( 'NO primary_key for type ' . $parent );
return;
} # end if
if ( ( $$self{$primary_key} = $id ) or $data ) {
#$log->debug("loading $parent $id") if $debug or DEBUG_ALL;
$self->load( $data );