line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Db::Mediasurface; |
2
|
|
|
|
|
|
|
$VERSION = '0.03'; |
3
|
1
|
|
|
1
|
|
3594
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
473
|
|
5
|
1
|
|
|
1
|
|
6861
|
use DBI; |
|
1
|
|
|
|
|
83205
|
|
|
1
|
|
|
|
|
384
|
|
6
|
1
|
|
|
1
|
|
1438
|
use Db::Mediasurface::ReadConfig; |
|
1
|
|
|
|
|
2985
|
|
|
1
|
|
|
|
|
439
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
0
|
|
|
0
|
1
|
|
my ($class,%arg) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
0
|
|
|
|
my $self = { |
|
|
|
0
|
|
|
|
|
13
|
|
|
|
|
|
|
_config_file => $arg{config_file} || undef, |
14
|
|
|
|
|
|
|
_config => $arg{config} || undef, |
15
|
|
|
|
|
|
|
_version => undef, |
16
|
|
|
|
|
|
|
_dbh => undef |
17
|
|
|
|
|
|
|
}; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
0
|
|
|
|
croak('you must supply either a Db::Mediasurface::ReadConfig object or the path to a configuration file') |
20
|
|
|
|
|
|
|
unless ((defined $self->{_config}) or (defined $self->{_config_file})); |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
if (defined $self->{_config_file}) |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
|
|
|
$self->{_config} = Db::Mediasurface::ReadConfig->new( path=>$self->{_config_file} ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
bless $self, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub version |
31
|
|
|
|
|
|
|
{ |
32
|
0
|
|
|
0
|
1
|
|
my $self = $_[0]; |
33
|
0
|
0
|
|
|
|
|
unless (defined $self->{_version}) |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
|
my $sql = "SELECT schemaversion FROM systemdefaults"; |
36
|
0
|
|
|
|
|
|
$self->_dbi_connect; |
37
|
0
|
0
|
|
|
|
|
my $sth = $self->{_dbh}->prepare($sql) or carp("Database prepare error: $DBI::errstr"); |
38
|
0
|
0
|
|
|
|
|
$sth->execute or carp("Database execute error: $DBI::errstr"); |
39
|
0
|
|
|
|
|
|
($self->{_version}) = ($sth->fetchrow_array); |
40
|
0
|
|
|
|
|
|
$sth->finish(); |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
|
return $self->{_version}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _dbi_connect |
46
|
|
|
|
|
|
|
{ |
47
|
0
|
|
|
0
|
|
|
my $self = $_[0]; |
48
|
0
|
0
|
|
|
|
|
unless (defined $self->{_dbh}){ |
49
|
0
|
|
|
|
|
|
my $data_source = 'DBI:Oracle:'; |
50
|
0
|
|
|
|
|
|
my $username = $self->{_config}->get_username; |
51
|
0
|
|
|
|
|
|
my $password = $self->{_config}->get_password; |
52
|
0
|
|
|
|
|
|
my $attributes = {}; |
53
|
0
|
0
|
|
|
|
|
$self->{_dbh} = DBI->connect( $data_source, $username, $password, $attributes ) |
54
|
|
|
|
|
|
|
or croak("Couldn't connect to database: $DBI::errstr"); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Db::Mediasurface - manipulates a Mediasurface database. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This document refers to version 0.03 of DB::Mediasurface, released August 3, 2001. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use Db::Mediasurface; |
71
|
|
|
|
|
|
|
$path = '/opt/ms/3.0/etc/ms.properties'; |
72
|
|
|
|
|
|
|
$ms = Db::Mediasurface->new( config_file=>$path ); |
73
|
|
|
|
|
|
|
print ("Schema version: ".$ms->version."\n"); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
use Db::Mediasurface; |
76
|
|
|
|
|
|
|
use Db::Mediasurface::ReadConfig; |
77
|
|
|
|
|
|
|
$path = '/opt/ms/3.0/etc/ms.properties'; |
78
|
|
|
|
|
|
|
$config = Db::Mediasurface::Readconfig->new( config=>$path ); |
79
|
|
|
|
|
|
|
$ms = Db::Mediasurface->new( config=>$config ); |
80
|
|
|
|
|
|
|
print ("Schema version: ".$ms->version."\n"); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 Overview |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Db::Mediasurface is a wrapper for most other Db::Mediasurface:: modules. At present, only the new() and version() methods are supported. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 Constructor |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over 4 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item $ms = Db::Mediasurface->new( config=>$config_object ); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item $ms = Db::Mediasurface->new( config_file=>$path2config ); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Create a new Db::Mediasurface object by supplying either the path to a valid Mediasurface configuration file (usually named ms.properties), or a Db::Mediasurface::ReadConfig object. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 Methods |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item $ms_version = $ms->version; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns the database schema version. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Nigel Wetters (nwetters@cpan.org) |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 COPYRIGHT |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Copyright (c) 2001, Nigel Wetters. All Rights Reserved. |
117
|
|
|
|
|
|
|
This module is free software. It may be used, redistributed |
118
|
|
|
|
|
|
|
and/or modified under the same terms as Perl itself. |