On Fri, Jan 25, 2002 at 12:21:42PM +0100, Steffen Goeldner wrote:
> > 
> >  select * from v$version;
> > 
> >  select * from PRODUCT_COMPONENT_VERSION;
> > 
> >  set serveroutput on
> >  declare
> >    v varchar2(255);
> >    c varchar2(255);
> >  begin
> >    dbms_utility.db_version( v, c );
> >    dbms_output.put_line( v );
> >    dbms_output.put_line( c );
> >  end;
> >  /
> > 
> >  select dbms_utility.port_string from dual;
> > 
> > The attached file shows the results for Oracle8.
> > Unfortunately, I have no Oracle7 available. Is anybody so kind
> > and provides the results for Oracle7?
> 
> Looking at the results from Oracle8:
>   <http://www.xray.mpe.mpg.de/mailing-lists/dbi/2002-01/msg00525.html>
> and Oracle7:
>   <http://www.xray.mpe.mpg.de/mailing-lists/dbi/2002-01/msg00728.html>
> something like
>  SELECT version
>    FROM product_component_version
>   WHERE product LIKE 'Oracle%'
> should be a quite portable way.

I'd be a little nervous of that returning more than one row.
But lets wait and see if anyone complains :)

> The attached patch shows a possible implementation.
> 
> For get_info(SQL_DBMS_VERSION), we could use something like
> 
>   sprintf '%02d.%02d.%1d%1d%1d%1d', @{$dbh->{ora_server_version}}
> 
> 
> Steffen
> *** DBD-Oracle-1.12.orig/Oracle.pm    Fri Aug 31 18:27:18 2001
> --- Oracle.pm Fri Jan 25 11:37:32 2002
> ***************
> *** 580,585 ****
> --- 580,601 ----
>       return 1;
>       }
>   
> +     sub _server_version {

Might as well call it ora_server_version as well.

> +     my $dbh = shift;
> +     return $dbh->{ora_server_version} if defined $dbh->{ora_server_version};
> +     $dbh->{ora_server_version} = [];
> +     my $sth = $dbh->prepare(<<'SQL') or return [];
> + SELECT version
> +   FROM product_component_version
> +  WHERE product LIKE 'Oracle%'
> + SQL
> +     $sth->execute or return [];
> +     my $row = $sth->fetch or return [];
> +     $dbh->{ora_server_version} = [ split /\./, $row->[0] ];
> +     $sth->finish;

Tsk, tsk. I'd use $dbh->selectrow_array :)

:-)

Thanks Steffen.

(When I get to DBD::Oracle again, in a week or two hopefully, I
might ask you to resend all your patches just so I know I have the
latest of all of them.)

Tim.

Reply via email to