Connection parameters and cloning

From: Andy Lauder (Andy.Lauder_at_airbus.com)
Date: 05/13/04


Date: Thu, 13 May 2004 13:46:28 +0100
To: 'DBI User' <dbi-users@perl.org>

All,

The clone method copies across the connection parameter values from the
original connection parameter values. It does not copy across the
connection parameter values as they are at the time of the clone.

This is shown in the two examples below.

It is working as described in the manual pages but what is the reasoning
behind this?

DBI-1.42 DBD-Oracle-1.15

Example 1 - (Shows working as described in manual pages):

use DBI;
use DBD::Oracle qw(:ora_types);

$dbh =
DBI->connect("dbi:Oracle:","username","password",{ora_ph_type=>ORA_CHAR});
$ph_type = $dbh->{ora_ph_type};
print "ora_ph_type for original is :$ph_type:\n"; # prints 96

$dbh2 = $dbh->clone();
$ph_type = $dbh2->{ora_ph_type};
print "ora_ph_type for clone is :$ph_type:\n"; # prints 96

Example 2 (Shows case where ora_ph_type is copied from original connection
parameter values, not the values at the time of the clone):

use DBI;
use DBD::Oracle qw(:ora_types);

$dbh = DBI->connect("dbi:Oracle:","username","password");
$ph_type = $dbh->{ora_ph_type};
print "ora_ph_type for original is :$ph_type:\n"; # prints 1

$dbh->{ora_ph_type} = ORA_CHAR;
$ph_type = $dbh->{ora_ph_type};
print "reset ora_ph_type for original to :$ph_type:\n"; # prints 96

$dbh2 = $dbh->clone();
$ph_type = $dbh2->{ora_ph_type};
print "ora_ph_type for clone is :$ph_type:\n"; # prints 1

This e-mail is intended only for the above addressee. It may contain
privileged information. If you are not the addressee you must not copy,
distribute, disclose or use any of the information in it. If you have
received it in error please delete it and immediately notify the sender.
Security Notice: all e-mail, sent to or from this address, may be
accessed by someone other than the recipient, for system management and
security reasons. This access is controlled under Regulation of
Investigatory Powers Act 2000, Lawful Business Practises.