summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-03-11 16:39:39 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2008-03-11 16:39:39 +0000
commit22f24d3d4bf3463ee852e8459ea2c506858516c7 (patch)
treedcf4f92b6f4efe058cbc9313d65d7b93152a8dc3
parent8e0e313c00c2d3a252654ee0a9566c756c7de14f (diff)
Adding db_namespace configuration parameter and restricting method discovery based on it.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2105 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--LedgerSMB/DBObject.pm15
-rw-r--r--LedgerSMB/Sysconfig.pm1
-rw-r--r--ledgersmb.conf.default1
3 files changed, 14 insertions, 3 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm
index 40d621c5..6a44fde8 100644
--- a/LedgerSMB/DBObject.pm
+++ b/LedgerSMB/DBObject.pm
@@ -104,9 +104,18 @@ sub exec_method {
@in_args = @{ $args{args}} if $args{args};
my @call_args;
- my $query = "SELECT proname, pronargs, proargnames FROM pg_proc WHERE proname = ?";
- my $sth = $self->{dbh}->prepare($query);
- $sth->execute($funcname) || $self->error($DBI::errstr . "in exec_method");
+ my $query = "
+ SELECT proname, pronargs, proargnames FROM pg_proc
+ WHERE proname = ?
+ AND pronamespace =
+ coalesce((SELECT oid FROM pg_namespace WHERE nspname = ?),
+ pronamespace)
+ ";
+ my $sth = $self->{dbh}->prepare(
+ $query
+ );
+ $sth->execute($funcname, $LedgerSMB::Sysconfig::db_namespace)
+ || $self->error($DBI::errstr . "in exec_method");
my $ref;
$ref = $sth->fetchrow_hashref('NAME_lc');
diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm
index 45304eb0..ed27c176 100644
--- a/LedgerSMB/Sysconfig.pm
+++ b/LedgerSMB/Sysconfig.pm
@@ -138,5 +138,6 @@ for $var (qw(DBhost DBport DBname DBUserName DBPassword)) {
$ENV{PGHOST} = $config{database}{host};
$ENV{PGPORT} = $config{database}{port};
our $default_db = $config{database}{default_db};
+our $db_namespace = $config{database}{db_namespace};
1;
diff --git a/ledgersmb.conf.default b/ledgersmb.conf.default
index 2440912d..4fd3d54c 100644
--- a/ledgersmb.conf.default
+++ b/ledgersmb.conf.default
@@ -52,3 +52,4 @@ Epson = lpr -PEpson
port = 5432
default_db = lsmb13
host = localhost
+db_namespace = public