Skip to content

Commit 8ac0c06

Browse files
author
Peter van Dijk
committed
allow setting of some oracle env vars. Patch by Aki Tuomi, closes #725
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3138 d19b8d6e-7fed-0310-83ef-9ca221ded41b
1 parent b1622c0 commit 8ac0c06

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

modules/goraclebackend/goraclebackend.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515

1616
#include "soracle.hh"
1717

18-
1918
#include <sstream>
2019

2120
gOracleBackend::gOracleBackend(const string &mode, const string &suffix) : GSQLBackend(mode,suffix)
2221
{
2322
try {
23+
// set some envionment variables
24+
setenv("ORACLE_HOME", getArg("home").c_str(), 1);
25+
setenv("ORACLE_SID", getArg("sid").c_str(), 1);
26+
setenv("NLS_LANG", getArg("nls-lang").c_str(), 1);
27+
2428
setDB(new SOracle(getArg("tnsname"),
2529
getArg("user"),
2630
getArg("password")));
@@ -41,10 +45,15 @@ class gOracleFactory : public BackendFactory
4145

4246
void declareArguments(const string &suffix="")
4347
{
48+
declare(suffix,"home", "Oracle home path", "");
49+
declare(suffix,"sid", "Oracle sid", "XE");
50+
declare(suffix,"nls-lang", "Oracle language", "AMERICAN_AMERICA.AL32UTF8");
51+
4452
declare(suffix,"tnsname","Generic Oracle backend TNSNAME to connect to","powerdns");
4553
declare(suffix,"user","Database backend user to connect as","powerdns");
4654
declare(suffix,"password","Pdns backend password to connect with","");
4755

56+
declare(suffix,"get-all-domains-query", "Get all domain","select id,name,master,last_check,type,notified_serial,account from domains");
4857
declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
4958
declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
5059
declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");

modules/oraclebackend/oraclebackend.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,11 @@ class OracleFactory : public BackendFactory
18091809
sword err;
18101810

18111811
try {
1812+
// set some envionment variables
1813+
setenv("ORACLE_HOME", arg()["oracle-home"].c_str(), 1);
1814+
setenv("ORACLE_SID", arg()["oracle-sid"].c_str(), 1);
1815+
setenv("NLS_LANG", arg()["oracle-nls-lang"].c_str(), 1);
1816+
18121817
// Initialize and create the environment
18131818
err = OCIEnvCreate(&oraenv, OCI_THREADED, NULL, NULL,
18141819
NULL, NULL, 0, NULL);
@@ -1910,6 +1915,10 @@ OracleFactory () : BackendFactory("oracle") {
19101915
}
19111916

19121917
void declareArguments (const string & suffix = "") {
1918+
declare(suffix,"home", "Oracle home path", "");
1919+
declare(suffix,"sid", "Oracle sid", "XE");
1920+
declare(suffix,"nls-lang", "Oracle language", "AMERICAN_AMERICA.AL32UTF8");
1921+
19131922
declare(suffix, "pool-database", "Database to connect to for the session pool", "powerdns");
19141923
declare(suffix, "pool-username", "Username to connect as for the session pool", "powerdns");
19151924
declare(suffix, "pool-password", "Password to connect with for the session pool", "");

0 commit comments

Comments
 (0)