Permalink
Browse files

workaround for shadow tables and dbh method

  • Loading branch information...
1 parent 7007349 commit e4ce4e1fabbf599e9cd81960040d603b8594e9ad @racke racke committed Oct 4, 2005
Showing with 15 additions and 7 deletions.
  1. +10 −4 lib/Vend/Interpolate.pm
  2. +5 −3 lib/Vend/Table/Shadow.pm
View
@@ -1,6 +1,6 @@
# Vend::Interpolate - Interpret Interchange tags
#
-# $Id: Interpolate.pm,v 2.251 2005-08-20 02:54:54 jon Exp $
+# $Id: Interpolate.pm,v 2.252 2005-10-04 11:11:32 racke Exp $
#
# Copyright (C) 2002-2005 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@ package Vend::Interpolate;
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.251 $, 10);
+$VERSION = substr(q$Revision: 2.252 $, 10);
@EXPORT = qw (
@@ -1578,14 +1578,20 @@ sub tag_perl {
next if $Db{$tab};
my $db = database_exists_ref($tab);
next unless $db;
+ my $dbh;
$db = $db->ref();
if($db->config('type') == 10) {
my @extra_tabs = $db->_shared_databases();
push (@tab, @extra_tabs);
+ $dbh = $db->dbh();
+ } elsif ($db->can('dbh')) {
+ $dbh = $db->dbh();
}
+
if($hole) {
- $Sql{$tab} = $hole->wrap($db->dbh())
- if $db->can('dbh');
+ if ($dbh) {
+ $Sql{$tab} = $hole->wrap($dbh);
+ }
$Db{$tab} = $hole->wrap($db);
if($db->config('name') ne $tab) {
$Db{$db->config('name')} = $Db{$tab};
View
@@ -1,6 +1,6 @@
# Vend::Table::Shadow - Access a virtual "Shadow" table
#
-# $Id: Shadow.pm,v 1.50 2005-08-15 14:12:01 racke Exp $
+# $Id: Shadow.pm,v 1.51 2005-10-04 11:11:32 racke Exp $
#
# Copyright (C) 2002-2005 Stefan Hornburg (Racke) <racke@linuxia.de>
#
@@ -20,7 +20,7 @@
# MA 02111-1307 USA.
package Vend::Table::Shadow;
-$VERSION = substr(q$Revision: 1.50 $, 10);
+$VERSION = substr(q$Revision: 1.51 $, 10);
# CREDITS
#
@@ -99,7 +99,9 @@ sub close_table {
sub dbh {
my ($s) = shift;
$s = $s->import_db() unless defined $s->[$OBJ];
- return $s->[$OBJ]->dbh();
+ if ($s->[$OBJ]->can('dbh')) {
+ return $s->[$OBJ]->dbh();
+ }
}
sub name {

0 comments on commit e4ce4e1

Please sign in to comment.