Hi!
Though I am not yet registered as an author on pause,
I would like to get comments on a name for a module.
I do not stick with the current name SQL::Schema::*.
The opposite is true. Currently the module only supports
DDL statements within Oracle's SQL dialect and is only
capable to extract a subset of an Oracle database schema.
Some of the names I have in mind are:
Oracle::DDL::*
Oracle::Schema::*
SQL::DDL::Oracle::*
SQL::Oracle::*
Currently I do like the second most, I think.
Torsten
P.S.: I attached some of the docs and a tarball.
--
Torsten Hentschel private
[EMAIL PROTECTED]
NAME
SQL::Schema - Convert a data dictionary into SQL statements
SYNOPSIS
use DBI;
my $dbh = DBI->connect(...);
use SQL::Schema;
my $schema = SQL::Schema->new($dbh);
my $sql = $schema->string;
print $sql;
print "$schema";
WARNING
This is alpha software. It currently works with Oracle databases
only.
If somebody is modifying the datase schema during the life time
of an `SQL::Schema' object, the object will probably fail and /
or produce wrong information.
DESCRIPTION
`SQL::Schema' is a class for objects representing a database
schema. The methods of an instanciated object do allow to access
the information within a database's data dictionary and to
represent them as SQL create statements and the like using the
proper SQL dialect.
Constructor
$schema = SQL::Schema->new($dbh);
The new method instanciates a schema object. The only argument
required is a database handle, which has to offer the same API
as described within the DBI(3) manpage.
Methods
$sql = $schema->string;
Returns an SQL string containing several statements at once.
This string contains all the SQL statements to create the
database schema.
This method is overloaded with the string operator. So the
following two lines are equivalent:
$sql = $schema->string;
$sql = "$schema";
AUTHOR AND COPYRIGHT
SQL::Schema is Copyright (C) 2000, Torsten Hentschel
Windmuehlenweg 47
44141 Dortmund
Germany
Email: [EMAIL PROTECTED]
All rights reserved.
You may distribute this package under the terms of either the GNU
General Public License or the Artistic License, as specified in the
Perl README file.
SEE ALSO
the export_schema(1) manpage, the DBI(3) manpage, the
SQL::Schema::Table(3) manpage, the SQL::Schema::Sequence(3)
manpage, the SQL::Schema::View(3) manpage
NAME
export_schema - Prints a database schema as plain SQL
SYNOPSIS
$ DBI_DATA_SOURCE='dbi:Oracle:hobbit'
$ DBI_USERNAME='frodo'
$ DBI_AUTH='bilbo'
$ export DBI_DATA_SOURCE DBI_USERNAME DBI_AUTH
$ export_schema
or more sophisticated:
$ DBI_DATA_SOURCE='dbi:Oracle:hobbit' \
> DBI_USERNAME='frodo' \
> DBI_AUTH='bilbo' \
> export_schema
DESCRIPTION
This short script reads the data dictionary of an Oracle
database and prints corresponding plain SQL create statements to
stdout. These create statements can be used as input for sqlplus
to duplicate the schema on another database.
REQUIRED ENVIRONMENT
The script takes the information necessary to establish a
database connection from the environment. It needs three
environment variables to be set as shown above at SYNOPSIS.
These variables correspond to the first three arguments handed
over to DBI's `connect()' method. For more information about
possible values please have a look at the DBI(3) manpage.
The script does not accept command line parameters with the
connect info as this is the major security whole with some
database scripts (incluing Oracle's sqlplus) if you invoke them
automatically (e.g. from cron). Anybody who is able to use the
command `ps' can explore your password then. Ok, it makes the
script hard to use within an interactive environment. The real
reason for environment variables was: It makes the script this
short. :-)
CAVEAT
This software is still under development. Not all tweaks are
supported by now. This means: The create statements produced on
stdout might not create exactly the same schema if you execute
them. For more information, please have a look at the TODO file
that comes with this perl module.
AUTHOR AND COPYRIGHT
SQL::Schema is Copyright (C) 2000, Torsten Hentschel
Windmuehlenweg 47
44141 Dortmund
Germany
Email: [EMAIL PROTECTED]
All rights reserved.
You may distribute this package under the terms of either the GNU
General Public License or the Artistic License, as specified in the
Perl README file.
SEE ALSO
the SQL::Schema(3) manpage, the DBI(3) manpage
SQL-Schema-0.10.tar.gz