cvs commit: p5ee/App-Repository/lib/App/SessionObject RepositoryObjectDomain.pm RepositoryObjectSet.pm

[email protected] (Stephen Adkins)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
cvsuser     05/09/13 08:10:39

  Modified:    App-Repository CHANGES MANIFEST TODO
               App-Repository/lib/App/SessionObject
                        RepositoryObjectDomain.pm RepositoryObjectSet.pm
  Log:
  configure objset columns and domain-to-objset param mappings
  
  Revision  Changes    Path
  1.4       +10 -2     p5ee/App-Repository/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/CHANGES,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CHANGES	9 Aug 2005 18:58:14 -0000	1.3
  +++ CHANGES	13 Sep 2005 15:10:38 -0000	1.4
  @@ -2,12 +2,20 @@
   # CHANGE LOG
   #########################################
   
  +0.96 (unreleased)
  + x App::SessionObject::RepositoryObjectSet - enable relevant "columns" to be configured (limits them)
  + x App::SessionObject::RepositoryObjectDomain - can configure mappings of domain params to individual object set params
  + x $rep->new_object() calls class-specific (RepositoryObject) _init() method to set up object values
  + x $rep->new_object() now adds configured "default" values
  + x $rep->new_object() now throws an exception for NULL values in "not_null" and alternate key columns
  + x $rep->new_object() has option { temp => 1 } that doesn't create the RepositoryObject in the repository
  +
   0.95
    x add "config_from_options" as a default behavior for App::Repository::DBI
    x add $rep->new_object($table, {@initializers}); (and tests)
    x add $repobj->delete(); (and tests)
  - x add $rep->export_rows(...)  (export to file)
  - x add $rep->import_rows(...)  (import from file)
  + x add $rep->import_rows(...)  (import from file) (handles CSV by default)
  + x add $rep->export_rows(...)  (export to file)   (handles CSV by default)
   
   0.94
    x add "distinct => 1" to options hash for get_rows()/get_row()
  
  
  
  1.9       +1 -0      p5ee/App-Repository/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/MANIFEST,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MANIFEST	5 Apr 2005 18:50:36 -0000	1.8
  +++ MANIFEST	13 Sep 2005 15:10:38 -0000	1.9
  @@ -22,3 +22,4 @@
   t/DBI-select.t
   t/DBI-update.t
   t/FileSystem.t
  +META.yml                                 Module meta-data (added by MakeMaker)
  
  
  
  1.6       +24 -23    p5ee/App-Repository/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/TODO,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TODO	9 Aug 2005 18:58:14 -0000	1.5
  +++ TODO	13 Sep 2005 15:10:38 -0000	1.6
  @@ -6,33 +6,34 @@
    o change the test suites to be driven by App::Options (dbdriver/dbhost/dbname/dbuser/dbpass)
    o implement App::Repository::File and App::Repository::FileSystem
    o go over the documentation which is terrible and has been completely neglected
  + o ensure it runs (and tests cleanly!) on MSWin32
   
   Other stuff
    o caching rows by key
    o caching row-sets by set-key
  - o DBI   - refactored/unified params/cols/values handling
  -           - arbitrarily complex where clauses
  -           - clear separation between "eq", "in" and implied ops
  - o DBI   - auto-reconnect on all operations
  - o DBI   - bind variables on all operations
  - o all   - benchmarks
  - o Remote- make a remote repository work
  - o all   - get related rows (relationships)
  - o all   - $rep->set_rows(...) - make work with %$params
  + o DBI    - refactored/unified params/cols/values handling
  +            - arbitrarily complex where clauses
  +            - clear separation between "eq", "in" and implied ops
  +            - add "not_in" operator
  +            - add implied operators from the value (i.e. ">3", "!2,3")
  + o DBI    - auto-reconnect on all operations
  + o DBI    - bind variables on all operations
  + o all    - benchmarks
  + o Remote - make a remote repository work
  + o all    - get related rows (relationships)
  + o all    - $rep->set_rows(...) - make work with %$params
   
  - o MySQL - Shared connections between repositories
  + o MySQL  - Shared connections between repositories
    o File
  - o all   - $rep->purge(...)
  - o MySQL - $rep->purge(...)
  + o all    - $rep->purge(...)
  + o MySQL  - $rep->purge(...)
   
  - o all   - $rep->maintain(...)
  - o all   - summaries
  - o all   - partitions
  - o all   - defaults
  - o all   - required cols
  - o all   - Read-only
  - o all   - read/write permissions
  - o all   - ID generation
  - o DBI   - ID generation
  - o DBI   - "statement" cache, allows prepare/execute optimization
  + o all    - $rep->maintain(...)
  + o all    - summaries
  + o all    - partitions
  + o all    - Read-only
  + o all    - read/write permissions
  + o all    - ID generation
  + o DBI    - ID generation
  + o DBI    - "statement" cache, allows prepare/execute optimization
   
  
  
  
  1.5       +37 -15    p5ee/App-Repository/lib/App/SessionObject/RepositoryObjectDomain.pm
  
  Index: RepositoryObjectDomain.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/lib/App/SessionObject/RepositoryObjectDomain.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RepositoryObjectDomain.pm	9 Aug 2005 18:46:22 -0000	1.4
  +++ RepositoryObjectDomain.pm	13 Sep 2005 15:10:38 -0000	1.5
  @@ -47,7 +47,7 @@
           @tables = ($table);
       }
       else {
  -        my $object_set = $self->{object_set};
  +        my $object_set = $self->{table};
           if (ref($object_set) eq "HASH") {
               foreach my $table (keys %$object_set) {
                   if ($object_set->{$table}{gotten}) {
  @@ -60,7 +60,7 @@
       my $context = $self->{context};
       my ($object_set_name, $object_set);
       foreach my $table (@tables) {
  -        $object_set_name = $self->{object_set}{$table}{name} || "$self->{name}-$table";
  +        $object_set_name = $self->{table}{$table}{name} || "$self->{name}-$table";
           $object_set = $context->session_object($object_set_name);
           $object_set->_clear_cache();
       }
  @@ -79,23 +79,45 @@
       &App::sub_entry if ($App::trace);
       my ($self, $table) = @_;
       my $context = $self->{context};
  -    my $params = $self->{params} || {};
  +    my $domain_params = $self->{params} || {};
   
  -    my $object_set_name = $self->{object_set}{$table}{name} || "$self->{name}-$table";
  -    my $args = $self->{object_set}{$table}{args} || {};
  -    if (!$args->{class}) {
  -        $args->{class} = "App::SessionObject::RepositoryObjectSet";
  +    my $tabledef = $self->{table}{$table};
  +    if (!$tabledef) {
  +        $tabledef = {};
  +        $self->{table}{$table} = $tabledef;
       }
  -    if (!$args->{table}) {
  -        $args->{table} = $table;
  +
  +    my $object_set_name = $tabledef->{name} || "$self->{name}-$table";
  +    my $new_args = $tabledef->{new_args} || {};
  +    if (!$new_args->{class}) {
  +        $new_args->{class} = "App::SessionObject::RepositoryObjectSet";
  +    }
  +    if (!$new_args->{table}) {
  +        $new_args->{table} = $table;
       }
  -    if (!$args->{params}) {
  -        $args->{params} = $params;
  +    if (!$new_args->{params}) {
  +        if ($tabledef->{params}) {
  +            $new_args->{params} = $tabledef->{params};
  +        }
  +        else {
  +            $new_args->{params} = $domain_params;
  +        }
       }
  -    my $object_set = $context->session_object($object_set_name, %$args);
  -    $self->{object_set}{$table}{gotten} = 1;
  +    my $object_set = $context->session_object($object_set_name, %$new_args);
  +    $tabledef->{gotten} = 1;
   
  -    $object_set->update_params($params);
  +    if ($tabledef->{params}) {
  +        my (%object_set_param_values, $domain_param);
  +        my $corresponding_domain_param = $tabledef->{params};
  +        foreach my $set_param (keys %$corresponding_domain_param) {
  +            $domain_param = $corresponding_domain_param->{$set_param};
  +            $object_set_param_values{$set_param} = $domain_params->{$domain_param};
  +        }
  +        $object_set->update_params(\%object_set_param_values);
  +    }
  +    else {
  +        $object_set->update_params($domain_params);
  +    }
       &App::sub_exit($object_set) if ($App::trace);
       return($object_set);
   }
  
  
  
  1.6       +3 -2      p5ee/App-Repository/lib/App/SessionObject/RepositoryObjectSet.pm
  
  Index: RepositoryObjectSet.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/App-Repository/lib/App/SessionObject/RepositoryObjectSet.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RepositoryObjectSet.pm	31 Mar 2005 20:04:01 -0000	1.5
  +++ RepositoryObjectSet.pm	13 Sep 2005 15:10:38 -0000	1.6
  @@ -118,7 +118,8 @@
           my $rep     = $context->repository($repname);
           my $table   = $self->{table} || die "table not defined";
           my $params  = $self->{params} || {};
  -        $objects = $rep->get_objects($table, $params);
  +        my $columns = $self->{columns};
  +        $objects = $rep->get_objects($table, $params, $columns);
           $self->{objects} = $objects;
           $self->{max_age_time} = time();
       }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.