On Feb 8, 2007, at 5:58 PM, John Siracusa wrote:
> On 2/8/07 5:54 PM, Jonathan Vanasco wrote:
>>> Er, that's a "it already is a get/set method in the latest version."
>>
>> http://search.cpan.org/~jsiracusa/Rose-DB-Object/lib/Rose/DB/
>> Object.pm#dbh
>
> Oh, *that* dbh :) That's some old, probably now inappropriate
> code. I'll
> change it to what the docs say it should be: a proxy for db->dbh()
actually, how do you feel about this replacement routine?
sub dbh
{
my($self,$new_dbh) = shift;
my $db = $self->db or return 0;
if ( defined $new_dbh )
{
$db->dbh( $new_dbh );
}
if(my $dbh = $db->dbh)
{
return $dbh;
}
else
{
$self->error($db->error);
$self->meta->handle_error($self);
return undef;
}
}
which makes it get-set -- and in terms of the db object.
plus i killed the internal caching you did, which made no sense to me.
diff-wise, it would be:
sub dbh
{
- my($self) = shift;
+ my($self,$new_dbh) = shift;
- return $self->{'dbh'} if($self->{'dbh'});
my $db = $self->db or return 0;
+ if ( defined $new_dbh )
+ {
+ $db->dbh( $new_dbh );
+ }
if(my $dbh = $db->dbh)
{
- return $self->{'dbh'} = $dbh;
return $dbh;
}
else
{
$self->error($db->error);
$self->meta->handle_error($self);
return undef;
}
}
// Jonathan Vanasco
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object