pgFormatter::CGI - Implementation of CGI-BIN script to format SQL queries.
This module is called by pg_format program, when it detects it is run in CGI
environment. In such case all control over flow is passed to this module by
calling:
my $program = pgFormatter::CGI->new();
$program->run()
Object constructor, calls set_config method to set default values for various
parameters.
Wraps all work related to generating html page.
It calls set of functions to get CGI object, receive parameters
from request, sanitize them, beautify query (if provided) and print
ghtml.
Creates CGI object, and sets POST size limit
Sets config for the page and beautifier. URLs, names of auxiliary files,
configuration for pgFormatter::Beautify module.
Loads, and returns, default CSS from __DATA__.
Gets values of parameters, and possibly uploaded file from CGI object to
structures in $self.
Overrides parameter values if given values were not within acceptable ranges.
Runs beautification on provided query, and stores new version in
$self->{'content'}
Outputs body of the page.
Outputs footer of the page
Helper function to try to load file. If it succeeds, it returns file content, it
not, it returns empty string (instead of dying).
Outputs page headers - both HTTP level headers, and HTML.
__DATA__ section (at the end of this file) is used to store default CSS Style,
so that it will not "pollute" Perl code, and will not need to be
indented.
pgFormatter is an original work from Gilles Darold
Please report any bugs or feature requests to:
https://github.com/darold/pgFormatter/issues
Copyright 2012-2021 Gilles Darold. All rights reserved.
pgFormatter is free software distributed under the PostgreSQL Licence.
A modified version of the SQL::Beautify Perl Module is embedded in
pgFormatter with copyright (C) 2009 by Jonas Kramer and is published under
the terms of the Artistic License 2.0.