use DBI;
use FreezeThaw qw(freeze thaw cmpStr);
use DBIx::DBSchema::Table;
+use DBIx::DBSchema::Column;
+use DBIx::DBSchema::ColGroup::Unique;
+use DBIx::DBSchema::ColGroup::Index;
#@ISA = qw(Exporter);
@ISA = ();
DBIx::DBSchema objects are collections of DBIx::DBSchema::Table objects and
represent a database schema.
+This module implements an OO-interface to database schemas. Using this module,
+you can create a database schema with an OO Perl interface. You can read the
+schema from an existing database. You can save the schema to disk and restore
+it a different process. Most importantly, DBIx::DBSchema can write SQL
+CREATE statements statements for different databases from a single source.
+
+Currently supported databases are MySQL and PostgreSQL. DBIx::DBSchema will
+attempt to use generic SQL syntax for other databases. Assistance adding
+support for other databases is welcomed.
+
=head1 METHODS
=over 4
=cut
sub pretty_read {
- die "unimplemented (pull from fs-setup)";
- my($proto) = @_;
+ my($proto, $href) = @_;
+ my $schema = proto->new( map {
+ my(@columns);
+ while (@{$tables{$_}{'columns'}}) {
+ my($name,$type,$null,$length)=splice @{$tables{$_}{'columns'}}, 0, 4;
+ push @columns, new DBIx::DBSchema::Column ( $name,$type,$null,$length );
+ }
+ DBIx::DBSchema::Table->new(
+ $_,
+ $tables{$_}{'primary_key'},
+ DBIx::DBSchema::ColGroup::Unique->new($tables{$_}{'unique'}),
+ DBIx::DBSchema::ColGroup::Index->new($tables{$_}{'index'}),
+ @columns,
+ );
+ } (keys %tables) );
}
# private subroutines
you can create a database schema with an OO Perl interface. You can read the
schema from an existing database. You can save the schema to disk and restore
it a different process. Most importantly, DBIx::DBSchema can write SQL
-statements to create the given schema.
+CREATE statements statements for different databases from a single source.
Currently supported databases are MySQL and PostgreSQL. DBIx::DBSchema will
attempt to use generic SQL syntax for other databases. Assistance adding
Homepage: <http://www.420.am/dbix-dbschema>
-$Id: README,v 1.2 2000-09-27 11:51:36 ivan Exp $
+$Id: README,v 1.3 2000-09-27 12:40:35 ivan Exp $