NAME
Meta::Cgi::SqlTable - show the results of an SQL query.
COPYRIGHT
Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
DETAILS
MANIFEST: SqlTable.pm
PROJECT: meta
VERSION: 0.01
SYNOPSIS
package foo;
use Meta::Cgi::SqlTable qw();
my($object)=Meta::Cgi::SqlTable->new();
my($result)=$object->method();
DESCRIPTION
Give this class: 1. An SQL statement. 2. A description of a database that it's supposed to work on. 3. A DBI handle. 4. How many rows of results you want displayed and other hints.
And it will display a CGI UI which enabled you to browse through the results.
The object will: 1. Analyze the statement using SQL::Statement to find out which fields it returns. 2. Build a table with hints about the columns. 3. Build buttons to move forward, backward in the results and select how many results to see at once.
FUNCTIONS
get_columns($$)
sql_table($$$$$)
core_code($$$$$$)
TEST($)
FUNCTION DOCUMENTATION
- get_columns($$)
-
This function analyzes an SQL statement using SQL::Statement and returns the columns that the statement returns.
- sql_table($$$$$)
-
This method does all the work. Give it hell. Arguments are: 0. Meta::Cgi::SqlTable object. 1. SQL statement to be used. 2. definition object of the database. 3. dbi handle. 4. number of rows to display.
- core_code($$$$$$)
-
This method actually does the work and gets the columns too.
- TEST($)
-
This is a testing suite for the Meta::Cgi::SqlTable module. This test is should be run by a higher level management system at integration or release time or just as a regular routine to check that all is well.
SUPER CLASSES
CGI(3)
BUGS
None.
AUTHOR
Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER
HISTORY
0.00 MV download scripts
0.01 MV weblog issues
SEE ALSO
CGI(3), SQL::Statement(3), strict(3)
TODO
-add support for the SORTED BY (combo box which allows the user to select according to which field to sort).
-add limit for nubmer of rows.
-add forward and back buttons.
-add options to change the limit by the user.
-add cascading style sheet support.
-add tool tips about the headers of the table.
-add options to gather results according to groups (for example letters) if there is too much results.