Changeset 17381 for trunk/DataStoreServer/scripts/dsrootindex
- Timestamp:
- Apr 7, 2008, 3:59:25 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/DataStoreServer/scripts/dsrootindex (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataStoreServer/scripts/dsrootindex
r16762 r17381 8 8 use warnings; 9 9 10 use dsdbh; 11 10 12 use DBI; 11 13 12 use PS::IPP::Config qw($PS_EXIT_SUCCESS 13 $PS_EXIT_UNKNOWN_ERROR 14 $PS_EXIT_SYS_ERROR 15 $PS_EXIT_CONFIG_ERROR 16 $PS_EXIT_PROG_ERROR 17 $PS_EXIT_DATA_ERROR 18 $PS_EXIT_TIMEOUT_ERROR 19 metadataLookupStr 20 metadataLookupBool 21 caturi 22 ); 14 my $PS_EXIT_CONFIG_ERROR = 3; 23 15 24 16 my $dbh = getDBHandle(); … … 46 38 print $line; 47 39 } 48 49 # todo move to a module50 sub getDBHandle {51 my $ipprc = PS::IPP::Config->new(); # IPP Configuration52 my $siteConfig = $ipprc->{_siteConfig};53 54 my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');55 my $dbname = metadataLookupStr($siteConfig, 'DBNAME');56 my $dbuser = metadataLookupStr($siteConfig, 'DBUSER');57 my $dbpass = metadataLookupStr($siteConfig, 'DBPASSWORD');58 exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;59 60 my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";61 62 my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";63 return $dbh;64 }
Note:
See TracChangeset
for help on using the changeset viewer.
