cvsuser 02/06/07 14:59:45
Modified: P5EEx/Blue/P5EEx/Blue Repository.pm
Log:
added default behaviors to make this a generic class rather than strictly an
abstract class
Revision Changes Path
1.14 +24 -16 p5ee/P5EEx/Blue/P5EEx/Blue/Repository.pm
Index: Repository.pm
===================================================================
RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Repository.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -r1.13 -r1.14
--- Repository.pm 17 Apr 2002 19:19:16 -0000 1.13
+++ Repository.pm 7 Jun 2002 21:59:45 -0000 1.14
@@ -1,6 +1,6 @@
#############################################################################
-## $Id: Repository.pm,v 1.13 2002/04/17 19:19:16 spadkins Exp $
+## $Id: Repository.pm,v 1.14 2002/06/07 21:59:45 spadkins Exp $
#############################################################################
package P5EEx::Blue::Repository;
@@ -333,7 +333,7 @@
=cut
-sub connect { 1; } # OVERRIDE IN SUBCLASS
+sub connect { 1; }
#############################################################################
# disconnect()
@@ -363,7 +363,7 @@
=cut
-sub disconnect { 1; } # OVERRIDE IN SUBCLASS
+sub disconnect { 1; }
#############################################################################
# is_connected()
@@ -390,7 +390,7 @@
=cut
-sub is_connected { 1; } # OVERRIDE IN SUBCLASS
+sub is_connected { 1; }
#############################################################################
# error()
@@ -419,7 +419,7 @@
=cut
-sub error { # OVERRIDE IN SUBCLASS
+sub error {
my $err = $_[0]->{error};
$err ? $err : "";
}
@@ -450,7 +450,7 @@
=cut
-sub numrows { # OVERRIDE IN SUBCLASS
+sub numrows {
my $num = $_[0]->{numrows};
$num ? $num : 0;
}
@@ -883,7 +883,9 @@
=cut
# $row = $rep->select_row ($table, \@cols, \@params, \%paramvalues);
-sub select_row { undef; } # OVERRIDE IN SUBCLASS
+sub select_row {
+ my ($self, $table, $cols, $params, $paramvalues) = @_;
+}
#############################################################################
# select_rows()
@@ -932,7 +934,13 @@
=cut
-sub select_rows { undef; } # OVERRIDE IN SUBCLASS
+sub select_rows {
+ my ($self, $table, $cols, $params, $paramvalues, $startrow, $endrow) = @_;
+ my ($data, $idx);
+ $data = $self->{data};
+ return [] if (!$data);
+ return $data;
+}
#############################################################################
# insert_row()
@@ -2361,6 +2369,9 @@
my ($table, $tables, $table_defs, $table_def, $native_table, $idx);
+ # load up all possible information from the native metadata
+ $self->load_rep_metadata_auto();
+
# start with the list of tables that was configured (or the empty list)
$tables = $self->{tables};
if (!defined $tables) {
@@ -2434,9 +2445,6 @@
$type = $types->[$idx];
$self->{type}{$type}{idx} = $idx;
}
-
- # load up all additional information from the native metadata
- $self->load_rep_metadata_auto();
}
#############################################################################
@@ -2465,7 +2473,7 @@
=cut
-sub load_rep_metadata_auto { # OVERRIDE IN SUBCLASS (IF DESIRED)
+sub load_rep_metadata_auto {
my ($self) = @_;
}
@@ -2514,6 +2522,9 @@
$table_def = $self->{table}{$table};
return if (!defined $table_def);
+ # load up all additional information from the native metadata
+ $self->load_table_metadata_auto($table);
+
$columns = $table_def->{columns};
if (! defined $columns) {
$columns = [];
@@ -2526,9 +2537,6 @@
$table_def->{column}{$column}{idx} = $idx;
}
- # load up all additional information from the native metadata
- $self->load_table_metadata_auto($table);
-
# for each column in the hash (random order), add them to the end
foreach $column (keys %{$table_def->{column}}) {
$column_def = $table_def->{column}{$column};
@@ -2587,7 +2595,7 @@
=cut
-sub load_table_metadata_auto { # OVERRIDE IN SUBCLASS (IF DESIRED)
+sub load_table_metadata_auto {
my ($self, $table) = @_;
}