1[! use SQLite::Work::CGI; !]
2[-
3=head1 NAME
4
5show.epl - Embperl script to show data from an SQLite database
6
7=head2 DESCRIPTION
8
9Embperl script to show data for an SQLite database.
10If run with no arguments, will print a form with tables to select from.
11Once a table is selected, it prints a form with search criteria;
12when the search critera are filled in, it will print a report.
13
14=head2 Configuration
15
16Before the script is run, it needs to be configured.  This is done
17by setting the correct values in the %InitArgs hash (just below
18if you are looking at the source of this file).
19
20The minimum requirement is to set the 'database' value; this must be
21the name of the SQLite database file which this script accesses.
22
23See L<SQLite::Work/new> and L<SQLite::Work::CGI/new> for more information
24about possible arguments to give.
25
26=cut
27
28%InitArgs = (
29    database=>'test1.db',
30);
31
32=head2 Author
33
34Kathryn Andersen. <perlkat@katspace.com>
35Created: 2006
36
37=cut
38
39$escmode=0;
40# this creates a new CGI object which has already parsed the query
41my	$tvdb = SQLite::Work::CGI->new(%InitArgs);
42
43$output = '';
44if ($tvdb->do_connect())
45{
46    if ($tvdb->{cgi}->param('Table'))
47    {
48	if ($tvdb->{cgi}->param('Search'))
49	{
50	    $tvdb->do_select($tvdb->{cgi}->param('Table'),
51		outfile=>\$output);
52	}
53	else
54	{
55	    $output = $tvdb->make_search_form($tvdb->{cgi}->param('Table'));
56	}
57    }
58    else
59    {
60	$output = $tvdb->make_table_form();
61    }
62    $tvdb->do_disconnect();
63}
64-]
65[+ $output +]
66