package VideoMetaData;

use strict;
use DBI;
use Carp;

{
    sub _getDBH {
        my $self = shift;

        $self->{_dbh} = DBI->connect("DBI:mysql:mythconverg:myth1", 'root', undef) || croak "Unable to get DB handle!";

    }
}

sub new {
    my $pkg = shift;

    my $self = bless { }, $pkg;

    return $self;
}

sub getNoPlot {
    my $self = shift;

    my @retary;
    $self->_getDBH if (! defined $self->{_dbh});

    my $sql = "select intid, title from videometadata where plot = 'None'";
    my $sth= $self->{_dbh}->prepare($sql);

    $sth->execute;

#    while (my @row = $sth->fetchrow_hashref ){  # fetch the rows into an array reference
#        push @retary, @row;                   # push the array onto an list to return
#    }
                while (my $retstat = $sth->fetchrow_hashref ) {      # fetch the rows into a hash reference
                    push @retary, $retstat;
                }

    return \@retary;

}



1
