NAME

Meta::Db::Ops - Perl module to create a database for you.

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: Ops.pm
PROJECT: meta
VERSION: 0.15

SYNOPSIS

package foo;
use Meta::Db::Ops qw();
my($scod)=Meta::Db::Ops::create_db($connection,$dbdef);

DESCRIPTION

This module does various database related tasks like exporting from databases in a generic fashion, translating database names so that development environments could use the same DB server as production environments and not have to worry about messing with the same actual databases, cleaning out databases and other tasks that fall in no other modules ballpark.

FUNCTIONS

create_db($$)
export_writ($$$$)
export_hand($$$$)
export_file($$$$)
import($)
san($$$$$$$$)
sindex($$$)
clean_sa($)
dbname_name_to_deve($)
dbname_deve_to_name($)
dbname_name_to_prod($)
dbname_prod_to_name($)
dbname_deve_to_prod($)
dbname_prod_to_deve($)
TEST($)

FUNCTION DOCUMENTATION

create_db($$)

This will actually do the work of creating. You need to supply a connection object and a definition object.

export_writ($$$$)

This method will export the content of a database to an XML::Writer object. This method does not prepare statements since when you prepare a statement you have to know the exact number of parameters that you want and we dont: for each table the statement should be "SELECT (f1,f2,f3,...,fn) FROM table;" and the number of fields is changing. We do NOT wish to use a stupid: "SELECT * FROM table;" since we know which fields are there and we could avoid errros by doing this.

export_hand($$$$)

This method does the same as export_writ except it writes everything to a file handle and takes care of the writer itself.

export_file($$$$)

This method does the same as export_hand except it actually creates a new file.

import($)

This method will import the content of an XML file into a database. It uses a parser to achieve this (the idea is not store the entire XML in RAM and then import it but rather do it record by record).

san($$$$$$$$)

This will actually do the sanity tests.

sindex($$$)

This will check that all indices are ok in the database.

clean_sa($)

This is a clean stand alone method. Give it a database handle already connected to a database and it will clean it out by finding out which tables it has and issuing a DELETE statement for each.

dbname_name_to_deve($)

This method translates a db name from cannonical to development.

dbname_deve_to_name($)

This method translates a db name from development to cannonical.

dbname_name_to_prod($)

This method translates a db name from cannonical to production.

dbname_prod_to_name($)

This method translates a db name from production to cannonical.

dbname_deve_to_prod($)

This method translates a db name from development to production.

dbname_prod_to_deve($)

This method translates a db name from production to development.

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 more database issues
0.01 MV md5 project
0.02 MV database
0.03 MV perl module versions in files
0.04 MV movies and small fixes
0.05 MV movie stuff
0.06 MV thumbnail user interface
0.07 MV more thumbnail issues
0.08 MV website construction
0.09 MV improve the movie db xml
0.10 MV web site automation
0.11 MV SEE ALSO section fix
0.12 MV move tests to modules
0.13 MV download scripts
0.14 MV weblog issues
0.15 MV md5 issues

SEE ALSO

Error(3), Meta::Db::Dbi(3), Meta::Db::Info(3), Meta::IO::File(3), Meta::Sql::Stat(3), Meta::Sql::Stats(3), Meta::Utils::Output(3), Meta::Xml::Parsers::Dbdata(3), Meta::Xml::Writer(3), strict(3)

TODO

Nothing.