Specification of CGI Scripts with QDBM

Copyright (C) 2000-2003 Mikio Hirabayashi
Last Update: Sat, 13 Sep 2003 19:30:52 +0900
[Japanese] [Home]

Table of Contents

  1. Overview
  2. Installation
  3. Usage
  4. Bugs

Overview

QDBM provides a CGI script to administer database files. That is, database files can be administered via WWW. The CGI script can handle database files of the basic API, the extended API and the advanced API. Contents of the key and the value of each record should be character strings. The comparing function of the advanced API is lexical ordering. The available operations are listing databases, creating a database, removing a database, downloading a database, listing records, storing a record and deleting a record.


Installation

Preparation

A Web server featuring CGI is required. And make sure that QDBM is installed under `/usr/local'.

Change the current working directory to the sub directory named `cgi'.

cd cgi

Building

Run the configuration script.

./configure

Build programs.

make

When a series of work finishes, `qadm.cgi' will be generated.

Installation

Copy `qdbm.cgi' and `qadm.conf' into a directory where CGI is available. And, create a directory `data' in the CGI directory. For example, if the CGI directory is `/home/mikio/public_html', the following steps are suggested.

cp qadm.cgi qadm.conf /home/mikio/public_html
mkdir /home/mikio/public_html/data

The directory `data' should be granted the permission of reading, writing, and execution. Being most easily, the following steps are suggested. As for the rest, you can grant the CGI script setuid bit, or you can use a so-called suExec mechanism.

chmod 1777 /home/mikio/public_html/data

`qadm.conf' is the setting file. As the default contents are the following, you can modify them arbitrarily.

encoding: UTF-8
lang: en
title: Administration CGI of QDBM
dbdir: data
keychop: true
valchop: false

`encoding' specifies the character encoding of the shown page and the records of database files. `lang' specifies the language of the shown page. `title' specifies the title of the shown page. `dbdir' specifies the path of the directory containing database files. `keychop' and `valchop' specifies whether to normalize keys or values. If one is `true', white spaces at the end of each content are removed, and the contents can not contain linefeed codes.


Usage

Access the URL of `qadm.cgi' with a web browser. Then, follow the navigation of the page and administer the database.

For automatic agents to retrieve a stored record, the mechanism to get the as-is contents of the value of a records specified with a URL is provided. For example, if the URL of the CGI script is `http://a.b.c/qadm.cgi' and the name of the database is `staff' and the key is `mikio', the agent should access `http://a.b.c/qadm.cgi/staff/mikio'. That is, separated with '/', the URL of the CGI script entails the database name (without any suffix), which entails the key.

If you want to administer existing database files, you should place them in the directory `data'. And, the database files of the basic API should have the suffix `.dp'. The database directories of the extended API should have the suffix `.cr'. The database files of the advanced API should have the suffix `.vl'. For example, they are `foo.dp', `bar.cr' or `baz.vl'. Moreover, each database file or directory should be writable and readable by the CGI script.


Bugs

Because the CGI script does not have user authentication, Web server performs basic authentication of HTTP or client certification of SSL and so on.

The CGI script can handle only character strings for contents of keys and values.