SQLite

This book recounts issues surrounding the installation and maintenance of SQLite

Installing SQLite3

nnlbak

These notes refer to the installation of the command-line version of SQLite. If you want to install the Perl SQLite libraries look here.

  1. Download the latest tarball from here and place it in /wk/BUILD.
  2. Unzip the package and follow the instructions in the README file.
  3. Relink libsqlite3.so.8.8.6 with the gcc library as the make process does not do this on SCO Openserver.
cd .libs
gcc -shared -lgcc -o libsqlite3.so.8.8.6 *.o
cp libsqlite3.so.8.8.6 /usr/local/lib

natnom

The development kit is not installed on natnom so it is necessary to copy the sqlite binaries from nnlbak:

1. Tar the sqlite binaries into a single file:

tar cvf /tmp/sqlite.tar /usr/local/bin/sqlite* /usr/local/lib/libsqlite*
(single command line)

2. Copy the file to natnom and place it in the tmp directory:

scp /tmp/sqlite.tar natnom:/tmp
3. Log on to natnom and unpack the file from the root directory:
cd /
tar xvf /tmp/sqlite.tar
4. Check that it works:

Installing DBD::SQLite

Installation

These notes refer to the installation of the Perl SQLite libraries. This installation is independent of the installation of the SQLite command-line version. It is probably best to make sure both versions are the same.

By default the installed version of DBD::SQLite will probably be too old.

Note: This probably won’t work on natnom. Do it on nnlbak first, transfer the entire contents of /wk/CPAN/build/DBD-SQLite-1.08 to natnom then carry out steps 1 and 2 below followed by the make install in step 6.

These notes assume the current version of SQLite is 3.2.2. If you are installing a different version substitute ‘3.2.2’ below with the correct version number.

1. Start by loading CPAN (from any directory):

perl �MCPAN �e shell

2. Ensure the latest version of DBI is installed (1.48 at the time of writing):

install DBI

3. Load the latest DBD::SQLite:

look DBD::SQLite

4. When this finishes, load the latest SQLite source:

perl getsqlite.pl 3.2.2

5. When finished, compile it:

cd sqlite-3.2.2
./configure
make

6. This will create (amongst other things) the file keywordhash.h. Copy this to the parent directory:

cp keywordhash.h ..

7. Return to the parent directory; make and install the DBD::SQLite:

cd ..
perl Makefile.PL
make
make install
exit
q

8. DBD::SQLite should now be ready for use.

Generic Webmin Module

Introduction

The Generic SQLite Webmin module can be used to display or modify records in any configured SQLite database.

Description

The Generic SQLite Webmin module can be accessed by clicking the SQLite Manager icon under the Others tab in Webmin (if installed).

To select an SQLite database, click the Module Config link on the main SQLite Manager screen and select the database you wish to examine.

Configuration

This choice list is created by editing the file /opt/webmin/sqlite/config.info and adding or removing entries from the single config line.

Example:

dbase=Which database?,4,/wk/data/snug/etc/snug.db-LiveSnug, \
/usr/ncsg2c/tst/snug.db-g2cTest,/etc/snug.db-etcSnug

The format of the entry is documented in the Webmin documentation:

name=description,type,value-display[,value-display]...

The only thing(s) you need to modify are the value_display pairs (eg /wk/data/snug/etc/snug.db-LiveSnug).

The first part, value, is the path to the SQLite database file and the second part (display) is the text displayed in the choice list.

In the example above, the choice list will consist of:

LiveSnug
g2cTest
etcSnug