Changeset 17381 for trunk/DataStoreServer/scripts/dsprodindex
- Timestamp:
- Apr 7, 2008, 3:59:25 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/DataStoreServer/scripts/dsprodindex (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataStoreServer/scripts/dsprodindex
r16762 r17381 7 7 8 8 use DBI; 9 use PS::IPP::Config qw($PS_EXIT_SUCCESS 10 $PS_EXIT_UNKNOWN_ERROR 11 $PS_EXIT_SYS_ERROR 12 $PS_EXIT_CONFIG_ERROR 13 $PS_EXIT_PROG_ERROR 14 $PS_EXIT_DATA_ERROR 15 $PS_EXIT_TIMEOUT_ERROR 16 metadataLookupStr 17 metadataLookupBool 18 caturi 19 ); 9 use dsdbh; 20 10 11 my $PS_EXIT_CONFIG_ERROR = 3; 12 my $PS_EXIT_DATA_ERROR = 5; 21 13 my $product = shift; 22 14 die("must specify product to list") unless defined $product; … … 145 137 print "$line\n"; 146 138 } 147 148 # TODO: move this to a module149 sub getDBHandle {150 my $ipprc = PS::IPP::Config->new(); # IPP Configuration151 my $siteConfig = $ipprc->{_siteConfig};152 153 my $dbserver = metadataLookupStr($siteConfig, 'DBSERVER');154 my $dbname = metadataLookupStr($siteConfig, 'DBNAME');155 my $dbuser = metadataLookupStr($siteConfig, 'DBUSER');156 my $dbpass = metadataLookupStr($siteConfig, 'DBPASSWORD');157 exit ($PS_EXIT_CONFIG_ERROR) unless defined $dbserver and $dbname and $dbuser and $dbpass;158 159 my $dsn = "DBI:mysql:host=$dbserver;database=$dbname";160 161 my $dbh = DBI->connect($dsn, $dbuser, $dbpass) or die "Cannot connect to server\n";162 return $dbh;163 }
Note:
See TracChangeset
for help on using the changeset viewer.
