Author: spadkins
Date: Tue Jan 27 12:43:05 2009
New Revision: 12469
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm
Log:
fixed more bugs reported by Steve B
Modified: p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/DBI.pm Tue Jan 27 12:43:05 2009
@@ -1181,7 +1181,7 @@
else {
$summaryexpr = "NULL";
}
- push(@select_phrase, $columnalias ? "$dbexpr as $columnalias"
: $dbexpr);
+ push(@select_phrase, $columnalias ? "$summaryexpr as
$columnalias" : $summaryexpr);
}
}
else {
@@ -3011,7 +3011,9 @@
$table_def->{primary_key} =
$self->_get_primary_key_from_source($table) if (!$table_def->{primary_key});
$table_def->{alternate_key} =
$self->_get_alternate_keys_from_source($table) if
(!$table_def->{alternate_key});
}
+ }
+ {
######################################################################
# tables that are related via tablealiases can be "import"-ed
# this copies all of the column definitions from the imported table to
this table
@@ -3021,7 +3023,7 @@
# TODO: think about import on demand rather than in advance
######################################################################
my ($tablealiases, $alias, $alias_def, $related_table,
$related_table_def);
- my ($tablealias_defs, $tablealias_def, $idx);
+ my ($tablealias_defs, $tablealias_def, $idx, %tablealias_seen);
$tablealiases = $table_def->{tablealiases};
if (defined $tablealiases && ref($tablealiases) eq "ARRAY") {
@@ -3040,6 +3042,7 @@
}
}
}
+ $tablealias_seen{$tablealias} = 1;
}
}
@@ -3059,6 +3062,11 @@
push(@$tablealiases, $tablealias);
$tablealias_def->{idx} = $#$tablealiases;
}
+
+ if (!$tablealias_seen{$tablealias}) {
+ push(@$tablealiases, $tablealias);
+ $tablealias_seen{$tablealias} = 1;
+ }
}
}