diff options
Diffstat (limited to 'cpp/demo/Database/Oracle/proc')
-rw-r--r-- | cpp/demo/Database/Oracle/proc/Client.cpp | 606 | ||||
-rw-r--r-- | cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc | 82 | ||||
-rw-r--r-- | cpp/demo/Database/Oracle/proc/DeptFactoryI.pc | 28 | ||||
-rw-r--r-- | cpp/demo/Database/Oracle/proc/DeptI.pc | 52 | ||||
-rw-r--r-- | cpp/demo/Database/Oracle/proc/EmpI.pc | 34 | ||||
-rw-r--r-- | cpp/demo/Database/Oracle/proc/Server.pc | 14 | ||||
-rw-r--r-- | cpp/demo/Database/Oracle/proc/Util.pc | 4 |
7 files changed, 410 insertions, 410 deletions
diff --git a/cpp/demo/Database/Oracle/proc/Client.cpp b/cpp/demo/Database/Oracle/proc/Client.cpp index 2260decdd0b..569fdf620fc 100644 --- a/cpp/demo/Database/Oracle/proc/Client.cpp +++ b/cpp/demo/Database/Oracle/proc/Client.cpp @@ -63,32 +63,32 @@ HRClient::HRClient() : _currentMenu(rootMenu) { _commonCommands = - "dept <number>: set department <number> as the current department\n" - "emp <number>: set employee <number> as the current employee\n" - "exit or quit: exit client\n" - "help: print this list of commands\n" - "root: go back to the root menu\n"; + "dept <number>: set department <number> as the current department\n" + "emp <number>: set employee <number> as the current employee\n" + "exit or quit: exit client\n" + "help: print this list of commands\n" + "root: go back to the root menu\n"; _rootCommands = - "create: create a new department\n" - "find <name>: find the department(s) with the given name\n" - "list: list all departments\n"; + "create: create a new department\n" + "find <name>: find the department(s) with the given name\n" + "list: list all departments\n"; - + _deptCommands = - "create: create a new employee in this department\n" - "find <name>: find employee(s) named <name> in this department\n" - "list: list all employees in this department\n" - "ping: ping this department\n" - "remove: remove this department\n" - "show: describe this department\n" - "update <dname|loc> <new value>: update this department\n"; + "create: create a new employee in this department\n" + "find <name>: find employee(s) named <name> in this department\n" + "list: list all employees in this department\n" + "ping: ping this department\n" + "remove: remove this department\n" + "show: describe this department\n" + "update <dname|loc> <new value>: update this department\n"; _empCommands = - "ping: ping this employee\n" - "remove: remove this employee\n" - "show: describe this employee\n" - "update <ename|job|mgr|hiredate|sal|comm|dept> <new-value>: update this employee\n"; + "ping: ping this employee\n" + "remove: remove this employee\n" + "show: describe this employee\n" + "update <ename|job|mgr|hiredate|sal|comm|dept> <new-value>: update this employee\n"; } void @@ -96,13 +96,13 @@ HRClient::checkEof(const string& command) const { if(!cin.eof()) { - string extra; - getline(cin, extra); - if(extra.size() > 0) - { - cout << "Warning: ignoring extra args '" << extra - << "' for '" << command << "'" << endl; - } + string extra; + getline(cin, extra); + if(extra.size() > 0) + { + cout << "Warning: ignoring extra args '" << extra + << "' for '" << command << "'" << endl; + } } } @@ -111,10 +111,10 @@ HRClient::checkCin(const string& command) const { if(!cin) { - cout << "Error: failed to read arguments for '" << command << "'" << endl; - cin.clear(); - cin.ignore(numeric_limits<streamsize>::max(), '\n'); - return false; + cout << "Error: failed to read arguments for '" << command << "'" << endl; + cin.clear(); + cin.ignore(numeric_limits<streamsize>::max(), '\n'); + return false; } checkEof(command); return true; @@ -124,7 +124,7 @@ void HRClient::invalidCommand(const string& command) const { cout << "Invalid command '" << command << "'. " - "Type 'help' for help." << endl; + "Type 'help' for help." << endl; cin.ignore(numeric_limits<streamsize>::max(), '\n'); } @@ -136,21 +136,21 @@ HRClient::help() const switch(_currentMenu) { - case rootMenu: - { - cout << _rootCommands; - break; - } - case deptMenu: - { - cout << _deptCommands; - break; - } - case empMenu: - { - cout << _empCommands; - break; - } + case rootMenu: + { + cout << _rootCommands; + break; + } + case deptMenu: + { + cout << _deptCommands; + break; + } + case empMenu: + { + cout << _empCommands; + break; + } } cout << "--- Common to all menus ---\n"; cout << _commonCommands << endl; @@ -163,8 +163,8 @@ HRClient::run(int argc, char* argv[]) _factory = DeptFactoryPrx::checkedCast(base); if(_factory == 0) { - cerr << argv[0] << ": invalid proxy" << endl; - return EXIT_FAILURE; + cerr << argv[0] << ": invalid proxy" << endl; + return EXIT_FAILURE; } Ice::EndpointSeq endpoints = _factory->ice_getEndpoints(); @@ -178,102 +178,102 @@ HRClient::run(int argc, char* argv[]) do { - cout << "==> "; - cin >> command; - - if(!cin) - { - break; - } - - try - { - - // - // Common commands - // - if(command == "dept") - { - int deptno; - cin >> deptno; - if(checkCin(command)) - { - _currentDept = DeptPrx::uncheckedCast(_factory->findDeptByNo(deptno)); - if(_currentDept != 0) - { - _currentMenu = deptMenu; - } - else - { - cout << "There is no department with deptno " << deptno << endl; - } - } - } - else if(command == "emp") - { - int empno; - cin >> empno; - if(checkCin(command)) - { - _currentEmp = EmpPrx::uncheckedCast(_factory->findEmpByNo(empno)); - if(_currentEmp != 0) - { - _currentMenu = empMenu; - } - else - { - cout << "There is no employee with empno " << empno << endl; - } - } - } - else if(command == "exit" || command == "quit") - { - checkEof(command); - break; - } - else if(command == "help") - { - checkEof(command); - help(); - } - else if(command == "root") - { - checkEof(command); - _currentMenu = rootMenu; - } - else if(_currentMenu == rootMenu) - { - doRootMenu(command); - } - else if(_currentMenu == deptMenu) - { - doDeptMenu(command); - } - else if(_currentMenu == empMenu) - { - doEmpMenu(command); - } - else - { - assert(0); - } - } - catch(const SqlException& e) - { - cout << "Caught a SqlException: " << e.reason << endl; - } - catch(const IceUtil::Exception& e) - { - cout << "Caught an Ice exception: " << e << endl; - } - catch(const std::exception& e) - { - cout << "Caught a std::exception: " << e.what() << endl; - } - catch(...) - { - cout << "Caught an unknown exception" << endl; - } + cout << "==> "; + cin >> command; + + if(!cin) + { + break; + } + + try + { + + // + // Common commands + // + if(command == "dept") + { + int deptno; + cin >> deptno; + if(checkCin(command)) + { + _currentDept = DeptPrx::uncheckedCast(_factory->findDeptByNo(deptno)); + if(_currentDept != 0) + { + _currentMenu = deptMenu; + } + else + { + cout << "There is no department with deptno " << deptno << endl; + } + } + } + else if(command == "emp") + { + int empno; + cin >> empno; + if(checkCin(command)) + { + _currentEmp = EmpPrx::uncheckedCast(_factory->findEmpByNo(empno)); + if(_currentEmp != 0) + { + _currentMenu = empMenu; + } + else + { + cout << "There is no employee with empno " << empno << endl; + } + } + } + else if(command == "exit" || command == "quit") + { + checkEof(command); + break; + } + else if(command == "help") + { + checkEof(command); + help(); + } + else if(command == "root") + { + checkEof(command); + _currentMenu = rootMenu; + } + else if(_currentMenu == rootMenu) + { + doRootMenu(command); + } + else if(_currentMenu == deptMenu) + { + doDeptMenu(command); + } + else if(_currentMenu == empMenu) + { + doEmpMenu(command); + } + else + { + assert(0); + } + } + catch(const SqlException& e) + { + cout << "Caught a SqlException: " << e.reason << endl; + } + catch(const IceUtil::Exception& e) + { + cout << "Caught an Ice exception: " << e << endl; + } + catch(const std::exception& e) + { + cout << "Caught a std::exception: " << e.what() << endl; + } + catch(...) + { + cout << "Caught an unknown exception" << endl; + } } while(cin.good()); @@ -285,38 +285,38 @@ HRClient::doRootMenu(const string& command) const { if(command == "create") { - checkEof(command); - cout << "Please enter: deptno dname loc ==> "; - int deptno; - DeptDesc desc; - cin >> deptno >> desc.dname >> desc.loc; - - desc.dname = unquote(desc.dname); - desc.loc = unquote(desc.loc); - - if(checkCin("create parameters")) - { - _factory->createDept(deptno, desc); - cout << "Created new department number " << deptno << endl; - } + checkEof(command); + cout << "Please enter: deptno dname loc ==> "; + int deptno; + DeptDesc desc; + cin >> deptno >> desc.dname >> desc.loc; + + desc.dname = unquote(desc.dname); + desc.loc = unquote(desc.loc); + + if(checkCin("create parameters")) + { + _factory->createDept(deptno, desc); + cout << "Created new department number " << deptno << endl; + } } else if(command == "find") { - string name; - cin >> name; - if(checkCin(command)) - { - printDepts(_factory->findByName(name)); - } + string name; + cin >> name; + if(checkCin(command)) + { + printDepts(_factory->findByName(name)); + } } else if(command == "list") { - checkEof(command); - printDepts(_factory->findAll()); + checkEof(command); + printDepts(_factory->findAll()); } else { - invalidCommand(command); + invalidCommand(command); } } @@ -325,84 +325,84 @@ HRClient::doDeptMenu(const string& command) const { if(command == "create") { - checkEof(command); - cout << "Please enter: empno ename job mgr(empno) hiredate sal comm ==> "; - int empno; - int mgrEmpno; - EmpDesc desc; - cin >> empno >> desc.ename >> desc.job >> mgrEmpno >> desc.hiredate >> desc.sal >> desc.comm; - - desc.ename = unquote(desc.ename); - desc.job = unquote(desc.job); - - if(mgrEmpno != 0) - { - desc.mgr = _factory->findEmpByNo(mgrEmpno); - if(desc.mgr == 0) - { - cout << "Manager #" << mgrEmpno << " does not exist: clearing manager" << endl; - } - } - desc.hiredate = unquote(desc.hiredate); - desc.sal = unquote(desc.sal); - desc.comm = unquote(desc.comm); - - desc.edept = _currentDept; - - if(checkCin("create parameters")) - { - _currentDept->createEmp(empno, desc); - cout << "Created new employee number " << empno << endl; - } + checkEof(command); + cout << "Please enter: empno ename job mgr(empno) hiredate sal comm ==> "; + int empno; + int mgrEmpno; + EmpDesc desc; + cin >> empno >> desc.ename >> desc.job >> mgrEmpno >> desc.hiredate >> desc.sal >> desc.comm; + + desc.ename = unquote(desc.ename); + desc.job = unquote(desc.job); + + if(mgrEmpno != 0) + { + desc.mgr = _factory->findEmpByNo(mgrEmpno); + if(desc.mgr == 0) + { + cout << "Manager #" << mgrEmpno << " does not exist: clearing manager" << endl; + } + } + desc.hiredate = unquote(desc.hiredate); + desc.sal = unquote(desc.sal); + desc.comm = unquote(desc.comm); + + desc.edept = _currentDept; + + if(checkCin("create parameters")) + { + _currentDept->createEmp(empno, desc); + cout << "Created new employee number " << empno << endl; + } } else if(command == "find") { - string name; - cin >> name; - if(checkCin(command)) - { - printEmps(_currentDept->findByName(name)); - } + string name; + cin >> name; + if(checkCin(command)) + { + printEmps(_currentDept->findByName(name)); + } } else if(command == "list") { - checkEof(command); - printEmps(_currentDept->findAll()); + checkEof(command); + printEmps(_currentDept->findAll()); } else if(command == "ping") { - checkEof(command); - _currentDept->ice_ping(); - cout << "ice_ping: success!" << endl; + checkEof(command); + _currentDept->ice_ping(); + cout << "ice_ping: success!" << endl; } else if(command == "remove") { - checkEof(command); - _currentDept->remove(); + checkEof(command); + _currentDept->remove(); } else if(command == "show") { - checkEof(command); - DeptDesc desc = _currentDept->getDesc(); - cout << "deptno: " << desc.deptno << endl; - cout << "dname: " << quote(desc.dname) << endl; - cout << "loc: " << quote(desc.loc) << endl; + checkEof(command); + DeptDesc desc = _currentDept->getDesc(); + cout << "deptno: " << desc.deptno << endl; + cout << "dname: " << quote(desc.dname) << endl; + cout << "loc: " << quote(desc.loc) << endl; } else if(command == "update") { - string field; - string newValue; - cin >> field >> newValue; - newValue = unquote(newValue); - - if(checkCin("update " + field)) - { - _currentDept->updateField(field, newValue); - } + string field; + string newValue; + cin >> field >> newValue; + newValue = unquote(newValue); + + if(checkCin("update " + field)) + { + _currentDept->updateField(field, newValue); + } } else { - invalidCommand(command); + invalidCommand(command); } } @@ -411,80 +411,80 @@ HRClient::doEmpMenu(const string& command) const { if(command == "ping") { - checkEof(command); - _currentEmp->ice_ping(); - cout << "ice_ping: success!" << endl; + checkEof(command); + _currentEmp->ice_ping(); + cout << "ice_ping: success!" << endl; } else if(command == "remove") { - checkEof(command); - _currentEmp->remove(); + checkEof(command); + _currentEmp->remove(); } else if(command == "show") { - checkEof(command); - EmpDesc desc = _currentEmp->getDesc(); - cout << "empno: " << desc.empno << endl; - cout << "ename: " << quote(desc.ename) << endl; - cout << "job: " << quote(desc.job) << endl; - cout << "mgr: "; - if(desc.mgr == 0) - { - cout << "<null>" << endl; - } - else - { - cout << desc.mgr->getDesc().empno << endl; - } - cout << "hiredate: " << quote(desc.hiredate) << endl; - cout << "sal: " << quote(desc.sal) << endl; - cout << "comm: " << quote(desc.comm) << endl; - cout << "dept: "; - if(desc.edept == 0) - { - cout << "<null>" << endl; - } - else - { - cout << desc.edept->getDesc().deptno << endl; - } + checkEof(command); + EmpDesc desc = _currentEmp->getDesc(); + cout << "empno: " << desc.empno << endl; + cout << "ename: " << quote(desc.ename) << endl; + cout << "job: " << quote(desc.job) << endl; + cout << "mgr: "; + if(desc.mgr == 0) + { + cout << "<null>" << endl; + } + else + { + cout << desc.mgr->getDesc().empno << endl; + } + cout << "hiredate: " << quote(desc.hiredate) << endl; + cout << "sal: " << quote(desc.sal) << endl; + cout << "comm: " << quote(desc.comm) << endl; + cout << "dept: "; + if(desc.edept == 0) + { + cout << "<null>" << endl; + } + else + { + cout << desc.edept->getDesc().deptno << endl; + } } else if(command == "update") { - string field; - cin >> field; - if(field == "mgr") - { - int mgr; - cin >> mgr; - if(checkCin("update mgr")) - { - _currentEmp->updateMgr(mgr); - } - } - else if(field == "dept") - { - int deptno; - cin >> deptno; - if(checkCin("update dept")) - { - _currentEmp->updateDept(deptno); - } - } - else - { - string newValue; - cin >> newValue; - newValue = unquote(newValue); - if(checkCin("update " + field)) - { - _currentEmp->updateField(field, newValue); - } - } + string field; + cin >> field; + if(field == "mgr") + { + int mgr; + cin >> mgr; + if(checkCin("update mgr")) + { + _currentEmp->updateMgr(mgr); + } + } + else if(field == "dept") + { + int deptno; + cin >> deptno; + if(checkCin("update dept")) + { + _currentEmp->updateDept(deptno); + } + } + else + { + string newValue; + cin >> newValue; + newValue = unquote(newValue); + if(checkCin("update " + field)) + { + _currentEmp->updateField(field, newValue); + } + } } else { - invalidCommand(command); + invalidCommand(command); } } @@ -494,15 +494,15 @@ HRClient::printDepts(const DeptPrxSeq& depts) const cout << "Deptno\t Dname\t Loc" << endl; if(depts.size() == 0) { - cout << "<None found>" << endl; + cout << "<None found>" << endl; } else { - for(DeptPrxSeq::const_iterator p = depts.begin(); p != depts.end(); ++p) - { - HR::DeptDesc desc = (*p)->getDesc(); - cout << desc.deptno << "\t " << desc.dname << "\t " << desc.loc << endl; - } + for(DeptPrxSeq::const_iterator p = depts.begin(); p != depts.end(); ++p) + { + HR::DeptDesc desc = (*p)->getDesc(); + cout << desc.deptno << "\t " << desc.dname << "\t " << desc.loc << endl; + } } } @@ -512,15 +512,15 @@ HRClient::printEmps(const EmpPrxSeq& emps) const cout << "Empno\t Ename" << endl; if(emps.size() == 0) { - cout << "<None found>" << endl; + cout << "<None found>" << endl; } else { - for(EmpPrxSeq::const_iterator p = emps.begin(); p != emps.end(); ++p) - { - HR::EmpDesc desc = (*p)->getDesc(); - cout << desc.empno << "\t " << desc.ename << endl; - } + for(EmpPrxSeq::const_iterator p = emps.begin(); p != emps.end(); ++p) + { + HR::EmpDesc desc = (*p)->getDesc(); + cout << desc.empno << "\t " << desc.ename << endl; + } } } @@ -530,11 +530,11 @@ HRClient::quote(const string& str) { if(str == "") { - return "''"; + return "''"; } else { - return str; + return str; } } @@ -544,10 +544,10 @@ HRClient::unquote(const string& str) { if(str == "''") { - return ""; + return ""; } else { - return str; + return str; } } diff --git a/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc b/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc index 862196b8718..35e27fc3749 100644 --- a/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc +++ b/cpp/demo/Database/Oracle/proc/CurrentSqlContext.pc @@ -38,7 +38,7 @@ class Notification : public Ice::ThreadNotification public: Notification(size_t index) : - _index(index) + _index(index) { } @@ -48,35 +48,35 @@ public: virtual void stop() { - if(_current != 0 && _index < _current->size()) - { + if(_current != 0 && _index < _current->size()) + { #ifdef TRACE - cerr << "Disconnecting from Oracle in thread " << IceUtil::ThreadControl().id() << endl; + cerr << "Disconnecting from Oracle in thread " << IceUtil::ThreadControl().id() << endl; #endif - EXEC SQL BEGIN DECLARE SECTION; - sql_context ctx = (*_current)[_index]; - EXEC SQL END DECLARE SECTION; - - if(ctx != 0) - { - (*_current)[_index] = 0; - EXEC SQL CONTEXT USE :ctx; - - sqlca sqlca; - EXEC SQL ROLLBACK RELEASE; - EXEC SQL CONTEXT FREE :ctx; - } - - if(find_if(_current->begin(), _current->end(), bind2nd(not_equal_to<sql_context>(), static_cast<void*>(0))) - == _current->end()) - { + EXEC SQL BEGIN DECLARE SECTION; + sql_context ctx = (*_current)[_index]; + EXEC SQL END DECLARE SECTION; + + if(ctx != 0) + { + (*_current)[_index] = 0; + EXEC SQL CONTEXT USE :ctx; + + sqlca sqlca; + EXEC SQL ROLLBACK RELEASE; + EXEC SQL CONTEXT FREE :ctx; + } + + if(find_if(_current->begin(), _current->end(), bind2nd(not_equal_to<sql_context>(), static_cast<void*>(0))) + == _current->end()) + { #ifdef TRACE - cerr << "Deleting _current in thread " << IceUtil::ThreadControl().id() << endl; + cerr << "Deleting _current in thread " << IceUtil::ThreadControl().id() << endl; #endif - delete _current; - _current = 0; - } - } + delete _current; + _current = 0; + } + } } private: @@ -90,8 +90,8 @@ CurrentSqlContext::CurrentSqlContext(const string& connectInfo) : _connectInfo(connectInfo) { { - IceUtil::StaticMutex::Lock lock(IceUtil::globalMutex); - _index = _currentIndex++; + IceUtil::StaticMutex::Lock lock(IceUtil::globalMutex); + _index = _currentIndex++; } _hook = new Notification(_index); } @@ -106,11 +106,11 @@ CurrentSqlContext::operator sql_context() const { if(_current == 0) { - _current = new std::vector<sql_context>(_index + 1); + _current = new std::vector<sql_context>(_index + 1); } if(_index >= _current->size()) { - _current->resize(_index + 1); + _current->resize(_index + 1); } EXEC SQL BEGIN DECLARE SECTION; @@ -123,18 +123,18 @@ CurrentSqlContext::operator sql_context() const if(ctx == 0) { #ifdef TRACE - cerr << "Connecting to Oracle in thread " << IceUtil::ThreadControl().id() << endl; + cerr << "Connecting to Oracle in thread " << IceUtil::ThreadControl().id() << endl; #endif - // - // Allocate and connect - // - sqlca sqlca; - - EXEC SQL CONTEXT ALLOCATE :ctx; - EXEC SQL CONTEXT USE :ctx; - EXEC SQL CONNECT :connectInfo; - - (*_current)[_index] = ctx; + // + // Allocate and connect + // + sqlca sqlca; + + EXEC SQL CONTEXT ALLOCATE :ctx; + EXEC SQL CONTEXT USE :ctx; + EXEC SQL CONNECT :connectInfo; + + (*_current)[_index] = ctx; } return ctx; diff --git a/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc b/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc index 1d72b58d0db..e6bcdd56145 100644 --- a/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc +++ b/cpp/demo/Database/Oracle/proc/DeptFactoryI.pc @@ -62,13 +62,13 @@ DeptFactoryI::findAll(const Ice::Current& current) for(;;) { - EXEC SQL FETCH depCursor1 INTO :deptno; + EXEC SQL FETCH depCursor1 INTO :deptno; - Ice::Identity deptId; - deptId.category = _deptCategory; - deptId.name = encodeName(deptno); + Ice::Identity deptId; + deptId.category = _deptCategory; + deptId.name = encodeName(deptno); - result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId))); + result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId))); } EXEC SQL CLOSE depCursor1; @@ -94,13 +94,13 @@ DeptFactoryI::findByName(const string& name, const Ice::Current& current) for(;;) { - EXEC SQL FETCH depCursor2 INTO :deptno; + EXEC SQL FETCH depCursor2 INTO :deptno; - Ice::Identity deptId; - deptId.category = _deptCategory; - deptId.name = encodeName(deptno); + Ice::Identity deptId; + deptId.category = _deptCategory; + deptId.name = encodeName(deptno); - result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId))); + result.push_back(HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId))); } EXEC SQL CLOSE depCursor2; @@ -121,11 +121,11 @@ DeptFactoryI::findDeptByNo(int deptno, const Ice::Current& current) // try { - prx->ice_ping(); + prx->ice_ping(); } catch(const Ice::ObjectNotExistException&) { - return 0; + return 0; } return HR::DeptPrx::uncheckedCast(prx); @@ -144,11 +144,11 @@ DeptFactoryI::findEmpByNo(int empno, const Ice::Current& current) // try { - prx->ice_ping(); + prx->ice_ping(); } catch(const Ice::ObjectNotExistException&) { - return 0; + return 0; } return HR::EmpPrx::uncheckedCast(prx); diff --git a/cpp/demo/Database/Oracle/proc/DeptI.pc b/cpp/demo/Database/Oracle/proc/DeptI.pc index 7a9d2c63f1c..203ab110a5a 100644 --- a/cpp/demo/Database/Oracle/proc/DeptI.pc +++ b/cpp/demo/Database/Oracle/proc/DeptI.pc @@ -38,7 +38,7 @@ DeptI::ice_ping(const Ice::Current& current) const if(count == 0) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException(__FILE__, __LINE__); } } @@ -64,19 +64,19 @@ DeptI::createEmp(int key, const HR::EmpDesc& desc, const Ice::Current& current) if(desc.mgr == 0) { - // - // mgr is NULL - // - mgrInd = -1; + // + // mgr is NULL + // + mgrInd = -1; } else { - mgr = decodeName(desc.mgr->ice_getIdentity().name); + mgr = decodeName(desc.mgr->ice_getIdentity().name); } EXEC SQL CONTEXT USE :ctx; EXEC SQL INSERT INTO EMP(empno, ename, job, mgr, hiredate, sal, comm, deptno) - VALUES(:empno, :ename, :job, :mgr:mgrInd, :hiredate, :sal, :comm, :deptno); + VALUES(:empno, :ename, :job, :mgr:mgrInd, :hiredate, :sal, :comm, :deptno); EXEC SQL COMMIT; Ice::Identity empId; @@ -107,10 +107,10 @@ DeptI::getDesc(const Ice::Current& current) if(dnameInd >= 0) { - // - // Should log a warning if > 0! - // - result.dname = dname; + // + // Should log a warning if > 0! + // + result.dname = dname; } // // else null @@ -118,10 +118,10 @@ DeptI::getDesc(const Ice::Current& current) if(locInd >= 0) { - // - // Should log a warning if > 0! - // - result.loc = loc; + // + // Should log a warning if > 0! + // + result.loc = loc; } // // else null @@ -134,7 +134,7 @@ void DeptI::updateField(const string& field, const string& newValue, const Ice::Current& current) { const string updateDeptStr = - "UPDATE DEPT SET " + field + " = '" + newValue + "' WHERE DEPTNO = " + current.id.name; + "UPDATE DEPT SET " + field + " = '" + newValue + "' WHERE DEPTNO = " + current.id.name; sqlca sqlca; EXEC SQL BEGIN DECLARE SECTION; @@ -185,13 +185,13 @@ DeptI::findAll(const Ice::Current& current) for(;;) { - EXEC SQL FETCH empCursor1 INTO :empno; + EXEC SQL FETCH empCursor1 INTO :empno; - Ice::Identity empId; - empId.category = _empCategory; - empId.name = encodeName(empno); + Ice::Identity empId; + empId.category = _empCategory; + empId.name = encodeName(empno); - result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId))); + result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId))); } EXEC SQL CLOSE empCursor1; @@ -218,13 +218,13 @@ DeptI::findByName(const string& name, const Ice::Current& current) for(;;) { - EXEC SQL FETCH empCursor2 INTO :empno; + EXEC SQL FETCH empCursor2 INTO :empno; - Ice::Identity empId; - empId.category = _empCategory; - empId.name = encodeName(empno); + Ice::Identity empId; + empId.category = _empCategory; + empId.name = encodeName(empno); - result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId))); + result.push_back(HR::EmpPrx::uncheckedCast(current.adapter->createProxy(empId))); } EXEC SQL CLOSE empCursor2; diff --git a/cpp/demo/Database/Oracle/proc/EmpI.pc b/cpp/demo/Database/Oracle/proc/EmpI.pc index e74887a939d..5506d0d0d84 100644 --- a/cpp/demo/Database/Oracle/proc/EmpI.pc +++ b/cpp/demo/Database/Oracle/proc/EmpI.pc @@ -17,7 +17,7 @@ EXEC SQL WHENEVER NOT FOUND DO handleNotFound(current, ctx); using namespace std; EmpI::EmpI(const CurrentSqlContext& currentCtx, - const string& empCategory, const string& deptCategory) : + const string& empCategory, const string& deptCategory) : _currentCtx(currentCtx), _empCategory(empCategory), _deptCategory(deptCategory) @@ -40,7 +40,7 @@ EmpI::ice_ping(const Ice::Current& current) const if(count == 0) { - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + throw Ice::ObjectNotExistException(__FILE__, __LINE__); } } @@ -69,7 +69,7 @@ EmpI::getDesc(const Ice::Current& current) EXEC SQL CONTEXT USE :ctx; EXEC SQL SELECT ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO - INTO :ename:enameInd, :job:jobInd, :mgr:mgrInd, :hiredate:hiredateInd, :sal:salInd, :comm:commInd, + INTO :ename:enameInd, :job:jobInd, :mgr:mgrInd, :hiredate:hiredateInd, :sal:salInd, :comm:commInd, :deptno:deptnoInd FROM EMP WHERE EMPNO = :empno; EXEC SQL COMMIT; @@ -79,37 +79,37 @@ EmpI::getDesc(const Ice::Current& current) if(enameInd >= 0) { - result.ename = ename; + result.ename = ename; } if(jobInd >= 0) { - result.job = job; + result.job = job; } if(mgrInd >= 0) { - Ice::Identity mgrId; - mgrId.name = encodeName(mgr); - mgrId.category = _empCategory; - result.mgr = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(mgrId)); + Ice::Identity mgrId; + mgrId.name = encodeName(mgr); + mgrId.category = _empCategory; + result.mgr = HR::EmpPrx::uncheckedCast(current.adapter->createProxy(mgrId)); } if(hiredateInd >= 0) { - result.hiredate = hiredate; + result.hiredate = hiredate; } if(salInd >= 0) { - result.sal = sal; + result.sal = sal; } if(commInd >= 0) { - result.comm = comm; + result.comm = comm; } if(deptnoInd >= 0) { - Ice::Identity deptId; - deptId.name = encodeName(deptno); - deptId.category = _deptCategory; - result.edept = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)); + Ice::Identity deptId; + deptId.name = encodeName(deptno); + deptId.category = _deptCategory; + result.edept = HR::DeptPrx::uncheckedCast(current.adapter->createProxy(deptId)); } return result; } @@ -118,7 +118,7 @@ void EmpI::updateField(const string& field, const string& newValue, const Ice::Current& current) { const string updateEmpStr = - "UPDATE EMP SET " + field + " = '" + newValue + "' WHERE EMPNO = " + current.id.name; + "UPDATE EMP SET " + field + " = '" + newValue + "' WHERE EMPNO = " + current.id.name; sqlca sqlca; EXEC SQL BEGIN DECLARE SECTION; diff --git a/cpp/demo/Database/Oracle/proc/Server.pc b/cpp/demo/Database/Oracle/proc/Server.pc index a0a0d80e083..bc325649259 100644 --- a/cpp/demo/Database/Oracle/proc/Server.pc +++ b/cpp/demo/Database/Oracle/proc/Server.pc @@ -34,18 +34,18 @@ class DefaultServantLocator : public Ice::ServantLocator public: DefaultServantLocator(const Ice::ObjectPtr& servant) : - _servant(servant) + _servant(servant) { } virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&) { - return _servant; + return _servant; } virtual void finished(const Ice::Current& curr, - const Ice::ObjectPtr& servant, - const Ice::LocalObjectPtr& cookie) + const Ice::ObjectPtr& servant, + const Ice::LocalObjectPtr& cookie) { } @@ -70,7 +70,7 @@ main(int argc, char* argv[]) initData.properties->load("config.server"); const string connectInfo = initData.properties - ->getPropertyWithDefault("Oracle.ConnectInfo", "scott/tiger"); + ->getPropertyWithDefault("Oracle.ConnectInfo", "scott/tiger"); CurrentSqlContext currentCtx(connectInfo); initData.threadHook = currentCtx.getHook(); @@ -92,12 +92,12 @@ HRServer::run(int argc, char* argv[]) const string deptCategory = "Dept"; adapter->addServantLocator(new DefaultServantLocator(new EmpI(_currentCtx, empCategory, deptCategory)), - empCategory); + empCategory); adapter->addServantLocator(new DefaultServantLocator(new DeptI(_currentCtx, empCategory)), deptCategory); adapter->add(new DeptFactoryI(_currentCtx, deptCategory, empCategory), - communicator()->stringToIdentity("DeptFactory")); + communicator()->stringToIdentity("DeptFactory")); adapter->activate(); communicator()->waitForShutdown(); diff --git a/cpp/demo/Database/Oracle/proc/Util.pc b/cpp/demo/Database/Oracle/proc/Util.pc index 9e96d81d88a..6a3ab69c03d 100644 --- a/cpp/demo/Database/Oracle/proc/Util.pc +++ b/cpp/demo/Database/Oracle/proc/Util.pc @@ -57,8 +57,8 @@ decodeName(const string& name) is >> result; if(!is || !is.eof()) { - cerr << "Unable to decode " << name << endl; - throw Ice::ObjectNotExistException(__FILE__, __LINE__); + cerr << "Unable to decode " << name << endl; + throw Ice::ObjectNotExistException(__FILE__, __LINE__); } return result; } |