Changeset 17720
- Timestamp:
- 2008-11-06T11:00:15+13:00 (15 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/DatabasePlugin.pm
r17719 r17720 1 1 ########################################################################### 2 2 # 3 # D BPlugin.pm -- plugin to import records from a database3 # DatabasePlugin.pm -- plugin to import records from a database 4 4 # 5 5 # A component of the Greenstone digital library software … … 34 34 # Mar, Apr 2003 35 35 36 package D BPlugin;36 package DatabasePlugin; 37 37 38 38 use strict; … … 43 43 44 44 sub BEGIN { 45 @D BPlugin::ISA = ('AutoExtractMetadata');45 @DatabasePlugin::ISA = ('AutoExtractMetadata'); 46 46 } 47 47 … … 53 53 'reqd' => "no" }]; 54 54 55 my $options = { 'name' => "D BPlugin",55 my $options = { 'name' => "DatabasePlugin", 56 56 'desc' => "{DBPlugin.desc}", 57 57 'abstract' => "no", … … 89 89 my $verbosity = $self->{'verbosity'}; 90 90 91 print STDERR "<Processing n='$file' p='D BPlugin'>\n" if ($gli);92 print $outhandle "D BPlugin: processing $file\n"91 print STDERR "<Processing n='$file' p='DatabasePlugin'>\n" if ($gli); 92 print $outhandle "DatabasePlugin: processing $file\n" 93 93 if $self->{'verbosity'} > 1; 94 94 … … 121 121 # read in config file. 122 122 if (!open (CONF, $filename_full_path)) { 123 print $outhandle "D BPlugin: can't read $filename_full_path: $!\n";123 print $outhandle "DatabasePlugin: can't read $filename_full_path: $!\n"; 124 124 return 0; 125 125 } … … 140 140 $callback =~ /[\`]|\|\-/) { 141 141 # no backticks or functions that start new processes allowed 142 print $outhandle "D BPlugin: bad function in callback\n";142 print $outhandle "DatabasePlugin: bad function in callback\n"; 143 143 return 0; 144 144 } … … 147 147 my $ret = eval "\$callbacks{'$fieldname'} = $callback ; 1"; 148 148 if (!defined($ret)) { 149 print $outhandle "D BPlugin: error eval'ing callback: $@\n";149 print $outhandle "DatabasePlugin: error eval'ing callback: $@\n"; 150 150 exit(1); 151 151 } 152 152 $callback=""; 153 print $outhandle "D BPlugin: callback registered for '$fieldname'\n"153 print $outhandle "DatabasePlugin: callback registered for '$fieldname'\n" 154 154 if $dbplug_debug; 155 155 } elsif ($callback) { … … 171 171 chomp $err; 172 172 $err =~ s/\.$//; # remove a trailing . 173 print $outhandle "D BPlugin: error evaluating `$statement'\n";173 print $outhandle "DatabasePlugin: error evaluating `$statement'\n"; 174 174 print $outhandle " $err (in $filename_full_path)\n"; 175 175 return 0; # there was an error reading the config file … … 180 180 $statement = ""; 181 181 } else { 182 print $outhandle "D BPlugin: skipping statement `$statement'\n";182 print $outhandle "DatabasePlugin: skipping statement `$statement'\n"; 183 183 } 184 184 $statement = ""; … … 189 189 190 190 if (!defined($db)) { 191 print $outhandle "D BPlugin: error: $filename_full_path does not specify a db!\n";191 print $outhandle "DatabasePlugin: error: $filename_full_path does not specify a db!\n"; 192 192 return 0; 193 193 } 194 194 if (!defined($sql_query)) { 195 print $outhandle "D BPlugin: error: no SQL query specified!\n";195 print $outhandle "DatabasePlugin: error: no SQL query specified!\n"; 196 196 return 0; 197 197 } … … 200 200 201 201 if (!defined($dbhandle)) { 202 die "D BPlugin: could not connect to database, exiting.\n";202 die "DatabasePlugin: could not connect to database, exiting.\n"; 203 203 } 204 204 if (defined($dbplug_debug) && $dbplug_debug==1) { 205 print $outhandle "D BPlugin (debug): connected ok\n";205 print $outhandle "DatabasePlugin (debug): connected ok\n"; 206 206 } 207 207 … … 233 233 if (defined($db_to_greenstone_fields{$fieldname})) { 234 234 if (defined($dbplug_debug) && $dbplug_debug==1) { 235 print $outhandle "D BPlugin (debug): mapping db field "235 print $outhandle "DatabasePlugin (debug): mapping db field " 236 236 . "'$fieldname' to " 237 237 . $db_to_greenstone_fields{$fieldname} . "\n"; … … 251 251 while (scalar(@row_array)) { 252 252 if (defined($dbplug_debug) && $dbplug_debug==1) { 253 print $outhandle "D BPlugin (debug): retrieved a row from query\n";253 print $outhandle "DatabasePlugin (debug): retrieved a row from query\n"; 254 254 } 255 255 … … 356 356 # check "$sth->err" if empty array for error 357 357 if ($statement_hand->err) { 358 print $outhandle "D BPlugin: received error: \"" .358 print $outhandle "DatabasePlugin: received error: \"" . 359 359 $statement_hand->errstr . "\"\n"; 360 360 } … … 368 368 369 369 if (defined($dbplug_debug) && $dbplug_debug==1) { 370 print $outhandle "D BPlugin: imported $count DB records as documents.\n";370 print $outhandle "DatabasePlugin: imported $count DB records as documents.\n"; 371 371 } 372 372 $count;
Note:
See TracChangeset
for help on using the changeset viewer.