Skip to content

Commit

Permalink
Prefix direct call to function with a call to PERFORM. Thanks to Mich…
Browse files Browse the repository at this point in the history
…ael Vitale for the feature request.
  • Loading branch information
darold committed Feb 22, 2016
1 parent 5dfe8b4 commit d4fc203
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Ora2Pg.pm
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ sub _init
$self->{standard_conforming_strings} = 1;
$self->{create_schema} = 1;
$self->{external_table} = ();
$self->{function_list} = ();

# Used to precise if we need to prefix partition tablename with main tablename
$self->{prefix_partition} = 0;
Expand Down Expand Up @@ -1187,6 +1188,7 @@ sub _init
}

$self->_get_pkg_functions() if (!$self->{package_as_schema} && (!grep(/^$self->{type}$/, 'COPY', 'INSERT', 'SEQUENCE', 'GRANT', 'TABLESPACE', 'QUERY', 'SYNONYM', 'FDW', 'KETTLE', 'DBLINK', 'DIRECTORY')));
@{$self->{function_list}} = $self->_list_all_funtions() if ($self->{plsql_pgsql} && (!grep(/^$self->{type}$/, 'COPY', 'INSERT', 'SEQUENCE', 'GRANT', 'TABLESPACE', 'QUERY', 'SYNONYM', 'FDW', 'KETTLE', 'DBLINK', 'DIRECTORY')));
$self->{security} = $self->_get_security_definer($self->{type}) if (grep(/^$self->{type}$/, 'TRIGGER', 'FUNCTION','PROCEDURE','PACKAGE'));
}

Expand Down
7 changes: 7 additions & 0 deletions lib/Ora2Pg/PLSQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,13 @@ sub plsql_to_plpgsql
$str =~ s/\%\%XMLELEMENT(\d+)\%\%/$xmlelt[$1]/igs;
@xmlelt = ();

####
# Search direct call to function to add PERFORM before
####
foreach my $f (@{$class->{function_list}}) {
$str =~ s/([;\s]+)$f\s*\(/$1PERFORM \L$f\E\(/igs;
}

##############
# Replace package.function call by package_function
##############
Expand Down

0 comments on commit d4fc203

Please sign in to comment.