0.20
authorivan <ivan>
Mon, 4 Mar 2002 12:59:13 +0000 (12:59 +0000)
committerivan <ivan>
Mon, 4 Mar 2002 12:59:13 +0000 (12:59 +0000)
Changes
DBSchema.pm
DBSchema/DBD/Pg.pm
DBSchema/Table.pm
README

diff --git a/Changes b/Changes
index 3845dec..0edd7d8 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,13 @@
 Revision history for Perl extension DBIx::DBSchema.
 
+0.20 Mon Mar  4 04:58:34 2002
+       - documentation updates
+       - fix Column->new when using named params
+       - fix Pg driver reverse-engineering length of numeric columns:
+         translate 655362 to 10,2, etc.
+       - fix Pg driver reverse-engineering of text columns (don't have a
+         length)
+
 0.19 Tue Oct 23 08:49:12 2001
        - documentation for %typemap
        - preliminary Sybase driver from Charles Shapiro
index 420d44f..c914a94 100644 (file)
@@ -14,7 +14,7 @@ use DBIx::DBSchema::ColGroup::Index;
 #@ISA = qw(Exporter);
 @ISA = ();
 
-$VERSION = "0.19";
+$VERSION = "0.20";
 
 =head1 NAME
 
index 76bcf2d..047a6c5 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use vars qw($VERSION @ISA %typemap);
 use DBIx::DBSchema::DBD;
 
-$VERSION = '0.03';
+$VERSION = '0.04';
 @ISA = qw(DBIx::DBSchema::DBD);
 
 %typemap = (
@@ -41,17 +41,27 @@ sub columns {
 END
   $sth->execute or die $sth->errstr;
   map {
+
+    my $len = '';
+    if ( $_->{attlen} == -1 && $_->{typname} ne 'text' ) {
+      $len = $_->{atttypmod} - 4;
+      if ( $_->{typname} eq 'numeric' ) {
+        $len = ($len >> 16). ','. ($len & 0xffff);
+      }
+    }
+
+    my $type = $_->{'typname'};
+    $type = 'char' if $type eq 'bpchar';
+
     [
       $_->{'attname'},
-      $_->{'typname'},
+      $type,
       ! $_->{'attnotnull'},
-      ( $_->{'attlen'} == -1
-        ? $_->{'atttypmod'} - 4
-        : ''
-      ),
+      $len,
       '', #default
       ''  #local
-    ]
+    ];
+
   } @{ $sth->fetchall_arrayref({}) };
 }
 
index 7714a15..0479de7 100644 (file)
@@ -31,7 +31,7 @@ DBIx::DBSchema::Table - Table objects
   #new style (preferred), pass a hashref of parameters
   $table = new DBIx::DBSchema::Table (
     {
-      table       => "table_name",
+      name        => "table_name",
       primary_key => "primary_key",
       unique      => $dbix_dbschema_colgroup_unique_object,
       'index'     => $dbix_dbschema_colgroup_index_object,
@@ -105,7 +105,7 @@ sub new {
   if ( ref($_[0]) ) {
 
     $self = shift;
-    $self->{column_order} = [ map { $_->_name } @{$self->{columns}} ];
+    $self->{column_order} = [ map { $_->name } @{$self->{columns}} ];
     $self->{columns} = { map { $_->name, $_ } @{$self->{columns}} };
 
   } else {
diff --git a/README b/README
index 67d434a..217477e 100644 (file)
--- a/README
+++ b/README
@@ -15,7 +15,7 @@ CREATE statements for different databases from a single source.
 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 the DBIx::DBSchema::DBD> manpage, "Driver Writer's Guide and
+welcomed.  See the DBIx::DBSchema::DBD manpage, "Driver Writer's Guide and
 Base Class".
 
 To install:
@@ -40,4 +40,4 @@ A mailing list is available.  Send a blank message to
 
 Homepage: <http://www.420.am/dbix-dbschema>
 
-$Id: README,v 1.6 2001-09-05 16:20:03 ivan Exp $
+$Id: README,v 1.7 2002-03-04 12:59:13 ivan Exp $