From 05e12340e50fa8af1fc15d00fee0bc05c2c82ab6 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Thu, 11 May 2023 15:18:51 +0200 Subject: [PATCH 1/2] Oracle test: Use fake/random DB name --- OnlineDB/Oracle/test/test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OnlineDB/Oracle/test/test.cpp b/OnlineDB/Oracle/test/test.cpp index f3242fc87fbc5..1ee645b08c48d 100644 --- a/OnlineDB/Oracle/test/test.cpp +++ b/OnlineDB/Oracle/test/test.cpp @@ -8,6 +8,9 @@ using namespace oracle::occi; using namespace std; int main(int argc, char *argv[]){ + const char* fake_db = "cms-fake-unknown-db-server-1234567890"; + char* p = std::getenv("CMSTEST_FAKE_ORACLE_DBNAME"); + fake_db = p ? p : fake_db; int errCode = 0; if (argc==2){errCode = stoi(argv[1]);} if (errCode==24960){ @@ -22,7 +25,7 @@ int main(int argc, char *argv[]){ try { auto env = Environment::createEnvironment(Environment::OBJECT); - auto conn = env->createConnection("a", "b", "c"); + auto conn = env->createConnection("a", "b", fake_db); env->terminateConnection(conn); Environment::terminateEnvironment(env); }catch(oracle::occi::SQLException &e) From b091e477bcc42e1fd85abb94b55cdcf714c2937a Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Thu, 11 May 2023 15:31:14 +0200 Subject: [PATCH 2/2] code-format --- OnlineDB/Oracle/test/test.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/OnlineDB/Oracle/test/test.cpp b/OnlineDB/Oracle/test/test.cpp index 1ee645b08c48d..4b54db1d7cd01 100644 --- a/OnlineDB/Oracle/test/test.cpp +++ b/OnlineDB/Oracle/test/test.cpp @@ -7,35 +7,33 @@ using namespace oracle::occi; using namespace std; -int main(int argc, char *argv[]){ +int main(int argc, char* argv[]) { const char* fake_db = "cms-fake-unknown-db-server-1234567890"; char* p = std::getenv("CMSTEST_FAKE_ORACLE_DBNAME"); fake_db = p ? p : fake_db; int errCode = 0; - if (argc==2){errCode = stoi(argv[1]);} - if (errCode==24960){ - cout <<"Tesing: 'ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255'"<createConnection("a", "b", fake_db); env->terminateConnection(conn); Environment::terminateEnvironment(env); - }catch(oracle::occi::SQLException &e) - { - cout <<"Caught oracle::occi::SQLException exception with error code: "<