source: main/trunk/greenstone2/perllib/DBDrivers/GDBM.pm@ 31188

Last change on this file since 31188 was 31188, checked in by ak19, 7 years ago

This commit is related to but not specific to the upcoming commit to do with the new oaiinfo db and its directly affected files. This commit: New remove and rename (move) methods in DB package to clean up main db file and any additional db files created by any specific infodbtype. The new methods in dbutil/jdbm.pm are not called, for some reason. Requires more investigation, but committing for now.

File size: 2.9 KB
Line 
1###############################################################################
2#
3# GDBM.pm -- utility functions for writing to gdbm databases
4#
5# A component of the Greenstone digital library software from the New Zealand
6# Digital Library Project at the University of Waikato, New Zealand.
7#
8# Copyright (C) 1999-2015 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify it under
11# the terms of the GNU General Public License as published by the Free Software
12# Foundation; either version 2 of the License, or (at your option) any later
13# version.
14#
15# This program is distributed in the hope that it will be useful, but WITHOUT
16# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18# more details.
19#
20# You should have received a copy of the GNU General Public License along with
21# this program; if not, write to the Free Software Foundation, Inc., 675 Mass
22# Ave, Cambridge, MA 02139, USA.
23#
24###############################################################################
25
26package DBDrivers::GDBM;
27
28# Pragma
29use strict;
30
31# Libraries
32use util;
33use FileUtils;
34use DBDrivers::70HyphenFormat;
35
36
37BEGIN
38{
39 if (!defined $ENV{'GSDLHOME'} || !defined $ENV{'GSDLOS'}) {
40 die("Error! Environment not prepared. Have you sourced setup.bash?\n");
41 }
42 @DBDrivers::GDBM::ISA = ('DBDrivers::70HyphenFormat');
43}
44
45
46## @function constructor
47#
48sub new
49{
50 my $class = shift(@_);
51 my $self = DBDrivers::70HyphenFormat->new(@_);
52 $self->{'default_file_extension'} = 'gdb';
53 # note: file separator agnostic
54 $self->{'executable_path'} = FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, 'bin', $ENV{'GSDLOS'});
55 $self->{'read_executable'} = 'db2txt';
56 $self->{'keyread_executable'} = 'gdbmkeys';
57 $self->{'write_executable'} = 'txt2db';
58 # Optional Support
59 $self->{'supports_set'} = 1;
60 bless($self, $class);
61 return $self;
62}
63## new(void) => GDBM ##
64
65
66# -----------------------------------------------------------------------------
67# GDBM IMPLEMENTATION
68# -----------------------------------------------------------------------------
69
70# Handled by BaseDBDriver
71# sub get_infodb_file_path(string, string) => string
72# sub rename_db_file_to(string, string) => void
73# sub remove_db_file(string) => void
74
75# Handled by 70HyphenFormat
76# sub open_infodb_write_handle(string, string?) => filehandle
77# sub close_infodb_write_handle(filehandle) => void
78# sub delete_infodb_entry(filehandle, string) => void
79# sub read_infodb_entry(string, string) => hashmap
80# sub read_infodb_file(string, hashmap) => void
81# sub read_infodb_keys(string, hashmap) => void
82# sub read_infodb_rawentry(string, string) => string
83# sub set_infodb_entry(string, string, hashmap) => integer
84# sub write_infodb_entry(filehandle, string, hashmap) => void
85# sub write_infodb_rawentry(filehandle, string, string) => void
86
871;
Note: See TracBrowser for help on using the repository browser.