ok.  a few hours of testing, and I've tracked all the issues down to  
prime_caches and modperl

since I'm managing connections externally, and passing rose a DB  
handle for every action, i had this:

        __PACKAGE__->default_domain('NULL');
        __PACKAGE__->default_type('NULL');
        __PACKAGE__->register_db(
                domain   => 'NULL',
                type     => 'NULL',
                driver   => 'Pg',
                database => 'NULL',
                host     => 'localhost',
                username => 'NULL',
                password => 'NULL',
        );

which caused every class to be mindlessly stupid as they could not  
prime correctly

i've since replaced that with the correct paramters for my 'config'  
handle, and then run a cleanup at the end of my startup.pl

sub _clear_db {

        __PACKAGE__->unregister_db(
                domain   => 'config',
                type     => 'config',
        );
        
        __PACKAGE__->default_domain('config');
        __PACKAGE__->default_type('config');
        __PACKAGE__->register_db(
                domain   => 'config',
                type     => 'config',
                driver   => 'Pg',
                database => 'NULL',
                host     => 'localhost',
                username => 'NULL',
                password => 'NULL',
        );
}

originally i registered the new domain as NULL/NULL, but that just  
created 2 sets of internal rose caches per object class. i found it  
odd how a lot of the data was cached as a per-db stash,  the bulk of  
it seemed redundant.  i imagine there are some edge cases where  
different DBs interact with the data in other ways.

in any event this is probably/possibly an error, as unregister_db  
does not seem to clear the internal rose data for the domain/type.  I  
was unsure of how to alter any options of a registered db post-  
config.  this works, so i'm using it.

i couldn't catch how the prime_caches exactly operates though (in  
terms of where its originally triggered).  so i'm going to ask these  
questions:

        a- currently, does this happen in a single connect, or is this on a  
per connect/disconnect basis
        b- if it is on a per connect-disconnect basis... would it be  
possible to push this into a single connection
        c- i know that its just SELECT arguments, but would it be possible  
to 'play it safe' and have an option to run the cache primes in begin/ 
rollback blocks?
        d- also, would it be possible to rework prime_all /prime to accept a  
rose db object? (suggestion below )
        e- fyi, if you unregister a db, the object classes still retain the  
per-db info.  they should probably discard it.

the reason why i'd like to do prime_all and a connect-disconnect is  
that i have a config db handle in modperl already that i do some  
class overloading to , in efforts to make sure I disconnect  
( sometimes I change code around and Apache::DBI gets called in too  
soon.   )  i'd love to just bool off cache priming, then run the  
whole cache priming with my dbh , and be able to make sure it  
disconnects.


lame illustration:

====

sub prime_all_caches
{
   my($class) = shift;
   my ( %args )= @_
   my $db = $args{'db'} || undef;

   foreach my $obj_class ($class->registered_classes)
   {
     $obj_class->meta->prime_caches( db=> $db );
   }
}

sub prime_caches
{
   my($self) = shift;
   my ( %args )= @_

   my @methods =
     qw(column_names num_columns nonlazy_column_names lazy_column_names
        column_rw_method_names column_accessor_method_names
        nonlazy_column_accessor_method_names column_mutator_method_names
        nonlazy_column_mutator_method_names  
nonlazy_column_db_value_hash_keys
        primary_key_column_db_value_hash_keys column_db_value_hash_keys
        column_accessor_method_names column_mutator_method_names
        column_rw_method_names);

   foreach my $method (@methods)
   {
     $self->$method();
   }

   my $db =   $args{'db'} ?  $args{'db'} || $self->class->init_db;

   $self->method_column('nonesuch');
   $self->fq_primary_key_sequence_names(db => $db);









// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| 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
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to