[interchange-cvs] interchange - racke modified lib/Vend/Table/Shadow.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Thu Apr 3 10:44:00 2003


User:      racke
Date:      2003-04-03 15:43:38 GMT
Modified:  lib/Vend/Table Shadow.pm
Log:
name method implemented
query method detects scalars in the opt parameter now

Revision  Changes    Path
1.26      +16 -2     interchange/lib/Vend/Table/Shadow.pm


rev 1.26, prev_rev 1.25
Index: Shadow.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/Shadow.pm,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Shadow.pm	1 Apr 2003 12:55:00 -0000	1.25
+++ Shadow.pm	3 Apr 2003 15:43:38 -0000	1.26
@@ -1,6 +1,6 @@
 # Vend::Table::Shadow - Access a virtual "Shadow" table
 #
-# $Id: Shadow.pm,v 1.25 2003/04/01 12:55:00 racke Exp $
+# $Id: Shadow.pm,v 1.26 2003/04/03 15:43:38 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.25 $, 10);
+$VERSION = substr(q$Revision: 1.26 $, 10);
 
 # TODO
 #
@@ -96,6 +96,12 @@
 	$s->[$OBJ]->close_table();
 }
 
+sub name {
+	my ($s) = shift;
+	$s = $s->import_db() unless defined $s->[$OBJ];
+	return $s->[$OBJ]->name();
+}
+
 sub columns {
 	my ($s) = shift;
 	$s = $s->import_db() unless defined $s->[$OBJ];
@@ -249,6 +255,14 @@
 sub query {
 	my($s, $opt, $text, @arg) = @_;
 
+	if (! CORE::ref($opt)) {
+		unshift @arg, $text if defined $text;
+		$text = $opt;
+		$opt = {};
+	}
+	$opt->{query} = $opt->{sql} || $text if ! $opt->{query};
+	$s = $s->import_db() unless defined $s->[$OBJ];
+	
 	if ($opt->{query}) {
 		# we try to analyse the query
 		my $qref = $s->_parse_sql($opt->{query});