1 | # -*- perl -*-
|
---|
2 | # This is an example configuration file for greenstone's DBPlug
|
---|
3 | # (DataBase plugin).
|
---|
4 | #
|
---|
5 | # This config file should be a fragment of perl, specifying how to
|
---|
6 | # get records out of a database. This uses perl's DBI module, which
|
---|
7 | # includes back-ends for mysql, postgresql, comma separated values (CSV),
|
---|
8 | # MS Excel, ODBC, sybase, etc...
|
---|
9 | #
|
---|
10 | # You need to install the separate backends - For example, on debian you
|
---|
11 | # need the libdbi-perl base package and then the libdbd-mysql-perl,
|
---|
12 | # libdbd-csv-perl, libdbd-pg-perl and/or libdbd-sybase-perl (etc) packages.
|
---|
13 |
|
---|
14 |
|
---|
15 | # debugging. Uncomment this line if you want extra information printed
|
---|
16 | # out during greenstone's import process.
|
---|
17 | #
|
---|
18 | $dbplug_debug=1;
|
---|
19 |
|
---|
20 |
|
---|
21 | # If these are commented out, then we will use the plugin's defaults.
|
---|
22 | # However, you might want to override them here if you know what they
|
---|
23 | # are for this particular database
|
---|
24 | # run "$ pluginfo.pl DBPlug | less" to see a list of valid encodings
|
---|
25 | # Language metadata isn't really necessary unless you want indexes by language
|
---|
26 | # However, Encoding is important, for converting data to utf8
|
---|
27 | #
|
---|
28 | $language = "en";
|
---|
29 | $encoding = "iso_8859_1";
|
---|
30 |
|
---|
31 |
|
---|
32 | # Data Source.
|
---|
33 | # This is going to be dependent on which back-end you use.
|
---|
34 | # Eg, for postgres, it is "DBI:Pg:dbname=<database>".
|
---|
35 | # Case is important!
|
---|
36 | #
|
---|
37 | #$db='';
|
---|
38 |
|
---|
39 | # If you need a username and password to connect to this database,
|
---|
40 | # uncomment these lines and fill in the details
|
---|
41 | #
|
---|
42 | #$username='';
|
---|
43 | #$password='';
|
---|
44 |
|
---|
45 | # sql query required to get your rows out of the database. Each row will
|
---|
46 | # become a separate greenstone document.
|
---|
47 | #
|
---|
48 | #$sql_query = 'SELECT id, name, data FROM table1 JOIN table2 WHERE something';
|
---|
49 |
|
---|
50 |
|
---|
51 | # a map of database field names to Greenstone metadata field names.
|
---|
52 | # You should have a "Title" field and a "text" field, at a minimum.
|
---|
53 | # If you want to give records a unique identifier from a database field
|
---|
54 | # rather than have greenstone perform a hash on the document, also provide
|
---|
55 | # an "Identifier" metadata field.
|
---|
56 | # If you do map something to Identifier, make sure that the field is unique
|
---|
57 | # for each record, and also note that because greenstone does special things
|
---|
58 | # if this field is only numeric, DBPlug will add some letters to the front
|
---|
59 | # if this is the case.
|
---|
60 | #
|
---|
61 | #%db_to_greenstone_fields=(
|
---|
62 | # "name" => "Title",
|
---|
63 | # "data" => "text",
|
---|
64 | # "id" => "Identifier"
|
---|
65 | # );
|
---|
66 |
|
---|
67 |
|
---|
68 | # finally, you can declare a subroutine here to process the "text"
|
---|
69 | # in case you want to do any mark up or processing of it.
|
---|
70 | # For example, you might want to do HTML formatting.
|
---|
71 | #
|
---|
72 | #sub text_callback {
|
---|
73 | # my $text=shift;
|
---|
74 | # # do markup stuff...
|
---|
75 | # return $text;
|
---|
76 | #}
|
---|
77 |
|
---|