The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Meta::Db::Reserved - checks for db related reserved words.

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: Reserved.pm
        PROJECT: meta
        VERSION: 0.06

SYNOPSIS

        package foo;
        use Meta::Db::Reserved qw();
        my($result)=Meta::Db::Reserved::check("SELECTED");
        or
        Meta::Db::Reserved::make_sure("SELECTORS");

DESCRIPTION

This class is here to help you make sure that things like database names, table names and field names are such that databases will not have problems with them. For instance if you call your table SELECT you can bet your life the database will kick you out of the room. But other - more subtle things exist. For instance - imagine that db vendor A has a builtin function "calculate" and db vendor B hasn't got it. You start your application using vendor B's database and write lots of code where one of your tables is called "calculate". Later you are required to migrate to vendor A and the database refuses to analyze your SQL statements because of the reserved name. Wouldn't it be nice if you got an error about it from your development environment right from the start ?

This is what this module is here to do. I will collect the reserved words of many database vendors in here and force you to select names which will be ok across all db vendors.

The list of reserved words currently contains: 1. PostgreSQL reserved words out of the PostgreSQL documentation. 2. MySQL reserved words out of the MySQL documentation

You are most welcome to contribute patches with lists of words from other DB vendors (Oracle, SYBASE, DB2).

This is a tag placed in this module for source control reasons (don't ask): SPECIAL STDERR FILE

FUNCTIONS

        BEGIN()
        check($)
        make_sure($)
        TEST($)

FUNCTION DOCUMENTATION

BEGIN()

This is an initialization method which sets up the hash table of all the reserved words.

This is a constructor for the Meta::Db::Reserved object.

check($)

This method will return an error code (0) if the word given to it is a reserved word.

make_sure($)

This method will make sure (raise an exception if not) that a certain word is not reserved.

TEST($)

Test suite for this object.

SUPER CLASSES

None.

BUGS

None.

AUTHOR

        Name: Mark Veltzer
        Email: mailto:veltzer@cpan.org
        WWW: http://www.veltzer.org
        CPAN id: VELTZER

HISTORY

        0.00 MV import tests
        0.01 MV more thumbnail issues
        0.02 MV website construction
        0.03 MV web site automation
        0.04 MV SEE ALSO section fix
        0.05 MV web site development
        0.06 MV md5 issues

SEE ALSO

Meta::Ds::Set(3), Meta::Error::Simple(3), strict(3)

TODO

-add sets of words and ability to select which sets to work with. do the sets according to the PostgreSQL documentation (postgress, SQL 92, SQL 99).

-make the general functionality (of reserved words and sets of words) in a papa class.

-make this class use a proper Set class and not a perl hash.

-make this class read everything from an XML files.