DBSchema-Normalizer

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

WELCOME TO THE NORMALIZER
    DBSchema::Normalizer is a Perl module to help you through the process of
    transforming a MySQL database table from 1st to 2nd (and eventually 3rd)
    normal form.

    It is a tool for the database designer, who is supposed to know what it
    has to be done. The Normalizer does not give you support for deciding
    which tables need to be normalized and which fields to move across
    tables.

    What you get from DBSchema::Normalizer is a quick way of performing the operations
    you have identified as needed. You can also have a certain degree of
    flexibility, since the Normalizer can also simulate the operation
    instead of executing it, giving you plenty of information to decide
    whether you want to go on or not.

DATABASE THEORY
    You won't find database theory here. There are plenty of other places
    where to get such information.
    (http://www.palslib.com/Fundamentals/Database_Design.html is one of
    them. A sort of crash course on normalization with an elegant example on
    how to face this problem from a practical side can be found at
    www.perlmonks.org/index.pl?node_id=129454)

    I assume that you know what needs to be done, and that this knowledge
    comes to you by either a regular course or long practice. Either way,
    lacking the room to spread around some base theory, I feel that, having
    some hands-on examples on normalization will help you gather some
    insight on this process, which is too often explained only from a
    designer point of view, leaving helpless the ones with practical needs.

INSTALLATION
	The usual procedure.

	perl Makefile.PL
	make
	make install
	make test


USAGE
     use DBSchema::Normalizer;
     my $norm = DBSchema::Normalizer->new (\%param_hash); 
     $norm->do();

    %param_hash must contain at least the information to connect
    successfully to a mysql database through the DBI. For example, the
    following two calls are equivalent. The first one assumes that you have
    a MySQL configuration file (.my.cnf) in your home directory. This syntax
    is Unix specific. For other operating systems, please refer to the MySQL
    manual.

        # using a configuration file
        my $norm = DBSchema::Normalizer->new ({
            DSN           => "DBI:mysql:music;host=localhost;"
                             . "mysql_read_default_file=$ENV{HOME}/.my.cnf", 
            src_table     => "MP3",
            index_field   => "album_id",
            lookup_fields => "artist,album,genre",
            lookup_table  => "tmp_albums", 
            dest_table    => "songs",
            copy_indexes  =>  1,
            simulate      =>  1
         });

        # passing username and password explicitly
        my $norm = DBSchema::Normalizer->new ({
            DSN           => "DBI:mysql:music;host=localhost"
            username      => "itsme",
            password      => "secret",
            src_table     => "MP3",
            index_field   => "album_id",
            lookup_fields => "artist,album,genre",
            lookup_table  => "tmp_albums", 
            dest_table    => "songs",
            copy_indexes  =>  1,
            simulate      =>  1
         });

    Examples of usage can be found in the DBSchema::Normalizer module itself

        perldoc DBSchema::Normalizer

DISTRIBUTION LIST
     Changes                           Version log
     MANIFEST                          List of files in this package
     Makefile.PL                       (non) installation script
     Normalizer.pm                     The Module Itself
     README                            this file
     test.pl                           test dependencies for DBSchema::Normalizer
     docs/Normalizer.html              documentation in HTML format
     docs/Normalizer.pod               documentation in POD format
     docs/Normalizer.txt               plain text documentation
     examples/mp3.mysql                sample database script MySQL 
     examples/test_normalizer.pl       test with sample database

DOCUMENTATION
    All the documentation is embedded into the module itself in POD format,
    which you can enjoy by typing

        perldoc DBSchema::Normalizer

    I decided to spare you some milliseconds of CPU usage (and waste some
    kilobytes of mass storage in the process) and therefore you also have
    the same documentation in the following formats:

        Normalizer.pod  POD format, in case you have some CPU cycles to spare and want to
                        produce your own docs.
                    
        Normalizer.html Browsable version
    
        Normalizer.txt  If you are using a limited resources connection, or if you just 
                        like it, there is a plain text version.

    And of course the best documentation is the code itself, which you are
    welcome to peek at. However, try to use only the documented subs and



( run in 1.544 second using v1.01-cache-2.11-cpan-39bf76dae61 )