From: Rafael Kitover Date: Thu, 25 Mar 2010 06:37:36 +0000 (+0000) Subject: add storage->_server_info->{dbms_ver_normalized} X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fde789c7885f0e583c2f4f6bb22f715b1825f88d;p=dbsrgits%2FDBIx-Class-Historic.git add storage->_server_info->{dbms_ver_normalized} --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index e9190a2..b669aa0 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -940,7 +940,12 @@ sub _populate_server_info { my $dbms_ver = eval { local $@; $self->_get_dbh->get_info(18) }; - $info{dbms_ver} = $dbms_ver if defined $dbms_ver; + if (defined $dbms_ver) { + $info{dbms_ver} = $dbms_ver; + + my @verparts = split /\./, $dbms_ver; + $info{dbms_ver_normalized} = sprintf "%d.%03d%03d", @verparts; + } $self->__server_info(\%info); diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 6d9d2e7..250707b 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -19,10 +19,8 @@ warn __PACKAGE__.": DBD::Pg 2.9.2 or greater is strongly recommended\n" sub can_insert_returning { my $self = shift; - my ($major, $minor) = $self->_server_info->{dbms_ver} =~ /^(\d+)\.(\d+)/; - return 1 - if ($major > 8) || ($major == 8 && $minor >= 2); + if $self->_server_info->{dbms_ver_normalized} >= 8.002; return 0; }