Skip to content

Commit

Permalink
allow setting of some oracle env vars. Patch by Aki Tuomi, closes Pow…
Browse files Browse the repository at this point in the history
…erDNS#725

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3138 d19b8d6e-7fed-0310-83ef-9ca221ded41b
  • Loading branch information
peter committed Mar 28, 2013
1 parent 5206d16 commit 9dffdc5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/goraclebackend/goraclebackend.cc
Expand Up @@ -15,12 +15,16 @@

#include "soracle.hh"


#include <sstream>

gOracleBackend::gOracleBackend(const string &mode, const string &suffix) : GSQLBackend(mode,suffix)
{
try {
// set some envionment variables
setenv("ORACLE_HOME", getArg("home").c_str(), 1);
setenv("ORACLE_SID", getArg("sid").c_str(), 1);
setenv("NLS_LANG", getArg("nls-lang").c_str(), 1);

setDB(new SOracle(getArg("tnsname"),
getArg("user"),
getArg("password")));
Expand All @@ -41,10 +45,15 @@ class gOracleFactory : public BackendFactory

void declareArguments(const string &suffix="")
{
declare(suffix,"home", "Oracle home path", "");
declare(suffix,"sid", "Oracle sid", "XE");
declare(suffix,"nls-lang", "Oracle language", "AMERICAN_AMERICA.AL32UTF8");

declare(suffix,"tnsname","Generic Oracle backend TNSNAME to connect to","powerdns");
declare(suffix,"user","Database backend user to connect as","powerdns");
declare(suffix,"password","Pdns backend password to connect with","");

declare(suffix,"get-all-domains-query", "Get all domain","select id,name,master,last_check,type,notified_serial,account from domains");
declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
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");
declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");
Expand Down
9 changes: 9 additions & 0 deletions modules/oraclebackend/oraclebackend.cc
Expand Up @@ -1809,6 +1809,11 @@ class OracleFactory : public BackendFactory
sword err;

try {
// set some envionment variables
setenv("ORACLE_HOME", arg()["oracle-home"].c_str(), 1);
setenv("ORACLE_SID", arg()["oracle-sid"].c_str(), 1);
setenv("NLS_LANG", arg()["oracle-nls-lang"].c_str(), 1);

// Initialize and create the environment
err = OCIEnvCreate(&oraenv, OCI_THREADED, NULL, NULL,
NULL, NULL, 0, NULL);
Expand Down Expand Up @@ -1910,6 +1915,10 @@ OracleFactory () : BackendFactory("oracle") {
}

void declareArguments (const string & suffix = "") {
declare(suffix,"home", "Oracle home path", "");
declare(suffix,"sid", "Oracle sid", "XE");
declare(suffix,"nls-lang", "Oracle language", "AMERICAN_AMERICA.AL32UTF8");

declare(suffix, "pool-database", "Database to connect to for the session pool", "powerdns");
declare(suffix, "pool-username", "Username to connect as for the session pool", "powerdns");
declare(suffix, "pool-password", "Password to connect with for the session pool", "");
Expand Down

0 comments on commit 9dffdc5

Please sign in to comment.