Re: [RDBO] dbh caching

2007-04-19 Thread Ask Bjørn Hansen
On Apr 19, 2007, at 9:37 PM, Bill Moseley wrote: > It's the Manager that seems to be closing the connection. > Perhaps I'm using it incorrectly? I don't really know what I'm talking about here, but in our Rose::DB class[1] we have this, sub DESTROY { } # Avoid disconnect being called (the de

Re: [RDBO] dbh caching

2007-04-19 Thread Bill Moseley
On Thu, Apr 19, 2007 at 04:59:18PM -0400, John Siracusa wrote: > The full DBI trace output is included below. I don't see multiple > disconnects (or any disconnects, really) in the output, so I'm pretty > sure it's only using one $dbh. It's the Manager that seems to be closing the connection. Per

Re: [RDBO] Scratchpad Space in RDBOs???

2007-04-19 Thread Jonathan Vanasco
On Apr 19, 2007, at 3:47 PM, John Siracusa wrote: > Anyway, you can read more about this family of method-makers here: > > http://search.cpan.org/dist/Rose-Object/ > > Many others exist on CPAN. As long as the method names and hash keys > don't conflict with any columns, fks, or relationship

Re: [RDBO] dbh caching

2007-04-19 Thread John Siracusa
Given this code: package A; use base 'Rose::DB::Object'; __PACKAGE__->meta->setup(table => 't1', columns => [ qw(id a) ]); our $DB; sub init_db { my $dbh = DBI->connect_cached('DBI:mysql:test', 'root'); return $DB = Rose::DB->new(driver => 'mysql', dbh => $dbh) unless($DB)

Re: [RDBO] dbh caching

2007-04-19 Thread Bill Moseley
On Thu, Apr 19, 2007 at 02:48:24PM -0400, John Siracusa wrote: > Okay, so: > > our $DB; > > sub init_db > { > ... > my $dbh = DBI->connect_cached(@params); > return $DB = App::RDB->new(dbh => $dbh) unless($DB); > $DB->dbh($dbh); > return $DB; > } I'

Re: [RDBO] Scratchpad Space in RDBOs???

2007-04-19 Thread John Siracusa
Oh, and of course you can always use Rose::Object::MakeMethods::* to make new attributes. So long as none of the created methods conflict with existing methods in a class, you'll be fine--and you won't have to know anything about the internals :) Example (mostly from the POD synopsis for this mod

Re: [RDBO] Scratchpad Space in RDBOs???

2007-04-19 Thread John Siracusa
On 4/19/07, Jeffrey Horn <[EMAIL PROTECTED]> wrote: > Is there a place in an RDBO that I can use to stash this sort of information > that isn't supposed to get sent to the db on a save? How could I make such > a scratchpad space myself? There's no official place, but as long as you don't squish a

[RDBO] Scratchpad Space in RDBOs???

2007-04-19 Thread Jeffrey Horn
I have a table with several encrypted attributes. I'd like to add methods to my RDBO for that table that can take cleartext for each of those fields and set the encrypted value or get the cleartext for a field from the current encrypted value. In order to speed this up (I actually need to connect

Re: [RDBO] dbh caching

2007-04-19 Thread John Siracusa
On 4/19/07, Bill Moseley <[EMAIL PROTECTED]> wrote: > On Thu, Apr 19, 2007 at 10:35:16AM -0400, John Siracusa wrote: >> On 4/18/07, Bill Moseley <[EMAIL PROTECTED]> wrote: >>> This works fine in my base class: >>> >>> sub init_db { our $DBH =|| App::RDB->new } >>> >>> I've got the same $dbh for the

Re: [RDBO] dbh caching

2007-04-19 Thread Bill Moseley
On Thu, Apr 19, 2007 at 10:35:16AM -0400, John Siracusa wrote: > On 4/18/07, Bill Moseley <[EMAIL PROTECTED]> wrote: > > This works fine in my base class: > > > > sub init_db { our $DBH =|| App::RDB->new } > > > > I've got the same $dbh for the life of the program. > > > > But, I'd like to try

Re: [RDBO] dbh caching

2007-04-19 Thread John Siracusa
On 4/18/07, Bill Moseley <[EMAIL PROTECTED]> wrote: > This works fine in my base class: > > sub init_db { our $DBH =|| App::RDB->new } > > I've got the same $dbh for the life of the program. > > But, I'd like to try using DBI->connect_cached directly. What's your goal? Do you still want just