From: ivan Date: Tue, 23 Oct 2001 15:47:26 +0000 (+0000) Subject: hopefully finally get rid of the X-Git-Tag: DBIX_DBSCHEMA_0_19~1 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=167b42c710896397f868a56c0904d77a4094ebe8;p=DBIx-DBSchema.git hopefully finally get rid of the Use of uninitialized value at /usr/local/lib/perl5/site_perl/5.005/DBIx/DBSchema/Column.pm line 251. errors correct Column::line returns a scalar, not a list. test the DBD drivers too 0.19 (test) release --- diff --git a/DBSchema/Column.pm b/DBSchema/Column.pm index f601014..4e26646 100644 --- a/DBSchema/Column.pm +++ b/DBSchema/Column.pm @@ -1,13 +1,15 @@ package DBIx::DBSchema::Column; use strict; -use vars qw(@ISA); +use vars qw(@ISA $VERSION); #use Carp; #use Exporter; #@ISA = qw(Exporter); @ISA = qw(); +$VERSION = '0.02'; + =head1 NAME DBIx::DBSchema::Column - Column objects @@ -248,22 +250,24 @@ sub line { $null =~ s/^NULL$//; } - my @r = join(' ', + my $r = join(' ', $self->name, - $type. - ( defined($self->length) && $self->length ? '('.$self->length.')' : '' ), + $type. ( ( defined($self->length) && $self->length ) + ? '('.$self->length.')' + : '' + ), $null, ( ( defined($default) && $default ne '' ) ? 'DEFAULT '. $default : '' ), - ( ( $driver eq 'mysql' ) + ( ( $driver eq 'mysql' && defined($self->local) ) ? $self->local : '' ), ); $dbh->disconnect if $created_dbh; - @r; + $r; } diff --git a/DBSchema/Table.pm b/DBSchema/Table.pm index 96618b5..aa50392 100644 --- a/DBSchema/Table.pm +++ b/DBSchema/Table.pm @@ -4,7 +4,7 @@ use strict; use vars qw(@ISA %create_params); #use Carp; #use Exporter; -use DBIx::DBSchema::Column; +use DBIx::DBSchema::Column 0.02; use DBIx::DBSchema::ColGroup::Unique; use DBIx::DBSchema::ColGroup::Index; @@ -387,7 +387,7 @@ sub sql_create_table { # #change it back afterwords :/ # } - my(@columns)=map { $self->column($_)->line($dbh) } $self->columns; + my @columns = map { $self->column($_)->line($dbh) } $self->columns; push @columns, "PRIMARY KEY (". $self->primary_key. ")" #if $self->primary_key && $driver ne 'Pg'; diff --git a/test.pl b/test.pl index 2948bbe..cf94f0a 100644 --- a/test.pl +++ b/test.pl @@ -9,6 +9,8 @@ BEGIN { $| = 1; print "1..1\n"; } END {print "not ok 1\n" unless $loaded;} use DBIx::DBSchema; +use DBIx::DBSchema::DBD::Pg; +use DBIx::DBSchema::DBD::mysql; $loaded = 1; print "ok 1\n";