Permalink
Browse files

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
  • Loading branch information...
1 parent b1622c0 commit 8ac0c064f656643c1fda1dea8e4ef071d67aa4f7 @Habbie Habbie committed Mar 28, 2013
Showing with 19 additions and 1 deletion.
  1. +10 −1 modules/goraclebackend/goraclebackend.cc
  2. +9 −0 modules/oraclebackend/oraclebackend.cc
@@ -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")));
@@ -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'");
@@ -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);
@@ -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", "");

0 comments on commit 8ac0c06

Please sign in to comment.