Author: spadkins
Date: Fri Feb 6 09:42:13 2009
New Revision: 12477
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm
Log:
Changes to _load_table_metadata_from_source2, dbexpr_update and dbexpr
Modified: p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm Fri Feb 6
09:42:13 2009
@@ -202,7 +202,7 @@
my ($self, $table) = @_;
my $column_defs = $self->{table}{$table}{column};
my @columns = (keys %$column_defs);
- my ($column_def, $type, $dbexpr);
+ my ($column_def, $type, $dbexpr, $column_dbexpr);
my $table_alias = $self->{table}{$table}{alias};
my $default_date_format = $self->{default_date_format};
my $default_datetime_format = $self->{default_datetime_format} ||
$default_date_format;
@@ -212,17 +212,20 @@
#if ($column_def->{phys_column}) { # ??? #SEB
$type = $column_def->{type};
$dbexpr = "$table_alias.$column";
+ $column_dbexpr = $column_def->{dbexpr} || "";
if ($type eq "date") {
#print STDERR "_load_table_metadata_from_source2($table):
date : ($column_def->{dbexpr} eq $dbexpr && !$default_date_format)\n";
- if ($column_def->{dbexpr} eq $dbexpr &&
$default_date_format ne "YYYY-MM-DD") {
+ if ($column_dbexpr =~ /^\w+\.\w+$/ || $column_dbexpr =~
/^\w+\(\w+\.\w+\)$/ && $default_date_format ne "YYYY-MM-DD") { # SEB
min(hiop.latest_eff_dt)
$column_def->{dbexpr_update} =
"to_date(%s,'YYYY-MM-DD')";
- $column_def->{dbexpr} =
"to_char($dbexpr,'YYYY-MM-DD')";
+ $column_def->{dbexpr_raw} = $column_def->{dbexpr}
|| $dbexpr;
+ $column_def->{dbexpr} =
"to_char($column_def->{dbexpr_raw},'YYYY-MM-DD')"; #SEB was $dbexpr
}
}
elsif ($type eq "datetime") {
- if ($column_def->{dbexpr} eq $dbexpr &&
$default_datetime_format ne "YYYY-MM-DD HH24:MI:SS") {
- $column_def->{dbexpr} =
"to_char($dbexpr,'YYYY-MM-DD HH24:MI:SS')";
+ if ($column_dbexpr =~ /^\w+\.\w+$/ || $column_dbexpr =~
/^\w+\(\w+\.\w+\)$/ && $default_datetime_format ne "YYYY-MM-DD HH24:MI:SS") { #
SEB min(hiop.latest_eff_dt)
$column_def->{dbexpr_update} =
"to_date(%s,'YYYY-MM-DD HH24:MI:SS')";
+ $column_def->{dbexpr_raw} = $column_def->{dbexpr}
|| $dbexpr;
+ $column_def->{dbexpr} =
"to_char($column_def->{dbexpr_raw},'YYYY-MM-DD HH24:MI:SS')"; #SEB was $dbexpr
}
}
elsif ($type eq "binary") {