use strict;
use vars qw(@ISA $VERSION);
#use Exporter;
-#use Carp qw(verbose);
+use Carp qw(confess);
use DBI;
use FreezeThaw qw(freeze thaw cmpStr);
use DBIx::DBSchema::Table;
#@ISA = qw(Exporter);
@ISA = ();
-$VERSION = "0.13";
+$VERSION = "0.19";
=head1 NAME
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.
+Currently supported databases are MySQL and PostgreSQL. Sybase support is
+partially implemented. DBIx::DBSchema will attempt to use generic SQL syntax
+for other databases. Assistance adding support for other databases is
+welcomed. See L<DBIx::DBSchema::DBD>, "Driver Writer's Guide and Base Class".
=head1 METHODS
sub sql {
my($self, $dbh) = (shift, shift);
- $dbh = DBI->connect( $dbh, @_ ) or die $DBI::errstr
- unless ref($dbh) || ! @_;
- map { $self->table($_)->sql_create_table($dbh); } $self->tables;
+ my $created_dbh = 0;
+ unless ( ref($dbh) || ! @_ ) {
+ $dbh = DBI->connect( $dbh, @_ ) or die $DBI::errstr;
+ $created_dbh = 1;
+ }
+ my @r = map { $self->table($_)->sql_create_table($dbh); } $self->tables;
+ $dbh->disconnect if $created_dbh;
+ @r;
}
=item pretty_print
} else {
$dbh =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i #nicked from DBI->connect
or '' =~ /()/; # ensure $1 etc are empty if match fails
- $driver = $1 or die "can't parse data source: $dbh";
+ $driver = $1 or confess "can't parse data source: $dbh";
}
#require "DBIx/DBSchema/DBD/$driver.pm";
Ivan Kohler <ivan-dbix-dbschema@420.am>
+Charles Shapiro <charles.shapiro@numethods.com> and Mitchell Friedman
+<mitchell.friedman@numethods.com> contributed the start of a Sybase driver.
+
=head1 COPYRIGHT
Copyright (c) 2000 Ivan Kohler
L<DBIx::DBSchema::Table>, L<DBIx::DBSchema::ColGroup>,
L<DBIx::DBSchema::ColGroup::Unique>, L<DBIx::DBSchema::ColGroup::Index>,
-L<DBIx::DBSchema::Column>, L<DBIx::DBSchema::DBD>, L<DBIx::DBSchema::mysql>,
-L<DBIx::DBSchema::Pg>, L<FS::Record>, L<DBI>
+L<DBIx::DBSchema::Column>, L<DBIx::DBSchema::DBD>,
+L<DBIx::DBSchema::DBD::mysql>, L<DBIx::DBSchema::DBD::Pg>, L<FS::Record>,
+L<DBI>
=cut