1 | ###########################################################################
|
---|
2 | #
|
---|
3 | # GDBML.pm -- extends the dbutil::gdbm class by adding simple file
|
---|
4 | # locking so as to allow for multiple readers/writers (albeit slow and not
|
---|
5 | # supported over network filesystems)
|
---|
6 | #
|
---|
7 | # A component of the Greenstone digital library software
|
---|
8 | # from the New Zealand Digital Library Project at the
|
---|
9 | # University of Waikato, New Zealand.
|
---|
10 | #
|
---|
11 | # Copyright (C) 2015 New Zealand Digital Library Project
|
---|
12 | #
|
---|
13 | # This program is free software; you can redistribute it and/or modify
|
---|
14 | # it under the terms of the GNU General Public License as published by
|
---|
15 | # the Free Software Foundation; either version 2 of the License, or
|
---|
16 | # (at your option) any later version.
|
---|
17 | #
|
---|
18 | # This program is distributed in the hope that it will be useful,
|
---|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
21 | # GNU General Public License for more details.
|
---|
22 | #
|
---|
23 | # You should have received a copy of the GNU General Public License
|
---|
24 | # along with this program; if not, write to the Free Software
|
---|
25 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
26 | #
|
---|
27 | ###########################################################################
|
---|
28 |
|
---|
29 | package DBDrivers::GDBML;
|
---|
30 |
|
---|
31 | use strict;
|
---|
32 |
|
---|
33 | BEGIN
|
---|
34 | {
|
---|
35 | @dbutil::gdbml::ISA = ('dbutil::gdbm');
|
---|
36 | }
|
---|
37 |
|
---|
38 | # Libraries
|
---|
39 | use util;
|
---|
40 | use FileUtils;
|
---|
41 | use parent 'DBDrivers::70HyphenFormat';
|
---|
42 |
|
---|
43 | ## @function constructor
|
---|
44 | #
|
---|
45 | sub new
|
---|
46 | {
|
---|
47 | my $class = shift(@_);
|
---|
48 | my $self = DBDrivers::70HyphenFormat->new(@_);
|
---|
49 | $self->{'default_file_extension'} = 'gdb';
|
---|
50 | # note: file separator agnostic
|
---|
51 | $self->{'executable_path'} = $ENV{'GSDLHOME'} . '/bin/' . $ENV{'GSDLOS'};
|
---|
52 | $self->{'read_executable'} = 'db2txtl';
|
---|
53 | $self->{'keyread_executable'} = 'gdbmkeys';
|
---|
54 | $self->{'write_executable'} = 'txt2dbl';
|
---|
55 | # Optional Support
|
---|
56 | $self->{'supports_set'} = 1;
|
---|
57 | bless($self, $class);
|
---|
58 | return $self;
|
---|
59 | }
|
---|
60 | ## new(void) => GDBML ##
|
---|
61 |
|
---|
62 | # -----------------------------------------------------------------------------
|
---|
63 | # GDBML IMPLEMENTATION
|
---|
64 | # -----------------------------------------------------------------------------
|
---|
65 |
|
---|
66 | # Handled by BaseDBDriver
|
---|
67 | # sub get_infodb_file_path(string, string) => string
|
---|
68 |
|
---|
69 | # Handled by 70HyphenFormat
|
---|
70 | # sub open_infodb_write_handle(string, string?) => filehandle
|
---|
71 | # sub close_infodb_write_handle(filehandle) => void
|
---|
72 | # sub delete_infodb_entry(filehandle, string) => void
|
---|
73 | # sub read_infodb_entry(string, string) => hashmap
|
---|
74 | # sub read_infodb_file(string, hashmap) => void
|
---|
75 | # sub read_infodb_rawentry(string, string) => string
|
---|
76 | # sub set_infodb_entry(string, string, hashmap) => integer
|
---|
77 | # sub write_infodb_entry(filehandle, string, hashmap) => void
|
---|
78 | # sub write_infodb_rawentry(filehandle, string, string) => void
|
---|
79 |
|
---|
80 |
|
---|
81 | ## @function
|
---|
82 | #
|
---|
83 | sub read_infodb_keys
|
---|
84 | {
|
---|
85 | my $self = shift(@_);
|
---|
86 | print STDERR "Warning: read_infodb_keys() not available for GDBML, falling-back to GDBM\n";
|
---|
87 | $self->SUPER::read_infodb_keys(@_);
|
---|
88 | }
|
---|
89 | ## read_infodb_keys(string, hashmap) => void ##
|
---|
90 |
|
---|
91 |
|
---|
92 | 1;
|
---|