2005-04-28, 01:36 AM
I have started to create a perl module for accessing the GBPVR (and Video Archive plugin db) database based upon Class::DBI and DBD::ODBC. The goal is to provide an easy-to-use object-oriented interface for both reading and writing (w/transactions) to the database where knowledge of actual SQL or schema is not required.
I'm posting the initial creation here and would welcome comments/discussion, specifically:
Attached is a zip with the .pm and docuemention in POD and HTML formats with many more details.
As a short summary, these are the table classes provided:
[INDENT] GBPVR::CDBI::RecordingSchedule
GBPVR::CDBI::Programme
GBPVR::CDBI::PlaybackPosition
GBPVR::CDBI::Channel
GBPVR::CDBI::CaptureSource
GBPVR::CDBI::VA::ArchiveTable
[/INDENT]
And here are a few snippets to help illustrate the usage:
I'm posting the initial creation here and would welcome comments/discussion, specifically:
- Is this a good thing to have?
- Will you use it?
- Do you have specific uses in mind?
- Do you have any comment on the structure (names space, method names, relationships, etc)?
- Comments on TODO items in the doc
Attached is a zip with the .pm and docuemention in POD and HTML formats with many more details.
As a short summary, these are the table classes provided:
[INDENT] GBPVR::CDBI::RecordingSchedule
GBPVR::CDBI::Programme
GBPVR::CDBI::PlaybackPosition
GBPVR::CDBI::Channel
GBPVR::CDBI::CaptureSource
GBPVR::CDBI::VA::ArchiveTable
[/INDENT]
And here are a few snippets to help illustrate the usage:
Code:
use GBPVR;
# search listings for titles of Star*
@rows = GBPVR::CDBI::Programme->search_like(name => 'Star%');
# find recorded shows
@rows = GBPVR::CDBI::RecordingSchedule->search(status => 2);
# find and output details for pending recordings
my @rows = GBPVR::CDBI::RecordingSchedule->search(status => 0);
@rows = sort { $a->manual_start_time cmp $b->manual_start_time } @rows;
foreach my $row (@rows){
printf "%-20s %8s %s - '%s'\n",
$row->manual_start_time,
$row->programme_oid->channel_oid->name,
$row->programme_oid->name,
$row->programme_oid->sub_title;
printf " %s\n", $row->programme_oid->description;
}