[interchange-cvs] interchange - racke modified 2 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Thu Apr 3 16:31:01 2003
User: racke
Date: 2003-04-03 21:30:22 GMT
Modified: lib/Vend Config.pm
Modified: lib/Vend/Table Shadow.pm
Log:
moved Shadow configuration to Shadow module
Revision Changes Path
2.106 +3 -52 interchange/lib/Vend/Config.pm
rev 2.106, prev_rev 2.105
Index: Config.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Config.pm,v
retrieving revision 2.105
retrieving revision 2.106
diff -u -r2.105 -r2.106
--- Config.pm 2 Apr 2003 19:08:29 -0000 2.105
+++ Config.pm 3 Apr 2003 21:30:22 -0000 2.106
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.105 2003/04/02 19:08:29 mheins Exp $
+# $Id: Config.pm,v 2.106 2003/04/03 21:30:22 racke Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
# Copyright (C) 2003 ICDEVGROUP <interchange@icdevgroup.org>
@@ -48,7 +48,7 @@
use Vend::File;
use Vend::Data;
-$VERSION = substr(q$Revision: 2.105 $, 10);
+$VERSION = substr(q$Revision: 2.106 $, 10);
my %CDname;
my %CPname;
@@ -3245,56 +3245,7 @@
}
}
elsif ($p eq 'MAP') {
- my @f = split(/\s+/, $val);
- my %parms;
- my %map_options = (fallback => 1);
- my ($map_table, $map_column);
-
- if (@f < 2) {
- config_error("At least two parameters needed for MAP.");
- } elsif (@f == 2) {
- @f = ($f[0], 'default', $f[1]);
- }
-
- my $field = shift @f;
-
- if (@f % 2) {
- config_error("Incomplete parameter list for MAP.");
- }
-
- # now we have a valid configuration and change the database type
- # if necessary
-
- unless ($d->{type} eq 10) {
- $d->{OrigClass} = $d->{Class};
- $d->{Class} = 'SHADOW';
- $d->{type} = 10;
- }
-
- while (@f) {
- my $map_key = shift @f;
- my $map_value = shift @f;
-
- if (exists $map_options{$map_key}) {
- # option like fallback
- $d->{MAP}->{$field}->{$map_key} = $map_value;
- } else {
- # mapping direction
- if ($map_value =~ m%^((.*?)::(.*?)/)?(.*?)::(.*)%) {
- if ($1) {
- $d->{MAP}->{$field}->{$map_key} = {lookup_table => $2,
- lookup_column => $3,
- table => $4,
- column => $5}
- } else {
- $d->{MAP}->{$field}->{$map_key} = {table => $4,
- column => $5};
- }
- } else {
- $d->{MAP}->{$field}->{$map_key} = {column => $map_value};
- }
- }
- }
+ Vend::Table::Shadow::_parse_config_line ($d, $val);
}
else {
1.27 +56 -2 interchange/lib/Vend/Table/Shadow.pm
rev 1.27, prev_rev 1.26
Index: Shadow.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/Shadow.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Shadow.pm 3 Apr 2003 15:43:38 -0000 1.26
+++ Shadow.pm 3 Apr 2003 21:30:22 -0000 1.27
@@ -1,6 +1,6 @@
# Vend::Table::Shadow - Access a virtual "Shadow" table
#
-# $Id: Shadow.pm,v 1.26 2003/04/03 15:43:38 racke Exp $
+# $Id: Shadow.pm,v 1.27 2003/04/03 21:30:22 racke Exp $
#
# Copyright (C) 2002-2003 Stefan Hornburg (Racke) <racke@linuxia.de>
#
@@ -20,7 +20,7 @@
# MA 02111-1307 USA.
package Vend::Table::Shadow;
-$VERSION = substr(q$Revision: 1.26 $, 10);
+$VERSION = substr(q$Revision: 1.27 $, 10);
# TODO
#
@@ -289,6 +289,60 @@
my ($s, $key) = @_;
$s = $s->import_db() unless defined $s->[$OBJ];
$s->[$OBJ]->reset();
+}
+
+sub _parse_config_line {
+ my ($d, $val) = @_;
+ my @f = split(/\s+/, $val);
+ my %parms;
+ my %map_options = (fallback => 1);
+ my ($map_table, $map_column);
+
+ if (@f < 2) {
+ Vend::Config::config_error("At least two parameters needed for MAP.");
+ } elsif (@f == 2) {
+ @f = ($f[0], 'default', $f[1]);
+ }
+
+ my $field = shift @f;
+
+ if (@f % 2) {
+ Vend::Config::config_error("Incomplete parameter list for MAP.");
+ }
+
+ # now we have a valid configuration and change the database type
+ # if necessary
+
+ unless ($d->{type} eq 10) {
+ $d->{OrigClass} = $d->{Class};
+ $d->{Class} = 'SHADOW';
+ $d->{type} = 10;
+ }
+
+ while (@f) {
+ my $map_key = shift @f;
+ my $map_value = shift @f;
+
+ if (exists $map_options{$map_key}) {
+ # option like fallback
+ $d->{MAP}->{$field}->{$map_key} = $map_value;
+ } else {
+ # mapping direction
+ if ($map_value =~ m%^((.*?)::(.*?)/)?(.*?)::(.*)%) {
+ if ($1) {
+ $d->{MAP}->{$field}->{$map_key} = {lookup_table => $2,
+ lookup_column => $3,
+ table => $4,
+ column => $5}
+ } else {
+ $d->{MAP}->{$field}->{$map_key} = {table => $4,
+ column => $5};
+ }
+ } else {
+ $d->{MAP}->{$field}->{$map_key} = {column => $map_value};
+ }
+ }
+ }
}
sub _parse_sql {