diff options
Diffstat (limited to 'site_perl/dbdef_column.pm')
-rw-r--r-- | site_perl/dbdef_column.pm | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/site_perl/dbdef_column.pm b/site_perl/dbdef_column.pm index 023b57d..dc07305 100644 --- a/site_perl/dbdef_column.pm +++ b/site_perl/dbdef_column.pm @@ -134,16 +134,21 @@ sub length { Returns an SQL column definition. -If passed a DBI $datasrc specifying L<DBD::mysql>, will use MySQL-specific -syntax. Non-standard syntax for other engines (if applicable) may also be -supported in the future. +If passed a DBI $datasrc specifying L<DBD::mysql> or L<DBD::Pg>, will use +engine-specific syntax. =cut sub line { my($self,$datasrc)=@_; my($null)=$self->null; - $null ||= "NOT NULL" if $datasrc =~ /mysql/; #yucky mysql hack + if ( $datasrc =~ /mysql/ ) { #yucky mysql hack + $null ||= "NOT NULL" + } + if ( $datasrc =~ /Pg/ ) { #yucky Pg hack + $null ||= "NOT NULL"; + $null =~ s/^NULL$//; + } join(' ', $self->name, $self->type. ( $self->length ? '('.$self->length.')' : '' ), @@ -159,6 +164,10 @@ sub line { L<FS::dbdef_table>, L<FS::dbdef>, L<DBI> +=head1 VERSION + +$Id: dbdef_column.pm,v 1.3 1998-10-13 13:04:17 ivan Exp $ + =head1 HISTORY class for dealing with column definitions @@ -169,6 +178,14 @@ now methods can be used to get or set data ivan@sisd.com 98-may-11 mySQL-specific hack for null (what should be default?) ivan@sisd.com 98-jun-2 +$Log: dbdef_column.pm,v $ +Revision 1.3 1998-10-13 13:04:17 ivan +fixed doc to indicate Pg specific syntax too + +Revision 1.2 1998/10/12 23:40:28 ivan +added Pg-specific behaviour in sub line + + =cut 1; |