NAME

SQLstatement - Easily allow sql statements to be kept in files outside of perl code.


SYNOPSIS

In many situations, it is highly desireable to separate SQL from the perl code. This is especially true when the two code bases are maintained by separate people.

SQLstatement allows SQL to be stored in a file that can be executed directly by your favorite SQL tool.


DESCRIPTION

SQL commands are available as methods, delimeted by SQL (c-style) comments. Methods are indicated as

        /*--method_name--*/

where method_name contains no spaces. The SQL statement is terminated by a ';' character.

SQL methods should NOT be named 'new', 'list', or 'AUTOLOAD', though these are not explicitly checked.


EXAMPLE

First create some SQL file that has statements in the form of:

        /* comment ignored by SQLstatement */
        /*--the_date--*/
        SELECT sysdate FROM DUAL;

Note the ';' at the end of each SQL statement. (sysdate and DUAL are specific to Oracle.)

Now use them:


        #!/usr/bin/perl

        use SQLstatement;

        my $sql = new SQLstatement 'some/file.sql';
        my @methods = $sql->list
        
        print "Here is the statement I have:\n";
        print $sql->the_date, "\n";


AUTHOR

Tom Whipple <mail@tomwhipple.com>