# -*- perl -*- # This is an example configuration file for greenstone's DBPlug # (DataBase plugin). # # This config file should be a fragment of perl, specifying how to # get records out of a database. This uses perl's DBI module, which # includes back-ends for mysql, postgresql, comma separated values (CSV), # MS Excel, ODBC, sybase, etc... # # You need to install the separate backends - For example, on debian you # need the libdbi-perl base package and then the libdbd-mysql-perl, # libdbd-csv-perl, libdbd-pg-perl and/or libdbd-sybase-perl (etc) packages. # debugging. Uncomment this line if you want extra information printed # out during greenstone's import process. # $dbplug_debug=1; # If these are commented out, then we will use the plugin's defaults. # However, you might want to override them here if you know what they # are for this particular database # run "$ pluginfo.pl DBPlug | less" to see a list of valid encodings # Language metadata isn't really necessary unless you want indexes by language # However, Encoding is important, for converting data to utf8 # $language = "en"; $encoding = "iso_8859_1"; # Data Source. # This is going to be dependent on which back-end you use. # Eg, for postgres, it is "DBI:Pg:dbname=". # For mysql, it might look like "DBI:mysql:database=;host=localhost" # Case is important! # #$db=''; # If you need a username and password to connect to this database, # uncomment these lines and fill in the details # #$username=''; #$password=''; # sql query required to get your rows out of the database. Each row will # become a separate greenstone document. # #$sql_query = 'SELECT id, name, data FROM table1 JOIN table2 WHERE something'; # a map of database field names to Greenstone metadata field names. # You should have a "Title" field and a "text" field, at a minimum. # If you want to give records a unique identifier from a database field # rather than have greenstone perform a hash on the document, also provide # an "Identifier" metadata field. # If you do map something to Identifier, make sure that the field is unique # for each record, and also note that because greenstone does special things # if this field is only numeric, DBPlug will add some letters to the front # if this is the case. # #%db_to_greenstone_fields=( # "name" => "Title", # "data" => "text", # "id" => "Identifier" # ); # finally, you can declare subroutines here to post-process the fields # in case you want to do any mark up or processing of it. # For example, you might want to do HTML formatting. # The subroutine's name should be the greenstone metadata field name, # followed by "_callback", and must end with "}" in the first column. # #sub text_callback { # my $text=shift; # # do markup stuff... # return $text; #} # #sub Title_callback { # my $title=shift; # return ucfirst($title); # uppercase first letter #}