embedding DB handle in object (was RE: adding key to DB object)
From: Brandon Metcalf (bmetcalf_at_nortel.com)
Date: 03/30/05
- Next message: Tim Bunce: "Re: embedding DB handle in object (was RE: adding key to DB object)"
- Previous message: Brandon Metcalf: "RE: adding key to DB object"
- In reply to: Brandon Metcalf: "RE: adding key to DB object"
- Next in thread: Tim Bunce: "Re: embedding DB handle in object (was RE: adding key to DB object)"
- Reply: Tim Bunce: "Re: embedding DB handle in object (was RE: adding key to DB object)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Mar 2005 16:58:53 -0600 (CST) To: "Rutherdale, Will" <Will.Rutherdale@sciatl.com>
In trying to take your suggesting and embed a DB handle in my own
object, this is what i've come up with. However, a error is being
thrown when DBI is trying to destory the handle which I understand.
What I don't get is how to do this properly.
This may be inappropriate for this forum.
$ cat jj
#!/usr/bin/perl
use strict;
use warnings;
use ii;
my $dbh = ii->dbconnect_new();
__END__
$ cat ii.pm
package ii;
use strict;
use warnings;
use DBI;
use vars qw{ @EXPORT @ISA};
use Exporter;
@ISA = qw{ Exporter DBI::db };
@EXPORT = qw{ &dbconnect_new };
sub dbconnect_new {
my ($pkg, $dbname) = @_;
my $dbh;
$dbh->{dbhandle} = DBI->connect("dbi:Pg:dbname='mydb';host='myhost'");
bless $dbh, $pkg;
}
1;
__END__
$ ./jj
SV = RV(0x810eb70) at 0xbfffdb10
REFCNT = 1
FLAGS = (ROK,READONLY)
RV = 0x8108240
(in cleanup) dbih_getcom handle ii=HASH(0x8108240) is not a DBI handle (has no magic).
-- Brandon
- Next message: Tim Bunce: "Re: embedding DB handle in object (was RE: adding key to DB object)"
- Previous message: Brandon Metcalf: "RE: adding key to DB object"
- In reply to: Brandon Metcalf: "RE: adding key to DB object"
- Next in thread: Tim Bunce: "Re: embedding DB handle in object (was RE: adding key to DB object)"
- Reply: Tim Bunce: "Re: embedding DB handle in object (was RE: adding key to DB object)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|