[-]
[+]
|
Changed |
cego.changes
|
|
[-]
[+]
|
Changed |
cego.spec
^
|
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/README
^
|
@@ -4,7 +4,7 @@
----
A relational and transactional database system
- Version 2.15.4
+ Version 2.15.5
(C)opyright 2006,2007,2008,2009,2010,2011,2012,2013 by Bjoern Lemke
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/TODO
^
|
@@ -15,3 +15,13 @@
- expand system tables to show more information abuout keys, add information for checks
+Analyze :
+
+31.12.2012 16:41:57 [CegoMain] ERROR : Batch Thread :
+ CegoDistManager.cc(358) : Access not allowed for object ipa_account
+31.12.2012 16:41:57 [CegoMain] ERROR : Main Thread :
+ CegoMain.cc(1511) : Cannot start tableset ipa
+ CegoMain.cc(1501) : Execution of init file /serv/cego/counteradjust.sql failed
+ CegoMain.cc(1495) : Access not allowed for object ipa_account
+31.12.2012 16:41:57 [CegoMain] NOTICE : Shutdown finished
+
|
[-]
[+]
|
Added |
cego-2.15.5.tar.bz2/samples/chkdb/myinit.sql
^
|
@@ -0,0 +1 @@
+set counter a to ( select max(a) from t1 ) + 1;
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/samples/chkdb/pid
^
|
@@ -1 +1 @@
-34937
\ No newline at end of file
+75487
\ No newline at end of file
|
[-]
[+]
|
Added |
cego-2.15.5.tar.bz2/src/#CegoAdminHandler.cc#
^
|
@@ -0,0 +1,4671 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// CegoAdminHandler.cc
+// -------------------
+// Cego admin handler class implementation
+//
+// Design and Implementation by Bjoern Lemke
+//
+// (C)opyright 2000-2010 Bjoern Lemke
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+//
+// IMPLEMENTATION MODULE
+//
+// Class: CegoAdminHandler
+//
+// Description:
+//
+// Status: QG-2.6
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <lfc/AESCrypt.h>
+#include <lfc/Datetime.h>
+
+#include "CegoDefs.h"
+#include "CegoXMLdef.h"
+#include "CegoAdminHandler.h"
+#include "CegoTypeConverter.h"
+#include "CegoDatabaseManager.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+CegoAdminHandler::CegoAdminHandler(CegoModule *pModule, NetHandler *pN)
+{
+ _pN = pN;
+ _pModule = pModule;
+
+ Document *pDoc = new Document(XML_CEGO);
+ pDoc->setAttribute(XML_VERSION_ATTR, XML_VERSION_VALUE);
+
+ _xml.setDocument(pDoc);
+
+ _modId = _pModule->getModId("CegoAdminHandler");
+}
+
+CegoAdminHandler::~CegoAdminHandler()
+{
+ Document *pDoc = _xml.getDocument();
+ pDoc->clear();
+ delete pDoc;
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::requestSession(const Chain& user, const Chain& password, bool doEncrypt)
+{
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Request session for user ") + user + Chain("/") + password);
+#endif
+
+ _xml.getDocument()->clear();
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+
+ if ( doEncrypt )
+ {
+ AESCrypt aescrypt(CEGOAESKEY, CEGOAESKEYLEN);
+ pRoot->setAttribute(XML_PASSWD_ATTR, aescrypt.encrypt(password));
+ }
+ else
+ {
+ pRoot->setAttribute(XML_PASSWD_ATTR, password);
+ }
+
+ _xml.getDocument()->setRootElement(pRoot);
+ _xml.getDocument()->setDocType(Chain(XML_ADMINSESSION_REQUEST));
+
+ Chain request;
+ _xml.getXMLChain(request);
+
+ _xml.getDocument()->clear();
+
+ _pN->setMsg(request, request.length());
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Requesting session ..."));
+#endif
+
+ _pN->writeMsg();
+
+ _pN->readMsg();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType == Chain(XML_OK_DOC) )
+ {
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Session established"));
+#endif
+ return ADM_OK;
+ }
+ else // if ( docType == Chain(XML_ERROR_DOC) )
+ {
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Session rejected"));
+#endif
+
+ return ADM_ERROR;
+ }
+
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::closeSession()
+{
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+
+ _xml.getDocument()->setRootElement(pRoot);
+ _xml.getDocument()->setDocType(XML_SESSION_CLOSE);
+ Chain request;
+ _xml.getXMLChain(request);
+ _xml.getDocument()->clear();
+
+ _pN->setMsg(request, request.length());
+
+ _pN->writeMsg();
+
+ _pN->readMsg();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType == Chain(XML_OK_DOC) )
+ {
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Session closed"));
+#endif
+
+ return ADM_OK;
+ }
+ else // if ( docType == Chain(XML_ERROR_DOC) )
+ {
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Session close failed"));
+#endif
+
+ return ADM_ERROR;
+ }
+}
+
+bool CegoAdminHandler::acceptSession()
+{
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Accepting session"));
+#endif
+
+ try {
+
+ _xml.getDocument()->clear();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType != Chain(XML_ADMINSESSION_REQUEST) )
+ {
+
+ _pModule->log(_modId, Logger::LOGERR, Chain("Invalid request"));
+
+ _xml.getDocument()->clear();
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_MSG_ATTR, Chain("Invalid request"));
+
+ _xml.getDocument()->setRootElement(pRoot);
+
+ _xml.getDocument()->setDocType(XML_ERROR_DOC);
+
+ Chain response;
+ _xml.getXMLChain(response);
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, response);
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _pN->setMsg(response, response.length());
+
+ _pN->writeMsg();
+
+ return false;
+ }
+ else
+ {
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+ if ( pRoot )
+ {
+ _user = pRoot->getAttributeValue(XML_NAME_ATTR);
+ _password = pRoot->getAttributeValue(XML_PASSWD_ATTR);
+
+ // response is sent after authorization check
+
+ return true;
+ }
+ else
+ {
+ throw Exception(EXLOC, "Cannot get root element from message");
+ }
+ }
+ }
+ catch ( Exception e)
+ {
+ Chain msg;
+ e.pop(msg);
+ _pModule->log(_modId, Logger::LOGERR, Chain("Aborting session. Reason=") + msg);
+ _pN->sendNack();
+ return false;
+
+ }
+}
+
+void CegoAdminHandler::setNetHandle(NetHandler *pN)
+{
+ _pN = pN;
+}
+
+NetHandler* CegoAdminHandler::getNetHandle()
+{
+ return _pN;
+}
+
+CegoAdminHandler::RequestType CegoAdminHandler::acceptRequest()
+{
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Accepting request"));
+#endif
+
+ if ( _pN->waitMsg(NETMNG_WAITMSG_TIMEOUT) == false )
+ return CegoAdminHandler::REQTIMEOUT;
+
+ _pN->readMsg();
+
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType == Chain(XML_RETRIEVETABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::RETRIEVETABLESET;
+ }
+ else if ( docType == Chain(XML_LOCKINFO_REQUEST) )
+ {
+ return CegoAdminHandler::LOCKINFO;
+ }
+ else if ( docType == Chain(XML_LOCKSTAT_REQUEST) )
+ {
+ return CegoAdminHandler::LOCKSTAT;
+ }
+ else if ( docType == Chain(XML_POOLINFO_REQUEST) )
+ {
+ return CegoAdminHandler::POOLINFO;
+ }
+ else if ( docType == Chain(XML_POOLENTRYLIST_REQUEST) )
+ {
+ return CegoAdminHandler::POOLENTRYLIST;
+ }
+ else if ( docType == Chain(XML_THREADINFO_REQUEST) )
+ {
+ return CegoAdminHandler::THREADINFO;
+ }
+ else if ( docType == Chain(XML_DBTHREADABORT_REQUEST) )
+ {
+ return CegoAdminHandler::DBTHREADABORT;
+ }
+ else if ( docType == Chain(XML_DBTHREADINFO_REQUEST) )
+ {
+ return CegoAdminHandler::DBTHREADINFO;
+ }
+ else if ( docType == Chain(XML_ADMTHREADINFO_REQUEST) )
+ {
+ return CegoAdminHandler::ADMTHREADINFO;
+ }
+ else if ( docType == Chain(XML_LOGTHREADINFO_REQUEST) )
+ {
+ return CegoAdminHandler::LOGTHREADINFO;
+ }
+ else if ( docType == Chain(XML_DBSESSIONINFO_REQUEST) )
+ {
+ return CegoAdminHandler::DBSESSIONINFO;
+ }
+ else if ( docType == Chain(XML_COPYINFO_REQUEST) )
+ {
+ return CegoAdminHandler::COPYINFO;
+ }
+ else if ( docType == Chain(XML_DEFINE_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::DEFINE_TABLESET;
+ }
+ else if ( docType == Chain(XML_REMOVE_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::REMOVE_TABLESET;
+ }
+ else if ( docType == Chain(XML_CREATE_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::CREATE_TABLESET;
+ }
+ else if ( docType == Chain(XML_DROP_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::DROP_TABLESET;
+ }
+ else if ( docType == Chain(XML_START_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::START_TABLESET;
+ }
+ else if ( docType == Chain(XML_STOP_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::STOP_TABLESET;
+ }
+ else if ( docType == Chain(XML_SYNC_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::SYNC_TABLESET;
+ }
+ else if ( docType == Chain(XML_INIT_LOGS_REQUEST) )
+ {
+ return CegoAdminHandler::INIT_LOGS;
+ }
+ else if ( docType == Chain(XML_GET_DBSPEC_REQUEST) )
+ {
+ return CegoAdminHandler::GET_DBSPEC;
+ }
+ else if ( docType == Chain(XML_COPY_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::COPY_TABLESET;
+ }
+ else if ( docType == Chain(XML_COPY_FILE_REQUEST) )
+ {
+ return CegoAdminHandler::COPY_FILE;
+ }
+ else if ( docType == Chain(XML_START_RECOVER_REQUEST) )
+ {
+ return CegoAdminHandler::START_RECOVERY;
+ }
+ else if ( docType == Chain(XML_STOP_RECOVER_REQUEST) )
+ {
+ return CegoAdminHandler::STOP_RECOVERY;
+ }
+ else if ( docType == Chain(XML_GET_NODELIST_REQUEST) )
+ {
+ return CegoAdminHandler::GET_NODELIST;
+ }
+ else if ( docType == Chain(XML_GET_DBINFO_REQUEST) )
+ {
+ return CegoAdminHandler::GET_DBINFO;
+ }
+ else if ( docType == Chain(XML_GET_TSINFO_REQUEST) )
+ {
+ return CegoAdminHandler::GET_TSINFO;
+ }
+ else if ( docType == Chain(XML_GET_DETAILED_TSINFO_REQUEST) )
+ {
+ return CegoAdminHandler::GET_DETAILED_TSINFO;
+ }
+ else if ( docType == Chain(XML_GET_OBJECT_INFO_REQUEST) )
+ {
+ return CegoAdminHandler::GET_OBJECT_INFO;
+ }
+ else if ( docType == Chain(XML_GET_TRANSACTION_INFO_REQUEST) )
+ {
+ return CegoAdminHandler::GET_TRANSACTION_INFO;
+ }
+ else if ( docType == Chain(XML_GET_BUSTAT_REQUEST) )
+ {
+ return CegoAdminHandler::GET_BUSTAT;
+ }
+ else if ( docType == Chain(XML_PROP_TSINFO_REQUEST) )
+ {
+ return CegoAdminHandler::PROP_TSINFO;
+ }
+ else if ( docType == Chain(XML_SET_TABLESETNODE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TABLESETNODE;
+ }
+ else if ( docType == Chain(XML_SET_LSN_REQUEST) )
+ {
+ return CegoAdminHandler::SET_LSN;
+ }
+ else if ( docType == Chain(XML_SET_RUNSTATE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_RUNSTATE;
+ }
+ else if ( docType == Chain(XML_SET_SYNCSTATE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_SYNCSTATE;
+ }
+ else if ( docType == Chain(XML_EXPORT_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::EXPORT_TABLESET;
+ }
+ else if ( docType == Chain(XML_IMPORT_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::IMPORT_TABLESET;
+ }
+ else if ( docType == Chain(XML_EXPORT_TABLE_REQUEST) )
+ {
+ return CegoAdminHandler::EXPORT_TABLE;
+ }
+ else if ( docType == Chain(XML_IMPORT_TABLE_REQUEST) )
+ {
+ return CegoAdminHandler::IMPORT_TABLE;
+ }
+ else if ( docType == Chain(XML_ADD_DATAFILE_REQUEST) )
+ {
+ return CegoAdminHandler::ADD_DATAFILE;
+ }
+ else if ( docType == Chain(XML_SHOW_USER_REQUEST) )
+ {
+ return CegoAdminHandler::SHOW_USER;
+ }
+ else if ( docType == Chain(XML_ADD_USER_REQUEST) )
+ {
+ return CegoAdminHandler::ADD_USER;
+ }
+ else if ( docType == Chain(XML_REMOVE_USER_REQUEST) )
+ {
+ return CegoAdminHandler::REMOVE_USER;
+ }
+ else if ( docType == Chain(XML_CHANGE_PWD_REQUEST) )
+ {
+ return CegoAdminHandler::CHANGE_PWD;
+ }
+ else if ( docType == Chain(XML_ASSIGN_ROLE_REQUEST) )
+ {
+ return CegoAdminHandler::ASSIGN_ROLE;
+ }
+ else if ( docType == Chain(XML_REMOVE_ROLE_REQUEST) )
+ {
+ return CegoAdminHandler::REMOVE_ROLE;
+ }
+ else if ( docType == Chain(XML_LIST_ROLE_REQUEST) )
+ {
+ return CegoAdminHandler::LIST_ROLE;
+ }
+ else if ( docType == Chain(XML_SHOW_ROLE_REQUEST) )
+ {
+ return CegoAdminHandler::SHOW_ROLE;
+ }
+ else if ( docType == Chain(XML_CREATE_ROLE_REQUEST) )
+ {
+ return CegoAdminHandler::CREATE_ROLE;
+ }
+ else if ( docType == Chain(XML_DROP_ROLE_REQUEST) )
+ {
+ return CegoAdminHandler::DROP_ROLE;
+ }
+ else if ( docType == Chain(XML_SET_PERM_REQUEST) )
+ {
+ return CegoAdminHandler::SET_PERM;
+ }
+ else if ( docType == Chain(XML_REMOVE_PERM_REQUEST) )
+ {
+ return CegoAdminHandler::REMOVE_PERM;
+ }
+
+ else if ( docType == Chain(XML_USER_TRACE_REQUEST) )
+ {
+ return CegoAdminHandler::USER_TRACE;
+ }
+ else if ( docType == Chain(XML_ADD_ARCHLOG_REQUEST) )
+ {
+ return CegoAdminHandler::ADD_ARCHLOG;
+ }
+ else if ( docType == Chain(XML_REMOVE_ARCHLOG_REQUEST) )
+ {
+ return CegoAdminHandler::REMOVE_ARCHLOG;
+ }
+ else if ( docType == Chain(XML_BEGIN_BACKUP_REQUEST) )
+ {
+ return CegoAdminHandler::BEGIN_BACKUP;
+ }
+ else if ( docType == Chain(XML_END_BACKUP_REQUEST) )
+ {
+ return CegoAdminHandler::END_BACKUP;
+ }
+ else if ( docType == Chain(XML_RECOVER_REQUEST) )
+ {
+ return CegoAdminHandler::RECOVER;
+ }
+ else if ( docType == Chain(XML_SECSWITCH_REQUEST) )
+ {
+ return CegoAdminHandler::SECSWITCH;
+ }
+ else if ( docType == Chain(XML_VERIFY_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::VERIFY_TABLESET;
+ }
+ else if ( docType == Chain(XML_CORRECT_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::CORRECT_TABLESET;
+ }
+ else if ( docType == Chain(XML_DUMP_OBJECT_REQUEST) )
+ {
+ return CegoAdminHandler::DUMP_OBJECT;
+ }
+ else if ( docType == Chain(XML_SET_LOGMNG_REQUEST) )
+ {
+ return CegoAdminHandler::SET_LOGMNG;
+ }
+ else if ( docType == Chain(XML_SHOW_LOGMNG_REQUEST) )
+ {
+ return CegoAdminHandler::SHOW_LOGMNG;
+ }
+ else if ( docType == Chain(XML_SET_CHECKPOINT_REQUEST) )
+ {
+ return CegoAdminHandler::SET_CHECKPOINT;
+ }
+ else if ( docType == Chain(XML_SET_TSINITFILE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSINITFILE;
+ }
+
+ else if ( docType == Chain(XML_SET_TSSYSSIZE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSSYSSIZE;
+ }
+ else if ( docType == Chain(XML_SET_TSTMPSIZE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSTMPSIZE;
+ }
+ else if ( docType == Chain(XML_SET_TSROOTPATH_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSROOTPATH;
+ }
+ else if ( docType == Chain(XML_SET_TSTICKET_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSTICKET;
+ }
+ else if ( docType == Chain(XML_SET_TSLOGNUM_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSLOGNUM;
+ }
+ else if ( docType == Chain(XML_SET_TSLOGSIZE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSLOGSIZE;
+ }
+ else if ( docType == Chain(XML_SET_TSSORTAREASIZE_REQUEST) )
+ {
+ return CegoAdminHandler::SET_TSSORTAREASIZE;
+ }
+
+ // mediator requests
+ else if ( docType == Chain(XML_MED_NOTIFY_REQUEST) )
+ {
+ return CegoAdminHandler::MED_NOTIFY;
+ }
+ else if ( docType == Chain(XML_MED_DEFINE_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_DEFINE_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_REMOVE_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_REMOVE_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_CREATE_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_CREATE_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_DROP_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_DROP_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_START_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_START_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_STOP_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_STOP_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_COPY_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_COPY_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_SWITCH_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_SWITCH_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_ADD_ARCHLOG_REQUEST) )
+ {
+ return CegoAdminHandler::MED_ADD_ARCHLOG;
+ }
+ else if ( docType == Chain(XML_MED_REMOVE_ARCHLOG_REQUEST) )
+ {
+ return CegoAdminHandler::MED_REMOVE_ARCHLOG;
+ }
+ else if ( docType == Chain(XML_MED_ADD_DATAFILE_REQUEST) )
+ {
+ return CegoAdminHandler::MED_ADD_DATAFILE;
+ }
+ else if ( docType == Chain(XML_MED_GET_TABLESETLIST_REQUEST) )
+ {
+ return CegoAdminHandler::MED_GET_TABLESETLIST;
+ }
+ else if ( docType == Chain(XML_MED_GET_DETAILEDTABLESETINFO_REQUEST) )
+ {
+ return CegoAdminHandler::MED_GET_DETAILEDTABLESETINFO;
+ }
+ else if ( docType == Chain(XML_MED_GET_OBJECTINFO_REQUEST) )
+ {
+ return CegoAdminHandler::MED_GET_OBJECTINFO;
+ }
+ else if ( docType == Chain(XML_MED_GET_TRANSACTIONINFO_REQUEST) )
+ {
+ return CegoAdminHandler::MED_GET_TRANSACTIONINFO;
+ }
+ else if ( docType == Chain(XML_MED_GET_BUSTAT_REQUEST) )
+ {
+ return CegoAdminHandler::MED_GET_BUSTAT;
+ }
+ else if ( docType == Chain(XML_MED_RESET_BUSTAT_REQUEST) )
+ {
+ return CegoAdminHandler::MED_RESET_BUSTAT;
+ }
+ else if ( docType == Chain(XML_MED_BEGIN_BACKUP_REQUEST) )
+ {
+ return CegoAdminHandler::MED_BEGIN_BACKUP;
+ }
+ else if ( docType == Chain(XML_MED_END_BACKUP_REQUEST) )
+ {
+ return CegoAdminHandler::MED_END_BACKUP;
+ }
+ else if ( docType == Chain(XML_MED_RECOVER_REQUEST) )
+ {
+ return CegoAdminHandler::MED_RECOVER;
+ }
+ else if ( docType == Chain(XML_MED_SECSWITCH_REQUEST) )
+ {
+ return CegoAdminHandler::MED_SECSWITCH;
+ }
+ else if ( docType == Chain(XML_SEC_MEDSWITCH_REQUEST) )
+ {
+ return CegoAdminHandler::SEC_MEDSWITCH;
+ }
+ else if ( docType == Chain(XML_MED_SECRELOCATE_REQUEST) )
+ {
+ return CegoAdminHandler::MED_SECRELOCATE;
+ }
+ else if ( docType == Chain(XML_SEC_MEDRELOCATE_REQUEST) )
+ {
+ return CegoAdminHandler::SEC_MEDRELOCATE;
+ }
+ else if ( docType == Chain(XML_MED_CHECK_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_CHECK_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_VERIFY_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_VERIFY_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_CORRECT_TABLESET_REQUEST) )
+ {
+ return CegoAdminHandler::MED_CORRECT_TABLESET;
+ }
+ else if ( docType == Chain(XML_MED_ENABLE_ARCHLOG_REQUEST) )
+ {
+ return CegoAdminHandler::MED_ENABLE_ARCHLOG;
+ }
+ else if ( docType == Chain(XML_MED_DISABLE_ARCHLOG_REQUEST) )
+ {
+ return CegoAdminHandler::MED_DISABLE_ARCHLOG;
+ }
+ else if ( docType == Chain(XML_SESSION_CLOSE) )
+ {
+ return CegoAdminHandler::SESSION_CLOSE;
+ }
+ else
+ {
+ return CegoAdminHandler::UNKNOWN;
+ }
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRetrieveTableSet(const Chain& masterHost)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_HOSTNAME_ATTR, masterHost);
+ return sendReq(XML_RETRIEVETABLESET_REQUEST, pRoot);
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqLockInfo(const Chain& lockCat)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_LOCKCAT_ATTR, lockCat);
+ return sendReq(XML_LOCKINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqLockStat()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_LOCKSTAT_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqPoolInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_POOLINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqPoolEntryList()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_POOLENTRYLIST_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqThreadInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_THREADINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDbThreadAbort(int threadId)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_THID_ATTR, Chain(threadId));
+ return sendReq(XML_DBTHREADABORT_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDbThreadInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_DBTHREADINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqAdmThreadInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_ADMTHREADINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqLogThreadInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_LOGTHREADINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDbSessionInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_DBSESSIONINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqCopyInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_COPYINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDefineTableSet(
+ const Chain& tableSet,
+ const Chain& tsRoot,
+ const Chain& tsTicket,
+ const Chain& primary,
+ const Chain& secondary,
+ const Chain& mediator,
+ int sysFileId, int tempFileId, int sysFileSize, int tmpFileSize,
+ int logFileSize, int logFileNum, long sortAreaSize)
+{
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TSROOT_ATTR, tsRoot);
+ pRoot->setAttribute(XML_TSTICKET_ATTR, tsTicket);
+ pRoot->setAttribute(XML_PRIMARY_ATTR, primary);
+ pRoot->setAttribute(XML_SECONDARY_ATTR, secondary);
+ pRoot->setAttribute(XML_MEDIATOR_ATTR, mediator);
+ pRoot->setAttribute(XML_SYSFID_ATTR, Chain(sysFileId));
+ pRoot->setAttribute(XML_TMPFID_ATTR, Chain(tempFileId));
+ pRoot->setAttribute(XML_SYSSIZE_ATTR, Chain(sysFileSize));
+ pRoot->setAttribute(XML_TMPSIZE_ATTR, Chain(tmpFileSize));
+ pRoot->setAttribute(XML_LOGFILESIZE_ATTR, Chain(logFileSize));
+ pRoot->setAttribute(XML_LOGFILENUM_ATTR, Chain(logFileNum));
+ pRoot->setAttribute(XML_SORTAREASIZE_ATTR, Chain(sortAreaSize));
+
+ return sendReq(XML_DEFINE_TABLESET_REQUEST, pRoot);
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRemoveTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_REMOVE_TABLESET_REQUEST, pRoot);
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqCreateTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_CREATE_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDropTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_DROP_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqStartTableSet(const Chain& tableSet, bool cleanIt, bool forceload)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+
+ if ( cleanIt )
+ pRoot->setAttribute(XML_CLEANUP_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_CLEANUP_ATTR, XML_FALSE_VALUE);
+
+ if ( forceload )
+ pRoot->setAttribute(XML_FORCELOAD_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_FORCELOAD_ATTR, XML_FALSE_VALUE);
+
+
+ return sendReq(XML_START_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqStopTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_STOP_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqVerifyTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_VERIFY_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqInitLogs(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_INIT_LOGS_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSyncTableSet(const Chain& tableSet, const Chain& msg, const Chain& escCmd, int timeout)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_BUMSG_ATTR, msg);
+
+ if ( escCmd != Chain("") )
+ {
+ pRoot->setAttribute(XML_ESCCMD_ATTR, escCmd);
+ pRoot->setAttribute(XML_TIMEOUT_ATTR, Chain(timeout));
+ }
+ return sendReq(XML_SYNC_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqStartRecovery(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_START_RECOVER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqStopRecovery(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_STOP_RECOVER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqCopyTableSet(const Chain& tableSet, const Chain& secondary, const Chain& mediator)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_SECONDARY_ATTR, secondary);
+ pRoot->setAttribute(XML_MEDIATOR_ATTR, mediator);
+ return sendReq(XML_COPY_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqCopyFile(const Chain& fileName, int copyId)
+{
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_FILENAME_ATTR, fileName);
+
+ File copyFile(fileName);
+ copyFile.open(File::READ);
+
+ int fileSize = copyFile.Size();
+
+ pRoot->setAttribute(XML_FILESIZE_ATTR, Chain(copyFile.Size()));
+
+ _xml.getDocument()->clear();
+ _xml.getDocument()->setRootElement(pRoot);
+ _xml.getDocument()->setDocType(XML_COPY_FILE_REQUEST);
+
+ Chain request;
+ _xml.getXMLChain(request);
+ _xml.getDocument()->clear();
+
+ _pN->setMsg(request, request.length());
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Sending request ") + request);
+#endif
+
+ _pN->writeMsg();
+
+ _pN->readMsg();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Got response ") + _pN->getMsg());
+#endif
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ CegoAdminHandler::ResultType res = ADM_OK;
+
+ if ( docType == Chain(XML_OK_DOC) )
+ {
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Sending file data for ") + fileName);
+#endif
+
+
+ char buf[NETMNG_MSG_BUFLEN];
+ int len;
+
+ int sentByte = 0;
+ while ( ( len = copyFile.readByte(buf, NETMNG_MSG_BUFLEN) ) > 0 )
+ {
+ _pN->setMsg(buf, len);
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Sending ") + Chain(len) + Chain(" bytes"));
+#endif
+
+ _pN->writeMsg();
+ _pN->recvAck();
+
+ sentByte += len;
+
+ }
+ res = ADM_OK;
+ }
+ else // if ( docType == Chain(XML_ERROR_DOC) )
+ {
+ res = ADM_ERROR;
+ }
+
+ copyFile.close();
+ return res;
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetDbSpec(Chain& dbSpec)
+{
+
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+
+ _xml.getDocument()->clear();
+ _xml.getDocument()->setRootElement(pRoot);
+ _xml.getDocument()->setDocType(XML_GET_DBSPEC_REQUEST);
+
+ Chain request;
+ _xml.getXMLChain(request);
+ _xml.getDocument()->clear();
+
+ _pN->setMsg(request, request.length());
+
+ _pN->writeMsg();
+
+ _pN->readMsg();
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType == Chain(XML_ERROR_DOC) )
+ return ADM_ERROR;
+
+
+ if ( docType == Chain(XML_OK_DOC) )
+ {
+ pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> specList = pRoot->getChildren(XML_DATABASE_ELEMENT);
+
+ Element** pSpec = specList.First();
+
+ if ( pSpec )
+ {
+
+ Document *pDoc = new Document(XML_CEGO);
+ pDoc->setAttribute(XML_VERSION_ATTR, XML_VERSION_VALUE);
+ XMLSuite xml;
+ xml.setDocument(pDoc);
+
+ pDoc->setRootElement(*pSpec);
+ pDoc->setDocType(XML_CEGO_DB_CONFIG_DOC);
+
+ xml.getXMLChain(dbSpec);
+
+ delete pDoc;
+ }
+ }
+ }
+ return ADM_OK;
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetNodeList()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_GET_NODELIST_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetDbInfo()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_GET_DBINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetTSInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_GET_TSINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqPropTSInfo(Element *pTSInfo)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->addContent(pTSInfo);
+ return sendReq(XML_PROP_TSINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTableSetNode(const Chain& tableSet, const Chain& primary, const Chain& secondary, const Chain& mediator)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_PRIMARY_ATTR, primary);
+ pRoot->setAttribute(XML_SECONDARY_ATTR, secondary);
+ pRoot->setAttribute(XML_MEDIATOR_ATTR, mediator);
+ return sendReq(XML_SET_TABLESETNODE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetLSN(const Chain& tableSet, long lsn)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_LSN_ATTR, Chain(lsn));
+ return sendReq(XML_SET_LSN_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetRunState(const Chain& tableSet, const Chain& runState)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_RUNSTATE_ATTR, runState);
+ return sendReq(XML_SET_RUNSTATE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetSyncState(const Chain& tableSet, const Chain& syncState)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_SYNCSTATE_ATTR, syncState);
+ return sendReq(XML_SET_SYNCSTATE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqExportTableSet(const Chain& tableSet, bool isStructure, const Chain& exportFile, const Chain& expMode)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_FILENAME_ATTR, exportFile);
+ if ( isStructure )
+ pRoot->setAttribute(XML_ISSTRUCT_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_ISSTRUCT_ATTR, XML_FALSE_VALUE);
+ pRoot->setAttribute(XML_MODE_ATTR, expMode);
+
+ return sendReq(XML_EXPORT_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqImportTableSet(const Chain& tableSet, bool isStructure, const Chain& importFile, bool doLogging, const Chain& impMode)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_FILENAME_ATTR, importFile);
+ if ( isStructure )
+ pRoot->setAttribute(XML_ISSTRUCT_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_ISSTRUCT_ATTR, XML_FALSE_VALUE);
+ if ( doLogging )
+ pRoot->setAttribute(XML_DOLOGGING_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_DOLOGGING_ATTR, XML_FALSE_VALUE);
+
+ pRoot->setAttribute(XML_MODE_ATTR, impMode);
+ return sendReq(XML_IMPORT_TABLESET_REQUEST, pRoot);
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqExportTable(const Chain& tableSet, const Chain& tableName, const Chain& exportFile, const Chain& expMode)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TABLENAME_ATTR, tableName);
+ pRoot->setAttribute(XML_FILENAME_ATTR, exportFile);
+ pRoot->setAttribute(XML_MODE_ATTR, expMode);
+ return sendReq(XML_EXPORT_TABLE_REQUEST, pRoot);
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqImportTable(const Chain& tableSet, const Chain& tableName, const Chain& importFile, bool doLogging, const Chain& impMode)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TABLENAME_ATTR, tableName);
+ pRoot->setAttribute(XML_FILENAME_ATTR, importFile);
+ pRoot->setAttribute(XML_MODE_ATTR, impMode);
+ if ( doLogging )
+ pRoot->setAttribute(XML_DOLOGGING_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_DOLOGGING_ATTR, XML_FALSE_VALUE);
+
+ return sendReq(XML_IMPORT_TABLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqAddDataFile(const Chain& tableSet, const Chain& type, int fileId, const Chain& dataFile, int fileSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TYPE_ATTR, type);
+ pRoot->setAttribute(XML_FILEID_ATTR, Chain(fileId));
+ pRoot->setAttribute(XML_FILENAME_ATTR, dataFile);
+ pRoot->setAttribute(XML_FILESIZE_ATTR, Chain(fileSize));
+ return sendReq(XML_ADD_DATAFILE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqShowUser()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_SHOW_USER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqAddUser(const Chain& user, const Chain& password)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+ AESCrypt aescrypt(CEGOAESKEY, CEGOAESKEYLEN);
+ pRoot->setAttribute(XML_PASSWD_ATTR, aescrypt.encrypt(password));
+
+ return sendReq(XML_ADD_USER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRemoveUser(const Chain& user)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+ return sendReq(XML_REMOVE_USER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqChangePwd(const Chain& user, const Chain& password)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+ AESCrypt aescrypt(CEGOAESKEY, CEGOAESKEYLEN);
+ pRoot->setAttribute(XML_PASSWD_ATTR, aescrypt.encrypt(password));
+
+ return sendReq(XML_CHANGE_PWD_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqListRole()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_LIST_ROLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqShowRole(const Chain& role)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ return sendReq(XML_SHOW_ROLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqCreateRole(const Chain& role)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ return sendReq(XML_CREATE_ROLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDropRole(const Chain& role)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ return sendReq(XML_DROP_ROLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqAssignRole(const Chain& user, const Chain& role)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ return sendReq(XML_ASSIGN_ROLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRemoveRole(const Chain& user, const Chain& role)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ return sendReq(XML_REMOVE_ROLE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetPermission(const Chain& role, const Chain& permid, const Chain& tableSet, const Chain& filter, const Chain& perm)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ pRoot->setAttribute(XML_PERMID_ATTR, permid);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_FILTER_ATTR, filter);
+ pRoot->setAttribute(XML_PERM_ATTR, perm);
+
+ return sendReq(XML_SET_PERM_REQUEST, pRoot);
+
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRemovePermission(const Chain& role, const Chain& permid)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_ROLE_ATTR, role);
+ pRoot->setAttribute(XML_PERMID_ATTR, permid);
+
+ return sendReq(XML_REMOVE_PERM_REQUEST, pRoot);
+
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqUserTrace( const Chain& user, bool isOn)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_NAME_ATTR, user);
+ if ( isOn )
+ pRoot->setAttribute(XML_TRACE_ATTR, XML_ON_VALUE);
+ else
+ pRoot->setAttribute(XML_TRACE_ATTR, XML_OFF_VALUE);
+
+ return sendReq(XML_USER_TRACE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqAddArchLog(const Chain& tableSet, const Chain& archId, const Chain& archPath)
+{
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_ARCHID_ATTR, archId);
+ pRoot->setAttribute(XML_ARCHPATH_ATTR, archPath);
+ return sendReq(XML_ADD_ARCHLOG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqBeginBackup(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_BEGIN_BACKUP_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqEndBackup(const Chain& tableSet, bool keepTicket)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ if ( keepTicket )
+ pRoot->setAttribute(XML_KEEPTICKET_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_KEEPTICKET_ATTR, XML_FALSE_VALUE);
+
+ return sendReq(XML_END_BACKUP_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRecover(const Chain& tableSet, int pit)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_PIT_ATTR, Chain(pit));
+ return sendReq(XML_RECOVER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSecSwitch(const Chain& tableSet, const Chain& secondary)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_SECONDARY_ATTR, secondary);
+ return sendReq(XML_SECSWITCH_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqRemoveArchLog(const Chain& tableSet, const Chain& archId)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_ARCHID_ATTR, archId);
+ return sendReq(XML_REMOVE_ARCHLOG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetDetailedTSInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_GET_DETAILED_TSINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetBUStatInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_GET_BUSTAT_REQUEST, pRoot);
+}
+
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetObjectInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_GET_OBJECT_INFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqGetTransactionInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_GET_TRANSACTION_INFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqDumpObject(const Chain& tableSet, CegoObject::ObjectType type, const Chain& objName)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+
+ CegoTypeConverter tc;
+ pRoot->setAttribute(XML_OBJTYPE_ATTR, tc.getObjectTypeString(type));
+ pRoot->setAttribute(XML_OBJNAME_ATTR, objName);
+
+ return sendReq(XML_DUMP_OBJECT_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetLogMng(const Chain& progName, int timeout)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_LOGMNGPROG_ATTR, progName);
+ pRoot->setAttribute(XML_LOGMNGTIMEOUT_ATTR, Chain(timeout));
+
+ return sendReq(XML_SET_LOGMNG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqShowLogMng()
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ return sendReq(XML_SHOW_LOGMNG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetCheckpoint(const Chain& tableSet, int timeout)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TIMEOUT_ATTR, Chain(timeout));
+ return sendReq(XML_SET_CHECKPOINT_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSInitFile(const Chain& tableSet, const Chain& initFile)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TSINITFILE_ATTR, initFile);
+ return sendReq(XML_SET_TSINITFILE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSSysSize(const Chain& tableSet, int sysSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_SYSSIZE_ATTR, Chain(sysSize));
+ return sendReq(XML_SET_TSSYSSIZE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSTmpSize(const Chain& tableSet, int tmpSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TMPSIZE_ATTR, Chain(tmpSize));
+ return sendReq(XML_SET_TSTMPSIZE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSRootPath(const Chain& tableSet, const Chain& tsRoot)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TSROOT_ATTR, tsRoot);
+ return sendReq(XML_SET_TSROOTPATH_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSTicket(const Chain& tableSet, const Chain& tsTicket)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TSTICKET_ATTR, tsTicket);
+ return sendReq(XML_SET_TSTICKET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSLogNum(const Chain& tableSet, int logNum)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_LOGFILENUM_ATTR, Chain(logNum));
+ return sendReq(XML_SET_TSLOGNUM_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSLogSize(const Chain& tableSet, int logSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_LOGFILESIZE_ATTR, Chain(logSize));
+ return sendReq(XML_SET_TSLOGSIZE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::reqSetTSSortAreaSize(const Chain& tableSet, int sortAreaSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_SORTAREASIZE_ATTR, Chain(sortAreaSize));
+ return sendReq(XML_SET_TSSORTAREASIZE_REQUEST, pRoot);
+}
+
+////////////////////////////////////////////////
+//////////// Mediator Services /////////////////
+////////////////////////////////////////////////
+
+CegoAdminHandler::ResultType CegoAdminHandler::medNotifyMediator(const Chain& hostName, const Chain& status,
+ const ListT<Chain>& tsList, const ListT<Chain>& runList, const ListT<Chain>& syncList)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_HOSTNAME_ATTR, hostName);
+ pRoot->setAttribute(XML_STATUS_ATTR, status);
+
+ Chain *pTS = tsList.First();
+ Chain *pSync = syncList.First();
+ Chain *pRun = runList.First();
+ while ( pTS && pSync )
+ {
+ Element* pTE = new Element(XML_TABLESET_ELEMENT);
+ pTE->setAttribute(XML_NAME_ATTR, *pTS);
+ pTE->setAttribute(XML_SYNCSTATE_ATTR, *pSync);
+ pTE->setAttribute(XML_RUNSTATE_ATTR, *pRun);
+ pRoot->addContent(pTE);
+
+ pTS = tsList.Next();
+ pSync = syncList.Next();
+ pRun = runList.Next();
+ }
+
+ return sendReq(XML_MED_NOTIFY_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medStartTableSet(const Chain& tableSet, bool cleanIt, bool forceload)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ if ( cleanIt )
+ pRoot->setAttribute(XML_CLEANUP_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_CLEANUP_ATTR, XML_FALSE_VALUE);
+
+ if ( forceload )
+ pRoot->setAttribute(XML_FORCELOAD_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_FORCELOAD_ATTR, XML_FALSE_VALUE);
+
+ return sendReq(XML_MED_START_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medStopTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_STOP_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medDefineTableSet(const Chain& tableSet,
+ const Chain& tsRoot,
+ const Chain& tsTicket,
+ const Chain& primary,
+ const Chain& secondary,
+ int sysFileSize,
+ int tmpFileSize,
+ int logFileSize,
+ int logFileNum,
+ long sortAreaSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TSROOT_ATTR, tsRoot);
+ pRoot->setAttribute(XML_TSTICKET_ATTR, tsTicket);
+ pRoot->setAttribute(XML_PRIMARY_ATTR, primary);
+ pRoot->setAttribute(XML_SECONDARY_ATTR, secondary);
+ pRoot->setAttribute(XML_SYSSIZE_ATTR, Chain(sysFileSize));
+ pRoot->setAttribute(XML_TMPSIZE_ATTR, Chain(tmpFileSize));
+ pRoot->setAttribute(XML_LOGFILESIZE_ATTR, Chain(logFileSize));
+ pRoot->setAttribute(XML_LOGFILENUM_ATTR, Chain(logFileNum));
+ pRoot->setAttribute(XML_SORTAREASIZE_ATTR, Chain(sortAreaSize));
+
+ return sendReq(XML_MED_DEFINE_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medDropTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_DROP_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medRemoveTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_REMOVE_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medCreateTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_CREATE_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medSwitchTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_SWITCH_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medAddDataFile(const Chain& tableSet, const Chain& fileType, const Chain& dataFile, int fileSize)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_TYPE_ATTR, fileType);
+ pRoot->setAttribute(XML_FILENAME_ATTR, dataFile);
+ pRoot->setAttribute(XML_FILESIZE_ATTR, Chain(fileSize));
+ return sendReq(XML_MED_ADD_DATAFILE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medAddArchLog(const Chain& tableSet, const Chain& archId, const Chain& archPath)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_ARCHID_ATTR, archId);
+ pRoot->setAttribute(XML_ARCHPATH_ATTR, archPath);
+ return sendReq(XML_MED_ADD_ARCHLOG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medRemoveArchLog(const Chain& tableSet, const Chain& archId)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_ARCHID_ATTR, archId);
+ return sendReq(XML_MED_REMOVE_ARCHLOG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medCopyTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_COPY_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medGetTableSetList(bool getUsage)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ if ( getUsage )
+ pRoot->setAttribute(XML_USAGE_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_USAGE_ATTR, XML_FALSE_VALUE);
+
+ return sendReq(XML_MED_GET_TABLESETLIST_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medGetDetailedTableSetInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_GET_DETAILEDTABLESETINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medGetObjectInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_GET_OBJECTINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medGetTransactionInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_GET_TRANSACTIONINFO_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medGetBUStatInfo(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_GET_BUSTAT_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medResetBUStat(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_RESET_BUSTAT_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medBeginBackup(const Chain& tableSet, const Chain& msg)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_BUMSG_ATTR, msg);
+ return sendReq(XML_MED_BEGIN_BACKUP_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medEndBackup(const Chain& tableSet, const Chain& msg, bool keepTicket)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_BUMSG_ATTR, msg);
+ if ( keepTicket )
+ pRoot->setAttribute(XML_KEEPTICKET_ATTR, XML_TRUE_VALUE);
+ else
+ pRoot->setAttribute(XML_KEEPTICKET_ATTR, XML_FALSE_VALUE);
+ return sendReq(XML_MED_END_BACKUP_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medRecover(const Chain& tableSet, int pit)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_PIT_ATTR, Chain(pit));
+ return sendReq(XML_MED_RECOVER_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medSecSwitch(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_SECSWITCH_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medSecRelocate(const Chain& tableSet, const Chain& secondary)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_SECONDARY_ATTR, secondary);
+ return sendReq(XML_MED_SECRELOCATE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::secMedSwitch(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_SEC_MEDSWITCH_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medEnableArchLog(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_ENABLE_ARCHLOG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medDisableArchLog(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_DISABLE_ARCHLOG_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::secMedRelocate(const Chain& tableSet, const Chain& mediator)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ pRoot->setAttribute(XML_MEDIATOR_ATTR, mediator);
+ return sendReq(XML_SEC_MEDRELOCATE_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medCheckTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_CHECK_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medVerifyTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_VERIFY_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::medCorrectTableSet(const Chain& tableSet)
+{
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_TABLESET_ATTR, tableSet);
+ return sendReq(XML_MED_CORRECT_TABLESET_REQUEST, pRoot);
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::sendReq(const Chain& reqType, Element* pRoot)
+{
+ _xml.getDocument()->clear();
+ _xml.getDocument()->setRootElement(pRoot);
+ _xml.getDocument()->setDocType(reqType);
+
+ Chain request;
+ _xml.getXMLChain(request);
+ _xml.getDocument()->clear();
+
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, request);
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _pN->setMsg(request, request.length());
+
+ _pN->writeMsg();
+
+ _pN->readMsg();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType == Chain(XML_OK_DOC) )
+ {
+ return ADM_OK;
+ }
+ else if ( docType == Chain(XML_INFO_DOC) )
+ {
+ return ADM_INFO;
+ }
+ else // if ( docType == Chain(XML_ERROR_DOC) )
+ {
+ return ADM_ERROR;
+ }
+
+}
+
+void CegoAdminHandler::getMsg(Chain& msg)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ msg = pRoot->getAttributeValue(XML_MSG_ATTR);
+ }
+}
+
+
+void CegoAdminHandler::getBUMsg(Chain& msg)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ msg = pRoot->getAttributeValue(XML_BUMSG_ATTR);
+ }
+}
+
+const Chain& CegoAdminHandler::getUser()
+{
+ return _user;
+}
+
+const Chain& CegoAdminHandler::getPassword()
+{
+ return _password;
+}
+
+void CegoAdminHandler::getTableSet(Chain& tableSet)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tableSet = pRoot->getAttributeValue(XML_TABLESET_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTableSetRoot(Chain& tsRoot)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tsRoot = pRoot->getAttributeValue(XML_TSROOT_ATTR);
+ }
+}
+
+
+void CegoAdminHandler::getTableSetTSTicket(Chain& tsTicket)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tsTicket = pRoot->getAttributeValue(XML_TSTICKET_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTableName(Chain& tableName)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tableName = pRoot->getAttributeValue(XML_TABLENAME_ATTR);
+ }
+}
+
+void CegoAdminHandler::getThreadId(int& threadId)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ threadId = pRoot->getAttributeValue(XML_THID_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getEscapeCmd(Chain& escCmd)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ escCmd = pRoot->getAttributeValue(XML_ESCCMD_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTSInitFile(Chain& initFile)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ initFile = pRoot->getAttributeValue(XML_TSINITFILE_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTSSysSize(int& sysSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ sysSize = pRoot->getAttributeValue(XML_SYSSIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTSTmpSize(int& tmpSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tmpSize = pRoot->getAttributeValue(XML_TMPSIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTSRootPath(Chain& tsRoot)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tsRoot = pRoot->getAttributeValue(XML_TSROOT_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTSTicket(Chain& tsTicket)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tsTicket = pRoot->getAttributeValue(XML_TSTICKET_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTSLogNum(int& logNum)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ logNum = pRoot->getAttributeValue(XML_LOGFILENUM_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTSLogSize(int& logSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ logSize = pRoot->getAttributeValue(XML_LOGFILESIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTSSortAreaSize(int& sortAreaSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ sortAreaSize = pRoot->getAttributeValue(XML_SORTAREASIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTimeoutValue(int& timeout)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ timeout = pRoot->getAttributeValue(XML_TIMEOUT_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getFileName(Chain& fileName)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ fileName = pRoot->getAttributeValue(XML_FILENAME_ATTR);
+ }
+}
+
+void CegoAdminHandler::getFileType(Chain& fileType)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ fileType = pRoot->getAttributeValue(XML_TYPE_ATTR);
+ }
+}
+
+void CegoAdminHandler::getFileId(int& fileId)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ fileId = pRoot->getAttributeValue(XML_FILEID_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getFileSize(int& fileSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ fileSize = pRoot->getAttributeValue(XML_FILESIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getFilter(Chain& filter)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ filter = pRoot->getAttributeValue(XML_FILTER_ATTR);
+ }
+}
+
+void CegoAdminHandler::getSysFileId(int& sysFid)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ sysFid = pRoot->getAttributeValue(XML_SYSFID_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTmpFileId(int& tmpFid)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tmpFid = pRoot->getAttributeValue(XML_TMPFID_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getSysSize(int& sysSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ sysSize = pRoot->getAttributeValue(XML_SYSSIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getTmpSize(int& tmpSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ tmpSize = pRoot->getAttributeValue(XML_TMPSIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getLogFileSize(int& logFileSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ logFileSize = pRoot->getAttributeValue(XML_LOGFILESIZE_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getLogFileNum(int& logFileNum)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ logFileNum = pRoot->getAttributeValue(XML_LOGFILENUM_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getSortAreaSize(long& sortAreaSize)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ sortAreaSize = pRoot->getAttributeValue(XML_SORTAREASIZE_ATTR).asLong();
+ }
+}
+
+void CegoAdminHandler::getTargetHost(Chain& targetHost)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ targetHost = pRoot->getAttributeValue(XML_TARGETHOST_ATTR);
+ }
+}
+
+void CegoAdminHandler::getUser(Chain& user)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ user = pRoot->getAttributeValue(XML_NAME_ATTR);
+ }
+}
+
+void CegoAdminHandler::getPassword(Chain& password)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ password = pRoot->getAttributeValue(XML_PASSWD_ATTR);
+ }
+}
+
+void CegoAdminHandler::getPerm(Chain& perm)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ perm = pRoot->getAttributeValue(XML_PERM_ATTR);
+ }
+}
+
+void CegoAdminHandler::getPermId(Chain& permid)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ permid = pRoot->getAttributeValue(XML_PERMID_ATTR);
+ }
+}
+
+void CegoAdminHandler::getRole(Chain& role)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ role = pRoot->getAttributeValue(XML_ROLE_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTrace(bool& isOn)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( pRoot->getAttributeValue(XML_TRACE_ATTR) == Chain(XML_ON_VALUE) )
+ isOn = true;
+ else
+ isOn = false;
+ }
+}
+
+void CegoAdminHandler::getUsage(bool& getUsage)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( pRoot->getAttributeValue(XML_USAGE_ATTR) == Chain(XML_TRUE_VALUE) )
+ getUsage = true;
+ else
+ getUsage = false;
+ }
+}
+
+void CegoAdminHandler::getLogManager(Chain& progName)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ progName = pRoot->getAttributeValue(XML_LOGMNGPROG_ATTR);
+ }
+}
+
+void CegoAdminHandler::getLogManagerTimeout(int& timeout)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ timeout = pRoot->getAttributeValue(XML_LOGMNGTIMEOUT_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getLockCat(Chain& lockCat)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ lockCat = pRoot->getAttributeValue(XML_LOCKCAT_ATTR);
+ }
+}
+
+void CegoAdminHandler::getPrimary(Chain& primary)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ primary = pRoot->getAttributeValue(XML_PRIMARY_ATTR);
+ }
+}
+
+void CegoAdminHandler::getSecondary(Chain& secondary)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ secondary = pRoot->getAttributeValue(XML_SECONDARY_ATTR);
+ }
+}
+
+void CegoAdminHandler::getMediator(Chain& mediator)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ mediator = pRoot->getAttributeValue(XML_MEDIATOR_ATTR);
+ }
+}
+
+void CegoAdminHandler::getLSN(long& lsn)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ lsn = pRoot->getAttributeValue(XML_LSN_ATTR).asLong();
+ }
+}
+
+
+void CegoAdminHandler::getRunState(Chain& runState)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ runState = pRoot->getAttributeValue(XML_RUNSTATE_ATTR);
+ }
+}
+
+void CegoAdminHandler::getSyncState(Chain& syncState)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ syncState = pRoot->getAttributeValue(XML_SYNCSTATE_ATTR);
+ }
+}
+
+void CegoAdminHandler::getDataId(Chain& dataId)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ dataId = pRoot->getAttributeValue(XML_DATAID_ATTR);
+ }
+}
+
+void CegoAdminHandler::getPit(int& pit)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ pit = pRoot->getAttributeValue(XML_PIT_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getIsStructure(bool& isStructure)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( pRoot->getAttributeValue(XML_ISSTRUCT_ATTR) == Chain(XML_TRUE_VALUE) )
+ isStructure = true;
+ else
+ isStructure = false;
+ }
+}
+
+void CegoAdminHandler::getDoLogging(bool& doLogging)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( pRoot->getAttributeValue(XML_DOLOGGING_ATTR) == Chain(XML_TRUE_VALUE) )
+ doLogging = true;
+ else
+ doLogging = false;
+ }
+}
+
+void CegoAdminHandler::getKeepTicket(bool& keepTicket)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( pRoot->getAttributeValue(XML_KEEPTICKET_ATTR) == Chain(XML_TRUE_VALUE) )
+ keepTicket = true;
+ else
+ keepTicket = false;
+ }
+}
+
+void CegoAdminHandler::getHostRole(Chain& hostRole)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ hostRole = pRoot->getAttributeValue(XML_HOSTROLE_ATTR);
+ }
+}
+
+
+void CegoAdminHandler::getHostName(Chain& hostName)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ hostName = pRoot->getAttributeValue(XML_HOSTNAME_ATTR);
+ }
+}
+
+void CegoAdminHandler::getHostStatus(Chain& hostStatus)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ hostStatus = pRoot->getAttributeValue(XML_STATUS_ATTR);
+ }
+}
+
+void CegoAdminHandler::getDataPort(int& dataPort)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ dataPort = pRoot->getAttributeValue(XML_DATAPORT_ATTR).asInteger();
+ }
+}
+
+void CegoAdminHandler::getAdminPort(int& adminPort)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ adminPort = pRoot->getAttributeValue(XML_ADMINPORT_ATTR).asInteger();
+ }
+}
+
+
+void CegoAdminHandler::getArchId(Chain& archId)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ archId = pRoot->getAttributeValue(XML_ARCHID_ATTR);
+ }
+}
+
+void CegoAdminHandler::getArchPath(Chain& archPath)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ archPath = pRoot->getAttributeValue(XML_ARCHPATH_ATTR);
+ }
+}
+
+void CegoAdminHandler::getTableSyncStateList(ListT<Chain>& tsList, ListT<Chain>& runList, ListT<Chain>& syncList)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> teList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+
+ Element **pTE = teList.First();
+ while ( pTE )
+ {
+
+ tsList.Insert((*pTE)->getAttributeValue(XML_NAME_ATTR));
+ runList.Insert((*pTE)->getAttributeValue(XML_RUNSTATE_ATTR));
+ syncList.Insert((*pTE)->getAttributeValue(XML_SYNCSTATE_ATTR));
+
+ pTE = teList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getMode(Chain& mode)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ mode = pRoot->getAttributeValue(XML_MODE_ATTR);
+ }
+}
+
+bool CegoAdminHandler::getCleanup()
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( (Chain)pRoot->getAttributeValue(XML_CLEANUP_ATTR) == Chain(XML_TRUE_VALUE) )
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ throw Exception(EXLOC, "No root element found");
+ }
+}
+
+
+bool CegoAdminHandler::getForceload()
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ if ( (Chain)pRoot->getAttributeValue(XML_FORCELOAD_ATTR) == Chain(XML_TRUE_VALUE) )
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ throw Exception(EXLOC, "No root element found");
+ }
+}
+
+void CegoAdminHandler::getObjName(Chain& objName)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ objName = pRoot->getAttributeValue(XML_OBJNAME_ATTR);
+ }
+
+}
+
+void CegoAdminHandler::getObjType(CegoObject::ObjectType& type)
+{
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ CegoTypeConverter tc;
+ Chain objType = pRoot->getAttributeValue(XML_OBJTYPE_ATTR);
+ type = tc.getObjectTypeId(objType);
+ }
+}
+
+void CegoAdminHandler::sendResponse(const Chain& msg, Element *pSubElement)
+{
+ _xml.getDocument()->clear();
+ _xml.getDocument()->setDocType(XML_OK_DOC);
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_MSG_ATTR, msg);
+
+ if ( pSubElement )
+ pRoot->addContent(pSubElement);
+
+ _xml.getDocument()->setRootElement(pRoot);
+
+ Chain xmlString;
+ _xml.getXMLChain(xmlString);
+
+ _xml.getDocument()->clear();
+
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, xmlString);
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+
+ _pN->setMsg(xmlString, xmlString.length());
+ _pN->writeMsg();
+
+}
+
+void CegoAdminHandler::sendData(const Chain& data)
+{
+
+ _xml.getDocument()->clear();
+ _xml.getDocument()->setDocType(XML_OK_DOC);
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_DATALEN_ATTR, Chain(data.length()));
+
+ _xml.getDocument()->setRootElement(pRoot);
+
+ Chain xmlString;
+ _xml.getXMLChain(xmlString);
+
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, xmlString);
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _pN->setMsg(xmlString, xmlString.length());
+
+ _pN->writeMsg();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Waiting for ack ..."));
+#endif
+
+ _pN->recvAck();
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("Sending data of size ") + Chain(data.length()) + Chain(" ..."));
+#endif
+
+ _pN->setMsg(data, data.length());
+
+ _pN->writeMsg();
+
+}
+
+CegoAdminHandler::ResultType CegoAdminHandler::nextInfo()
+{
+ _pN->sendAck();
+ _pN->readMsg();
+
+ _xml.getDocument()->clear();
+ _xml.setChain( _pN->getMsg() );
+ _xml.parse();
+
+ Chain docType = _xml.getDocument()->getDocType();
+
+ if ( docType == Chain(XML_OK_DOC) )
+ {
+ return ADM_OK;
+ }
+ else if ( docType == Chain(XML_ERROR_DOC) )
+ {
+ return ADM_ERROR;
+ }
+ else if ( docType == Chain(XML_INFO_DOC) )
+ {
+ return ADM_INFO;
+ }
+ else
+ {
+ throw Exception(EXLOC, "Invalid document type");
+ }
+}
+
+bool CegoAdminHandler::syncWithInfo(const Chain& hostRole, const Chain& hostName, const Chain& msg, Element *pInfo)
+{
+
+ _xml.getDocument()->clear();
+
+ _xml.getDocument()->setDocType(XML_INFO_DOC);
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_HOSTROLE_ATTR, hostRole);
+ pRoot->setAttribute(XML_HOSTNAME_ATTR, hostName);
+ pRoot->setAttribute(XML_MSG_ATTR, msg);
+ if ( pInfo )
+ pRoot->addContent(pInfo);
+
+ _xml.getDocument()->setRootElement(pRoot);
+
+ Chain xmlString;
+ _xml.getXMLChain(xmlString);
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, xmlString);
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _pN->setMsg(xmlString, xmlString.length());
+
+ _pN->writeMsg();
+
+ _xml.getDocument()->clear();
+
+ return _pN->recvAck();
+}
+
+void CegoAdminHandler::sendError(const Chain& msg)
+{
+
+ _xml.getDocument()->clear();
+ _xml.getDocument()->setDocType(XML_ERROR_DOC);
+
+ Element* pRoot = new Element(XML_FRAME_ELEMENT);
+ pRoot->setAttribute(XML_MSG_ATTR, msg);
+
+ _xml.getDocument()->setRootElement(pRoot);
+
+ Chain xmlString;
+ _xml.getXMLChain(xmlString);
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- XML ---"));
+ _pModule->log(_modId, Logger::DEBUG, xmlString);
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
+
+ _pN->setMsg(xmlString, xmlString.length());
+
+ _pN->writeMsg();
+
+}
+
+void CegoAdminHandler::getThreadInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> threadInfoList = pRoot->getChildren(XML_THREADINFO_ELEMENT);
+
+ Element **pInfo = threadInfoList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("TYPE"),VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("TOTAL"), INT_TYPE, sizeof(int)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("ACTIVE"), INT_TYPE, sizeof(int)));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("THREADINFO"), schema, Chain("THREADINFO"));
+
+
+ Chain numDbThread = (*pInfo)->getAttributeValue(XML_NUMDBTHREAD_ATTR);
+ Chain numAdmThread = (*pInfo)->getAttributeValue(XML_NUMADMTHREAD_ATTR);
+ Chain numLogThread = (*pInfo)->getAttributeValue(XML_NUMLOGTHREAD_ATTR);
+ Chain actDbThread = (*pInfo)->getAttributeValue(XML_ACTIVEDBTHREAD_ATTR);
+ Chain actAdmThread = (*pInfo)->getAttributeValue(XML_ACTIVEADMTHREAD_ATTR);
+ Chain actLogThread = (*pInfo)->getAttributeValue(XML_ACTIVELOGTHREAD_ATTR);
+
+
+ CegoFieldValue f1a(VARCHAR_TYPE, Chain("DatabaseThread"));
+ CegoFieldValue f1b(INT_TYPE, numDbThread);
+ CegoFieldValue f1c(INT_TYPE, actDbThread);
+ ListT<CegoFieldValue> fl1;
+ fl1.Insert(f1a);
+ fl1.Insert(f1b);
+ fl1.Insert(f1c);
+
+ info.Insert(fl1);
+
+ CegoFieldValue f2a(VARCHAR_TYPE, Chain("AdminThread"));
+ CegoFieldValue f2b(INT_TYPE, numAdmThread);
+ CegoFieldValue f2c(INT_TYPE, actAdmThread);
+ ListT<CegoFieldValue> fl2;
+ fl2.Insert(f2a);
+ fl2.Insert(f2b);
+ fl2.Insert(f2c);
+
+ info.Insert(fl2);
+
+ CegoFieldValue f3a(VARCHAR_TYPE, Chain("LogThread"));
+ CegoFieldValue f3b(INT_TYPE, numLogThread);
+ CegoFieldValue f3c(INT_TYPE, actLogThread);
+ ListT<CegoFieldValue> fl3;
+ fl3.Insert(f3a);
+ fl3.Insert(f3b);
+ fl3.Insert(f3c);
+
+ info.Insert(fl3);
+
+ }
+}
+
+void CegoAdminHandler::getDbThreadInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, Chain& format)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> threadInfoList = pRoot->getChildren(XML_THREADINFO_ELEMENT);
+
+ Element **pInfo = threadInfoList.First();
+
+ ListT<Element*> threadStateList = (*pInfo)->getChildren(XML_THREAD_ELEMENT);
+ Element **pThreadState = threadStateList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("THREADID"), INT_TYPE, sizeof(int)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("NUMREQUEST"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("NUMQUERYREQ"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("THREADLOAD"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("STATUS"), VARCHAR_TYPE, 10));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("THREADINFO"), schema, Chain("THREADINFO"));
+
+ format = Chain("rrrrl");
+
+ while ( pThreadState )
+ {
+ Chain threadId = (*pThreadState)->getAttributeValue(XML_THID_ATTR);
+ Chain numRequest = (*pThreadState)->getAttributeValue(XML_NUMREQUEST_ATTR);
+ Chain numQueryRequest = (*pThreadState)->getAttributeValue(XML_NUMQUERYREQUEST_ATTR);
+ Chain threadLoad = (*pThreadState)->getAttributeValue(XML_THREADLOAD_ATTR);
+ Chain threadState = (*pThreadState)->getAttributeValue(XML_STATUS_ATTR);
+
+ CegoFieldValue f1(INT_TYPE, threadId);
+ CegoFieldValue f2(LONG_TYPE, numRequest);
+ CegoFieldValue f3(LONG_TYPE, numQueryRequest);
+ CegoFieldValue f4(LONG_TYPE, threadLoad);
+ CegoFieldValue f5(VARCHAR_TYPE, threadState);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+ fl.Insert(f5);
+
+ info.Insert(fl);
+
+ pThreadState = threadStateList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getDbThreadLastQuery(int threadId, CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, Chain& format)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> threadInfoList = pRoot->getChildren(XML_THREADINFO_ELEMENT);
+
+ Element **pInfo = threadInfoList.First();
+
+ ListT<Element*> threadList = (*pInfo)->getChildren(XML_THREAD_ELEMENT);
+ Element **pThread = threadList.First();
+
+ unsigned int maxActionLen = 10;
+
+ while ( pThread )
+ {
+ Chain threadAction = (*pThread)->getAttributeValue(XML_LASTACTION_ATTR);
+
+ if ( threadAction.length() > maxActionLen )
+ maxActionLen = threadAction.length();
+
+ pThread = threadList.Next();
+ }
+
+ pThread = threadList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("LASTACTION"), VARCHAR_TYPE, maxActionLen));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("THREADINFO"), schema, Chain("THREADINFO"));
+
+ format = Chain("l");
+
+ while ( pThread )
+ {
+ int actThreadId = (*pThread)->getAttributeValue(XML_THID_ATTR).asInteger();
+
+ if ( actThreadId == threadId )
+ {
+ Chain threadAction = (*pThread)->getAttributeValue(XML_LASTACTION_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, threadAction);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+
+ info.Insert(fl);
+ }
+ pThread = threadList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getAdmThreadInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, Chain& format)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> threadInfoList = pRoot->getChildren(XML_THREADINFO_ELEMENT);
+
+ Element **pInfo = threadInfoList.First();
+
+ ListT<Element*> threadStateList = (*pInfo)->getChildren(XML_THREAD_ELEMENT);
+ Element **pThreadState = threadStateList.First();
+
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("THREADID"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("NUMREQUEST"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("THREADLOAD"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("STATUS"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("LASTACTION"), VARCHAR_TYPE, 50));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("THREADINFO"), schema, Chain("THREADINFO"));
+
+ format = Chain("rlrrl");
+
+ while ( pThreadState )
+ {
+ Chain threadId = (*pThreadState)->getAttributeValue(XML_THID_ATTR);
+ Chain numRequest = (*pThreadState)->getAttributeValue(XML_NUMREQUEST_ATTR);
+ Chain threadLoad = (*pThreadState)->getAttributeValue(XML_THREADLOAD_ATTR);
+ Chain threadState = (*pThreadState)->getAttributeValue(XML_STATUS_ATTR);
+ Chain threadAction = (*pThreadState)->getAttributeValue(XML_LASTACTION_ATTR);
+
+ CegoFieldValue f1(LONG_TYPE, threadId);
+ CegoFieldValue f2(LONG_TYPE, numRequest);
+ CegoFieldValue f3(LONG_TYPE, threadLoad);
+ CegoFieldValue f4(VARCHAR_TYPE, threadState);
+ CegoFieldValue f5(VARCHAR_TYPE, threadAction);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+ fl.Insert(f5);
+
+ info.Insert(fl);
+
+ pThreadState = threadStateList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getLogThreadInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, Chain& format)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> threadInfoList = pRoot->getChildren(XML_THREADINFO_ELEMENT);
+
+ Element **pInfo = threadInfoList.First();
+
+ ListT<Element*> threadStateList = (*pInfo)->getChildren(XML_THREAD_ELEMENT);
+ Element **pThreadState = threadStateList.First();
+
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("THREADID"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("NUMREQUEST"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("THREADLOAD"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("STATUS"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("THREADINFO"), Chain("THREADINFO"), Chain("LASTACTION"), VARCHAR_TYPE, 50));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("THREADINFO"), schema, Chain("THREADINFO"));
+
+ format = Chain("rlrrl");
+
+ while ( pThreadState )
+ {
+ Chain threadId = (*pThreadState)->getAttributeValue(XML_THID_ATTR);
+ Chain numRequest = (*pThreadState)->getAttributeValue(XML_NUMREQUEST_ATTR);
+ Chain threadLoad = (*pThreadState)->getAttributeValue(XML_THREADLOAD_ATTR);
+ Chain threadState = (*pThreadState)->getAttributeValue(XML_STATUS_ATTR);
+ Chain threadAction = (*pThreadState)->getAttributeValue(XML_LASTACTION_ATTR);
+
+ CegoFieldValue f1(LONG_TYPE, threadId);
+ CegoFieldValue f2(LONG_TYPE, numRequest);
+ CegoFieldValue f3(LONG_TYPE, threadLoad);
+ CegoFieldValue f4(VARCHAR_TYPE, threadState);
+ CegoFieldValue f5(VARCHAR_TYPE, threadAction);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+ fl.Insert(f5);
+
+
+ info.Insert(fl);
+
+ pThreadState = threadStateList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getDbSessionInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> sessionInfoList = pRoot->getChildren(XML_DBSESSIONINFO_ELEMENT);
+
+ Element **pInfo = sessionInfoList.First();
+
+ ListT<Element*> sessionList = (*pInfo)->getChildren(XML_DBSESSION_ELEMENT);
+ Element **pSession = sessionList.First();
+
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("DBSESSION"), Chain("DBSESSION"), Chain("HOST"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("DBSESSION"), Chain("DBSESSION"), Chain("TABLESET"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("DBSESSION"), Chain("DBSESSION"), Chain("USER"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("DBSESSION"), Chain("DBSESSION"), Chain("ISUSED"), VARCHAR_TYPE, 5));
+ schema.Insert(CegoField(Chain("DBSESSION"), Chain("DBSESSION"), Chain("TTL"), VARCHAR_TYPE, 5));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("DBSESSIONINFO"), schema, Chain("DBSESSIONINFO"));
+
+ while ( pSession )
+ {
+ Chain hostName = (*pSession)->getAttributeValue(XML_HOSTNAME_ATTR);
+ Chain tableSet = (*pSession)->getAttributeValue(XML_TABLESET_ATTR);
+ Chain userName = (*pSession)->getAttributeValue(XML_USER_ATTR);
+ Chain isUsed = (*pSession)->getAttributeValue(XML_ISUSED_ATTR);
+ Chain ttl = (*pSession)->getAttributeValue(XML_TTL_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, hostName);
+ CegoFieldValue f2(VARCHAR_TYPE, tableSet);
+ CegoFieldValue f3(VARCHAR_TYPE, userName);
+ CegoFieldValue f4(VARCHAR_TYPE, isUsed);
+ CegoFieldValue f5(VARCHAR_TYPE, ttl);
+
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+ fl.Insert(f5);
+
+ info.Insert(fl);
+
+ pSession = sessionList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getCopyInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, Chain& format)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> copyInfoList = pRoot->getChildren(XML_COPYINFO_ELEMENT);
+
+ Element **pInfo = copyInfoList.First();
+
+ ListT<Element*> copyList = (*pInfo)->getChildren(XML_COPY_ELEMENT);
+ Element **pCopy = copyList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("COPY"), Chain("COPY"), Chain("ID"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("COPY"), Chain("COPY"), Chain("TABLESET"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("COPY"), Chain("COPY"), Chain("TARGET"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("COPY"), Chain("COPY"), Chain("STATUS"), VARCHAR_TYPE, 50));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("COPYINFO"), schema, Chain("COPYINFO"));
+
+ format = Chain("rlll");
+
+ while ( pCopy )
+ {
+ Chain cid = (*pCopy)->getAttributeValue(XML_CID_ATTR);
+ Chain tableSet = (*pCopy)->getAttributeValue(XML_TABLESET_ATTR);
+ Chain targetHost = (*pCopy)->getAttributeValue(XML_HOSTNAME_ATTR);
+ Chain status = (*pCopy)->getAttributeValue(XML_STATUS_ATTR);
+
+
+ CegoFieldValue f1(VARCHAR_TYPE, cid);
+ CegoFieldValue f2(VARCHAR_TYPE, tableSet);
+ CegoFieldValue f3(VARCHAR_TYPE, targetHost);
+ CegoFieldValue f4(VARCHAR_TYPE, status);
+
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+
+ info.Insert(fl);
+
+ pCopy = copyList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getLockInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("LOCKINFO"), Chain("LOCKINFO"), Chain("LOCKID"),VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("LOCKINFO"), Chain("LOCKINFO"), Chain("LOCKCOUNT"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKINFO"), Chain("LOCKINFO"), Chain("RD HITS"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKINFO"), Chain("LOCKINFO"), Chain("RD DELAY"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKINFO"), Chain("LOCKINFO"), Chain("WR HITS"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKINFO"), Chain("LOCKINFO"), Chain("WR DELAY"), LONG_TYPE, sizeof(long)));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("LOCKINFO"), schema, Chain("LOCKINFO"));
+
+
+ ListT<Element*> lockInfoList = pRoot->getChildren(XML_LOCKINFO_ELEMENT);
+ Element **pInfo = lockInfoList.First();
+
+ ListT<Element*> lockEntryList = (*pInfo)->getChildren(XML_LOCKENTRY_ELEMENT);
+ Element **pLockEntry = lockEntryList.First();
+
+ while ( pLockEntry )
+ {
+
+ CegoFieldValue f1a(VARCHAR_TYPE, (*pLockEntry)->getAttributeValue(XML_LOCKID_ATTR));
+ CegoFieldValue f1b(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_LOCKCOUNT_ATTR));
+ CegoFieldValue f1c(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_RDLOCKHIT_ATTR));
+ CegoFieldValue f1d(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_RDLOCKDELAY_ATTR));
+ CegoFieldValue f1e(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_WRLOCKHIT_ATTR));
+ CegoFieldValue f1f(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_WRLOCKDELAY_ATTR));
+ ListT<CegoFieldValue> fl;
+ fl.Insert(f1a);
+ fl.Insert(f1b);
+ fl.Insert(f1c);
+ fl.Insert(f1d);
+ fl.Insert(f1e);
+ fl.Insert(f1f);
+
+ info.Insert(fl);
+
+ pLockEntry = lockEntryList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getLockStat(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("LOCKID"),VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("NUMLOCK"), INT_TYPE, sizeof(int)));
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("LOCKCOUNT"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("RD HITS"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("RD DELAY"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("WR HITS"), LONG_TYPE, sizeof(long)));
+ schema.Insert(CegoField(Chain("LOCKSTAT"), Chain("LOCKSTAT"), Chain("WR DELAY"), LONG_TYPE, sizeof(long)));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("LOCKSTAT"), schema, Chain("LOCKSTAT"));
+
+ ListT<Element*> lockInfoList = pRoot->getChildren(XML_LOCKSTAT_ELEMENT);
+ Element **pInfo = lockInfoList.First();
+
+ ListT<Element*> lockEntryList = (*pInfo)->getChildren(XML_LOCKENTRY_ELEMENT);
+ Element **pLockEntry = lockEntryList.First();
+
+ while ( pLockEntry )
+ {
+
+ CegoFieldValue f1a(VARCHAR_TYPE, (*pLockEntry)->getAttributeValue(XML_LOCKID_ATTR));
+ CegoFieldValue f1b(INT_TYPE, (*pLockEntry)->getAttributeValue(XML_NUMLOCK_ATTR));
+ CegoFieldValue f1c(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_LOCKCOUNT_ATTR));
+ CegoFieldValue f1d(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_RDLOCKHIT_ATTR));
+ CegoFieldValue f1e(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_RDLOCKDELAY_ATTR));
+ CegoFieldValue f1f(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_WRLOCKHIT_ATTR));
+ CegoFieldValue f1g(LONG_TYPE, (*pLockEntry)->getAttributeValue(XML_WRLOCKDELAY_ATTR));
+ ListT<CegoFieldValue> fl;
+ fl.Insert(f1a);
+ fl.Insert(f1b);
+ fl.Insert(f1c);
+ fl.Insert(f1d);
+ fl.Insert(f1e);
+ fl.Insert(f1f);
+ fl.Insert(f1g);
+
+
+ info.Insert(fl);
+
+ pLockEntry = lockEntryList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getPoolInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info1,
+ ListT<ListT< CegoFieldValue > > & info2)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> poolInfoList = pRoot->getChildren(XML_POOLINFO_ELEMENT);
+
+ Element **pInfo = poolInfoList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("PARAMETER"),VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("POOLINFO"), Chain("POOLINFO"), Chain("VALUE"), VARCHAR_TYPE, 20));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("POOLINFO"), schema, Chain("POOLINFO"));
+
+ Chain pageSize = (*pInfo)->getAttributeValue(XML_PAGESIZE_ATTR);
+ Chain numTotal = (*pInfo)->getAttributeValue(XML_NUMTOTAL_ATTR);
+ Chain numUsed = (*pInfo)->getAttributeValue(XML_NUMUSED_ATTR);
+ Chain numFree = (*pInfo)->getAttributeValue(XML_NUMFREE_ATTR);
+ Chain numDirty = (*pInfo)->getAttributeValue(XML_NUMDIRTY_ATTR);
+ Chain numFixed = (*pInfo)->getAttributeValue(XML_NUMFIXES_ATTR);
+
+ Chain numPersistent = (*pInfo)->getAttributeValue(XML_NUMPERSISTENT_ATTR);
+ Chain numNoSync = (*pInfo)->getAttributeValue(XML_NUMNOSYNC_ATTR);
+ Chain numDiskRead = (*pInfo)->getAttributeValue(XML_NUMDISKREAD_ATTR);
+ Chain numDiskWrite = (*pInfo)->getAttributeValue(XML_NUMDISKWRITE_ATTR);
+
+ long readDelay = (*pInfo)->getAttributeValue(XML_READDELAY_ATTR).asLong();
+ long writeDelay = (*pInfo)->getAttributeValue(XML_WRITEDELAY_ATTR).asLong();
+
+ Chain curFixCount = (*pInfo)->getAttributeValue(XML_CURFIXCOUNT_ATTR);
+ Chain maxFixCount = (*pInfo)->getAttributeValue(XML_MAXFIXCOUNT_ATTR);
+
+ Chain statStart = (*pInfo)->getAttributeValue(XML_STATSTART_ATTR);
+
+ CegoFieldValue f1a(VARCHAR_TYPE, Chain("Page Size"));
+ CegoFieldValue f1b(VARCHAR_TYPE, pageSize);
+ ListT<CegoFieldValue> fl1;
+ fl1.Insert(f1a);
+ fl1.Insert(f1b);
+ info1.Insert(fl1);
+
+ CegoFieldValue f2a(VARCHAR_TYPE, Chain("Total Pages"));
+ CegoFieldValue f2b(VARCHAR_TYPE, numTotal);
+ ListT<CegoFieldValue> fl2;
+ fl2.Insert(f2a);
+ fl2.Insert(f2b);
+ info1.Insert(fl2);
+
+ CegoFieldValue f3a(VARCHAR_TYPE, Chain("Used Pages"));
+ CegoFieldValue f3b(VARCHAR_TYPE, numUsed);
+ ListT<CegoFieldValue> fl3;
+ fl3.Insert(f3a);
+ fl3.Insert(f3b);
+ info1.Insert(fl3);
+
+ CegoFieldValue f4a(VARCHAR_TYPE, Chain("Free Pages"));
+ CegoFieldValue f4b(VARCHAR_TYPE, numFree);
+ ListT<CegoFieldValue> fl4;
+ fl4.Insert(f4a);
+ fl4.Insert(f4b);
+ info1.Insert(fl4);
+
+ CegoFieldValue f5a(VARCHAR_TYPE, Chain("Dirty Pages"));
+ CegoFieldValue f5b(VARCHAR_TYPE, numDirty);
+ ListT<CegoFieldValue> fl5;
+ fl5.Insert(f5a);
+ fl5.Insert(f5b);
+ info1.Insert(fl5);
+
+ CegoFieldValue f6a(VARCHAR_TYPE, Chain("Fixed Pages"));
+ CegoFieldValue f6b(VARCHAR_TYPE, numFixed);
+ ListT<CegoFieldValue> fl6;
+ fl6.Insert(f6a);
+ fl6.Insert(f6b);
+ info1.Insert(fl6);
+
+ CegoFieldValue f7a(VARCHAR_TYPE, Chain("Persistent Pages"));
+ CegoFieldValue f7b(VARCHAR_TYPE, numPersistent);
+ ListT<CegoFieldValue> fl7;
+ fl7.Insert(f7a);
+ fl7.Insert(f7b);
+ info1.Insert(fl7);
+
+ CegoFieldValue f8a(VARCHAR_TYPE, Chain("No Sync Pages"));
+ CegoFieldValue f8b(INT_TYPE, numNoSync);
+ ListT<CegoFieldValue> fl8;
+ fl8.Insert(f8a);
+ fl8.Insert(f8b);
+ info1.Insert(fl8);
+
+ Datetime dt(statStart, BUPMNG_STATDTFORMAT);
+ CegoFieldValue f10a(VARCHAR_TYPE, Chain("Stat Start"));
+ CegoFieldValue f10b(VARCHAR_TYPE, dt.asChain(BUPMNG_STATOUTFORMAT));
+ ListT<CegoFieldValue> fl10;
+ fl10.Insert(f10a);
+ fl10.Insert(f10b);
+ info2.Insert(fl10);
+
+ CegoFieldValue f11a(VARCHAR_TYPE, Chain("Cur Fix Count"));
+ CegoFieldValue f11b(VARCHAR_TYPE, curFixCount);
+ ListT<CegoFieldValue> fl11;
+ fl11.Insert(f11a);
+ fl11.Insert(f11b);
+ info2.Insert(fl11);
+
+ CegoFieldValue f12a(VARCHAR_TYPE, Chain("Max Fix Count"));
+ CegoFieldValue f12b(VARCHAR_TYPE, maxFixCount);
+ ListT<CegoFieldValue> fl12;
+ fl12.Insert(f12a);
+ fl12.Insert(f12b);
+ info2.Insert(fl12);
+
+ CegoFieldValue f13a(VARCHAR_TYPE, Chain("Disk Reads"));
+ CegoFieldValue f13b(VARCHAR_TYPE, Chain(numDiskRead));
+ ListT<CegoFieldValue> fl13;
+ fl13.Insert(f13a);
+ fl13.Insert(f13b);
+ info2.Insert(fl13);
+
+ CegoFieldValue f14a(VARCHAR_TYPE, Chain("Disk Writes"));
+ CegoFieldValue f14b(VARCHAR_TYPE, Chain(numDiskWrite));
+ ListT<CegoFieldValue> fl14;
+ fl14.Insert(f14a);
+ fl14.Insert(f14b);
+ info2.Insert(fl14);
+
+ int msecDelay;
+ int usecDelay;
+ Chain delayStr;
+ Chain fillStr;
+
+ msecDelay = readDelay / 1000;
+ usecDelay = readDelay % 1000;
+ fillStr = Chain("000") + Chain(usecDelay);
+ delayStr = Chain(msecDelay) + Chain(".") + fillStr.subChain(fillStr.length()-3, fillStr.length()) + Chain (" msec");
+
+ CegoFieldValue f15a(VARCHAR_TYPE, Chain("Read Delay"));
+ CegoFieldValue f15b(VARCHAR_TYPE, Chain(delayStr));
+ ListT<CegoFieldValue> fl15;
+ fl15.Insert(f15a);
+ fl15.Insert(f15b);
+ info2.Insert(fl15);
+
+ msecDelay = writeDelay / 1000;
+ usecDelay = writeDelay % 1000;
+ fillStr = Chain("000") + Chain(usecDelay);
+ delayStr = Chain(msecDelay) + Chain(".") + fillStr.subChain(fillStr.length()-3, fillStr.length()) + Chain (" msec");
+
+ CegoFieldValue f16a(VARCHAR_TYPE, Chain("Write Delay"));
+ CegoFieldValue f16b(VARCHAR_TYPE, Chain(delayStr));
+ ListT<CegoFieldValue> fl16;
+ fl16.Insert(f16a);
+ fl16.Insert(f16b);
+ info2.Insert(fl16);
+
+ }
+}
+
+void CegoAdminHandler::getPoolEntryList(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("POS"),VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("OCCSTATE"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("ISDIRTY"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("NUMFIXES"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("TABSETID"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("FILEID"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("PAGEID"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("PEL"), Chain("PEL"), Chain("FIXSTAT"), VARCHAR_TYPE, 15));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("PEL"), schema, Chain("PEL"));
+
+ ListT<Element*> pList = pRoot->getChildren(XML_POOLENTRYLIST_ELEMENT);
+ Element **pPL = pList.First();
+
+ ListT<Element*> peList = (*pPL)->getChildren(XML_POOLENTRY_ELEMENT);
+ Element** pPE = peList.First();
+
+ while ( pPE )
+ {
+
+ CegoFieldValue f1a(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_POS_ATTR));
+ CegoFieldValue f1b(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_OCCSTATE_ATTR));
+ CegoFieldValue f1c(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_ISDIRTY_ATTR));
+ CegoFieldValue f1d(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_NUMFIXES_ATTR));
+ CegoFieldValue f1e(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_TSID_ATTR));
+ CegoFieldValue f1f(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_FILEID_ATTR));
+ CegoFieldValue f1g(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_PAGEID_ATTR));
+ CegoFieldValue f1h(VARCHAR_TYPE, (*pPE)->getAttributeValue(XML_FIXSTAT_ATTR));
+
+ ListT<CegoFieldValue> fl;
+ fl.Insert(f1a);
+ fl.Insert(f1b);
+ fl.Insert(f1c);
+ fl.Insert(f1d);
+ fl.Insert(f1e);
+ fl.Insert(f1f);
+ fl.Insert(f1g);
+ fl.Insert(f1h);
+
+ info.Insert(fl);
+
+ pPE = peList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getTableSetList(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, bool getUsage)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tList = pRoot->getChildren(XML_TABLESETLIST_ELEMENT);
+ Element **pTL = tList.First();
+
+
+ ListT<Element*> tsList = (*pTL)->getChildren(XML_TABLESET_ELEMENT);
+ Element** pTS = tsList.First();
+
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("TSL"), Chain("TSL"), Chain("NAME"),VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("TSL"), Chain("TSL"), Chain("RUNSTATE"), VARCHAR_TYPE, 8));
+ schema.Insert(CegoField(Chain("TSL"), Chain("TSL"), Chain("SYNCSTATE"), VARCHAR_TYPE, 12));
+ if ( getUsage )
+ {
+ schema.Insert(CegoField(Chain("TSL"), Chain("TSL"), Chain("SYSUSAGE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("TSL"), Chain("TSL"), Chain("TEMPUSAGE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("TSL"), Chain("TSL"), Chain("APPUSAGE"), VARCHAR_TYPE, 10));
+ }
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("TSL"), schema, Chain("TSL"));
+
+ while ( pTS )
+ {
+
+ Chain tsName = (*pTS)->getAttributeValue(XML_NAME_ATTR);
+ Chain tsRunState = (*pTS)->getAttributeValue(XML_RUNSTATE_ATTR);
+ Chain tsSyncState = (*pTS)->getAttributeValue(XML_SYNCSTATE_ATTR);
+
+ CegoFieldValue f1a(VARCHAR_TYPE, tsName);
+ CegoFieldValue f1b(VARCHAR_TYPE, tsRunState);
+ CegoFieldValue f1c(VARCHAR_TYPE, tsSyncState);
+
+ ListT<CegoFieldValue> fl1;
+ fl1.Insert(f1a);
+ fl1.Insert(f1b);
+ fl1.Insert(f1c);
+
+
+ if ( getUsage )
+ {
+
+ Chain tsSysUsage = (*pTS)->getAttributeValue(XML_SYSUSAGE_ATTR);
+ Chain tsTempUsage = (*pTS)->getAttributeValue(XML_TEMPUSAGE_ATTR);
+ Chain tsAppUsage = (*pTS)->getAttributeValue(XML_APPUSAGE_ATTR);
+
+ CegoFieldValue f1d(VARCHAR_TYPE, tsSysUsage);
+ CegoFieldValue f1e(VARCHAR_TYPE, tsTempUsage);
+ CegoFieldValue f1f(VARCHAR_TYPE, tsAppUsage);
+
+ fl1.Insert(f1d);
+ fl1.Insert(f1e);
+ fl1.Insert(f1f);
+ }
+
+
+ info.Insert(fl1);
+
+ pTS = tsList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getTableSetCheck(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tList = pRoot->getChildren(XML_TABLESETCHECK_ELEMENT);
+ Element **pTL = tList.First();
+
+
+ ListT<Element*> tsList = (*pTL)->getChildren(XML_ATTRCHECK_ELEMENT);
+ Element** pTS = tsList.First();
+
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("CHK"), Chain("CHK"), Chain("ATTRIBUTE"),VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("CHK"), Chain("CHK"), Chain(XML_MEDIATOR_ATTR), VARCHAR_TYPE, 12));
+ schema.Insert(CegoField(Chain("CHK"), Chain("CHK"), Chain(XML_PRIMARY_ATTR), VARCHAR_TYPE, 12));
+ schema.Insert(CegoField(Chain("CHK"), Chain("CHK"), Chain(XML_SECONDARY_ATTR), VARCHAR_TYPE, 12));
+
+ CegoFieldValue f1c(VARCHAR_TYPE, (*pTL)->getAttributeValue(XML_SECONDARY_ATTR));
+
+
+ ListT<CegoFieldValue> fl1;
+ fl1.Insert( CegoFieldValue(VARCHAR_TYPE, Chain("NAME")));
+ fl1.Insert( CegoFieldValue(VARCHAR_TYPE, (*pTL)->getAttributeValue(XML_MEDIATOR_ATTR)));
+ fl1.Insert( CegoFieldValue(VARCHAR_TYPE, (*pTL)->getAttributeValue(XML_PRIMARY_ATTR)));
+ fl1.Insert( CegoFieldValue(VARCHAR_TYPE, (*pTL)->getAttributeValue(XML_SECONDARY_ATTR)));
+
+ info.Insert(fl1);
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("CHK"), schema, Chain("CHK"));
+
+ while ( pTS )
+ {
+
+ Chain attr = (*pTS)->getAttributeValue(XML_CHECKATTR_ATTR);
+ Chain mVal = (*pTS)->getAttributeValue(XML_MVAL_ATTR);
+ Chain pVal = (*pTS)->getAttributeValue(XML_PVAL_ATTR);
+ Chain sVal = (*pTS)->getAttributeValue(XML_SVAL_ATTR);
+
+ CegoFieldValue f1a(VARCHAR_TYPE, attr);
+ CegoFieldValue f1b(VARCHAR_TYPE, mVal);
+ CegoFieldValue f1c(VARCHAR_TYPE, pVal);
+ CegoFieldValue f1d(VARCHAR_TYPE, sVal);
+
+ ListT<CegoFieldValue> fl1;
+ fl1.Insert(f1a);
+ fl1.Insert(f1b);
+ fl1.Insert(f1c);
+ fl1.Insert(f1d);
+
+ info.Insert(fl1);
+
+ pTS = tsList.Next();
+ }
+ }
+}
+
+Element* CegoAdminHandler::getTableSetCheckInfo()
+{
+
+ Element *pCheck = 0;
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tsInfoList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+
+ Element **pInfo = tsInfoList.First();
+
+ pCheck = new Element(XML_TABLESET_ELEMENT);
+
+ pCheck->setAttribute(XML_RUNSTATE_ATTR, (*pInfo)->getAttributeValue(XML_RUNSTATE_ATTR));
+ pCheck->setAttribute(XML_SYNCSTATE_ATTR, (*pInfo)->getAttributeValue(XML_SYNCSTATE_ATTR));
+ pCheck->setAttribute(XML_PRIMARY_ATTR, (*pInfo)->getAttributeValue(XML_PRIMARY_ATTR));
+ pCheck->setAttribute(XML_SECONDARY_ATTR, (*pInfo)->getAttributeValue(XML_SECONDARY_ATTR));
+ pCheck->setAttribute(XML_MEDIATOR_ATTR, (*pInfo)->getAttributeValue(XML_MEDIATOR_ATTR));
+
+ }
+
+ return pCheck;
+
+}
+
+void CegoAdminHandler::getDetailedTableSetInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tsInfoList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+
+ Element **pInfo = tsInfoList.First();
+
+ int maxLen=20;
+
+ Chain tsRunState = (*pInfo)->getAttributeValue(XML_RUNSTATE_ATTR);
+ Chain tsSyncState = (*pInfo)->getAttributeValue(XML_SYNCSTATE_ATTR);
+
+ Chain tsPrimary = (*pInfo)->getAttributeValue(XML_PRIMARY_ATTR);
+ if ( tsPrimary.length() > maxLen )
+ maxLen=tsPrimary.length();
+
+ Chain tsSecondary = (*pInfo)->getAttributeValue(XML_SECONDARY_ATTR);
+ if ( tsSecondary.length() > maxLen )
+ maxLen=tsSecondary.length();
+
+ Chain tsMediator = (*pInfo)->getAttributeValue(XML_MEDIATOR_ATTR);
+ if ( tsMediator.length() > maxLen )
+ maxLen=tsMediator.length();
+
+ Chain tsRoot = (*pInfo)->getAttributeValue(XML_TSROOT_ATTR);
+ if ( tsRoot.length() > maxLen )
+ maxLen=tsRoot.length();
+
+ Chain tsTicket = (*pInfo)->getAttributeValue(XML_TSTICKET_ATTR);
+ if ( tsTicket.length() > maxLen )
+ maxLen=tsTicket.length();
+
+ Chain tsInitFile = (*pInfo)->getAttributeValue(XML_TSINITFILE_ATTR);
+ if ( tsInitFile.length() > maxLen )
+ maxLen=tsInitFile.length();
+
+ Chain tsSysFile = (*pInfo)->getAttributeValue(XML_SYSFILE_ATTR);
+ if ( tsSysFile.length() > maxLen )
+ maxLen=tsSysFile.length();
+
+ Chain tsTempFile = (*pInfo)->getAttributeValue(XML_TEMPFILE_ATTR);
+ if ( tsTempFile.length() > maxLen )
+ maxLen=tsTempFile.length();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("TABLESETINFO"), Chain("TABLESETINFO"), Chain("PARAMETER"),VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("TABLESETINFO"), Chain("TABLESETINFO"), Chain("VALUE"), VARCHAR_TYPE, maxLen));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("TABLESETINFO"), schema, Chain("TABLESETINFO"));
+
+ Chain tableSet = (*pInfo)->getAttributeValue(XML_NAME_ATTR);
+
+ Chain checkpoint = (*pInfo)->getAttributeValue(XML_CHECKPOINT_ATTR);
+
+ Chain tsSysTotal = (*pInfo)->getAttributeValue(XML_SYSTOTAL_ATTR);
+ Chain tsSysUsed = (*pInfo)->getAttributeValue(XML_SYSUSED_ATTR);
+
+ Chain tsTempTotal = (*pInfo)->getAttributeValue(XML_TEMPTOTAL_ATTR);
+ Chain tsTempUsed = (*pInfo)->getAttributeValue(XML_TEMPUSED_ATTR);
+
+ long tsSysSumTotal = tsSysTotal.asLong();
+ long tsSysSumUsed = tsSysUsed.asLong();
+
+ long tsTmpSumTotal = tsTempTotal.asLong();
+ long tsTmpSumUsed = tsTempUsed.asLong();
+
+ long tsAppSumTotal = 0;
+ long tsAppSumUsed = 0;
+
+ ListT<Element*> dataFileList = (*pInfo)->getChildren(XML_DATAFILE_ELEMENT);
+ Element **pDF = dataFileList.First();
+
+ while ( pDF )
+ {
+ Chain fileType = (*pDF)->getAttributeValue(XML_TYPE_ATTR);
+
+ if ( fileType == Chain(XML_SYSFILE_VALUE) )
+ {
+ Chain sfNumTotal = (*pDF)->getAttributeValue(XML_NUMTOTAL_ATTR);
+ Chain sfNumUsed = (*pDF)->getAttributeValue(XML_NUMUSED_ATTR);
+
+ tsSysSumTotal += sfNumTotal.asLong();
+ tsSysSumUsed += sfNumUsed.asLong();
+
+ }
+ else if ( fileType == Chain(XML_TEMPFILE_VALUE) )
+ {
+
+ Chain tfNumTotal = (*pDF)->getAttributeValue(XML_NUMTOTAL_ATTR);
+ Chain tfNumUsed = (*pDF)->getAttributeValue(XML_NUMUSED_ATTR);
+
+ tsTmpSumTotal += tfNumTotal.asLong();
+ tsTmpSumUsed += tfNumUsed.asLong();
+
+ }
+ else if ( fileType == Chain(XML_APPFILE_VALUE) )
+ {
+
+ Chain afNumTotal = (*pDF)->getAttributeValue(XML_NUMTOTAL_ATTR);
+ Chain afNumUsed = (*pDF)->getAttributeValue(XML_NUMUSED_ATTR);
+
+ tsAppSumTotal += afNumTotal.asLong();
+ tsAppSumUsed += afNumUsed.asLong();
+
+ }
+ pDF = dataFileList.Next();
+ }
+
+ Chain sortAreaSize = (*pInfo)->getAttributeValue(XML_SORTAREASIZE_ATTR);
+ Chain clsn = (*pInfo)->getAttributeValue(XML_LSN_ATTR);
+ Chain tid = (*pInfo)->getAttributeValue(XML_TID_ATTR);
+ Chain nextlsn = (*pInfo)->getAttributeValue(XML_NEXTLSN_ATTR);
+
+ Chain archMode = (*pInfo)->getAttributeValue(XML_ARCHMODE_ATTR);
+
+ CegoFieldValue f0a(VARCHAR_TYPE, Chain(INFO_TABLESET));
+ CegoFieldValue f0b(VARCHAR_TYPE, tableSet);
+ ListT<CegoFieldValue> fl0;
+ fl0.Insert(f0a);
+ fl0.Insert(f0b);
+ info.Insert(fl0);
+
+ CegoFieldValue f1a(VARCHAR_TYPE, Chain(INFO_RUNSTATE));
+ CegoFieldValue f1b(VARCHAR_TYPE, tsRunState);
+ ListT<CegoFieldValue> fl1a;
+ fl1a.Insert(f1a);
+ fl1a.Insert(f1b);
+ info.Insert(fl1a);
+
+ CegoFieldValue f1c(VARCHAR_TYPE, Chain(INFO_SYNCSTATE));
+ CegoFieldValue f1d(VARCHAR_TYPE, tsSyncState);
+ ListT<CegoFieldValue> fl1b;
+ fl1b.Insert(f1c);
+ fl1b.Insert(f1d);
+ info.Insert(fl1b);
+
+ CegoFieldValue f2a(VARCHAR_TYPE, Chain(INFO_PRIMARY));
+ CegoFieldValue f2b(VARCHAR_TYPE, tsPrimary);
+ ListT<CegoFieldValue> fl2;
+ fl2.Insert(f2a);
+ fl2.Insert(f2b);
+ info.Insert(fl2);
+
+ CegoFieldValue f3a(VARCHAR_TYPE, Chain(INFO_SECONDARY));
+ CegoFieldValue f3b(VARCHAR_TYPE, tsSecondary);
+ ListT<CegoFieldValue> fl3;
+ fl3.Insert(f3a);
+ fl3.Insert(f3b);
+ info.Insert(fl3);
+
+ CegoFieldValue f4a(VARCHAR_TYPE, Chain(INFO_MEDIATOR));
+ CegoFieldValue f4b(VARCHAR_TYPE, tsMediator);
+ ListT<CegoFieldValue> fl4;
+ fl4.Insert(f4a);
+ fl4.Insert(f4b);
+ info.Insert(fl4);
+
+ CegoFieldValue f41a(VARCHAR_TYPE, Chain(INFO_ROOTPATH));
+ CegoFieldValue f41b(VARCHAR_TYPE, tsRoot);
+ ListT<CegoFieldValue> fl41;
+ fl41.Insert(f41a);
+ fl41.Insert(f41b);
+ info.Insert(fl41);
+
+ CegoFieldValue f42a(VARCHAR_TYPE, Chain(INFO_TICKET));
+ CegoFieldValue f42b(VARCHAR_TYPE, tsTicket);
+ ListT<CegoFieldValue> fl42;
+ fl42.Insert(f42a);
+ fl42.Insert(f42b);
+ info.Insert(fl42);
+
+ CegoFieldValue f43a(VARCHAR_TYPE, Chain(INFO_TSINITFILE));
+ CegoFieldValue f43b(VARCHAR_TYPE, tsInitFile);
+ ListT<CegoFieldValue> fl43;
+ fl43.Insert(f43a);
+ fl43.Insert(f43b);
+ info.Insert(fl43);
+
+ CegoFieldValue f44a(VARCHAR_TYPE, Chain(INFO_CHECKPOINT));
+ CegoFieldValue f44b(VARCHAR_TYPE, checkpoint);
+ ListT<CegoFieldValue> fl44;
+ fl44.Insert(f44a);
+ fl44.Insert(f44b);
+ info.Insert(fl44);
+
+ CegoFieldValue f6a(VARCHAR_TYPE, Chain(INFO_SYSTEMPAGETOTAL));
+ CegoFieldValue f6b(VARCHAR_TYPE, Chain(tsSysSumTotal));
+ ListT<CegoFieldValue> fl6;
+ fl6.Insert(f6a);
+ fl6.Insert(f6b);
+ info.Insert(fl6);
+
+ CegoFieldValue f7a(VARCHAR_TYPE, Chain(INFO_SYSTEMPAGEUSED));
+ CegoFieldValue f7b(VARCHAR_TYPE, Chain(tsSysSumUsed));
+ ListT<CegoFieldValue> fl7;
+ fl7.Insert(f7a);
+ fl7.Insert(f7b);
+ info.Insert(fl7);
+
+ // id 8 not used
+
+ CegoFieldValue f9a(VARCHAR_TYPE, Chain(INFO_TEMPPAGETOTAL));
+ CegoFieldValue f9b(VARCHAR_TYPE, Chain(tsTmpSumTotal));
+ ListT<CegoFieldValue> fl9;
+ fl9.Insert(f9a);
+ fl9.Insert(f9b);
+ info.Insert(fl9);
+
+ CegoFieldValue f10a(VARCHAR_TYPE, Chain(INFO_TEMPPAGEUSED));
+ CegoFieldValue f10b(VARCHAR_TYPE, Chain(tsTmpSumUsed));
+ ListT<CegoFieldValue> fl10;
+ fl10.Insert(f10a);
+ fl10.Insert(f10b);
+ info.Insert(fl10);
+
+ CegoFieldValue f11a(VARCHAR_TYPE, Chain(INFO_APPPAGETOTAL));
+ CegoFieldValue f11b(VARCHAR_TYPE, Chain(tsAppSumTotal));
+ ListT<CegoFieldValue> fl11;
+ fl11.Insert(f11a);
+ fl11.Insert(f11b);
+ info.Insert(fl11);
+
+ CegoFieldValue f12a(VARCHAR_TYPE, Chain(INFO_APPPAGEUSED));
+ CegoFieldValue f12b(VARCHAR_TYPE, Chain(tsAppSumUsed));
+ ListT<CegoFieldValue> fl12;
+ fl12.Insert(f12a);
+ fl12.Insert(f12b);
+ info.Insert(fl12);
+
+ CegoFieldValue f20a(VARCHAR_TYPE, Chain(INFO_SORTAREASIZE));
+ CegoFieldValue f20b(VARCHAR_TYPE, sortAreaSize);
+ ListT<CegoFieldValue> fl20;
+ fl20.Insert(f20a);
+ fl20.Insert(f20b);
+ info.Insert(fl20);
+
+ CegoFieldValue f14a(VARCHAR_TYPE, Chain(INFO_TID));
+ CegoFieldValue f14b(VARCHAR_TYPE, tid);
+ ListT<CegoFieldValue> fl14;
+ fl14.Insert(f14a);
+ fl14.Insert(f14b);
+ info.Insert(fl14);
+
+ CegoFieldValue f15a(VARCHAR_TYPE, Chain(INFO_CLSN));
+ CegoFieldValue f15b(VARCHAR_TYPE, clsn);
+ ListT<CegoFieldValue> fl15;
+ fl15.Insert(f15a);
+ fl15.Insert(f15b);
+ info.Insert(fl15);
+
+ CegoFieldValue f16a(VARCHAR_TYPE, Chain(INFO_NLSN));
+ CegoFieldValue f16b(VARCHAR_TYPE, nextlsn);
+ ListT<CegoFieldValue> fl16;
+ fl16.Insert(f16a);
+ fl16.Insert(f16b);
+ info.Insert(fl16);
+
+ CegoFieldValue f17a(VARCHAR_TYPE, Chain(INFO_ARCHMODE));
+ CegoFieldValue f17b(VARCHAR_TYPE, archMode);
+ ListT<CegoFieldValue> fl17;
+ fl17.Insert(f17a);
+ fl17.Insert(f17b);
+ info.Insert(fl17);
+
+
+ ListT<Element*> logFileList = (*pInfo)->getChildren(XML_LOGFILE_ELEMENT);
+ Element **pLF = logFileList.First();
+
+ if ( pLF )
+ {
+ Chain logSize = (*pLF)->getAttributeValue(XML_SIZE_ATTR);
+ CegoFieldValue fa(VARCHAR_TYPE, Chain(INFO_LOGSIZE));
+ CegoFieldValue fb(VARCHAR_TYPE, logSize);
+ ListT<CegoFieldValue> fl;
+ fl.Insert(fa);
+ fl.Insert(fb);
+ info.Insert(fl);
+
+ }
+ while ( pLF )
+ {
+
+ Chain logName = (*pLF)->getAttributeValue(XML_NAME_ATTR);
+
+ CegoFieldValue fa(VARCHAR_TYPE, Chain(INFO_LOGFILE));
+ CegoFieldValue fb(VARCHAR_TYPE, logName);
+ ListT<CegoFieldValue> fl;
+ fl.Insert(fa);
+ fl.Insert(fb);
+ info.Insert(fl);
+
+ pLF = logFileList.Next();
+ }
+ }
+}
+
+Element* CegoAdminHandler::getTSInfo()
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+ Element **pTL = tList.First();
+ if ( pTL )
+ return *pTL;
+ }
+
+ return 0;
+}
+
+Element* CegoAdminHandler::getObjectInfo()
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tlist = pRoot->getChildren(XML_OBJLIST_ELEMENT);
+ Element **pTL = tlist.First();
+ if ( pTL )
+ return *pTL;
+ }
+
+ return 0;
+}
+
+Element* CegoAdminHandler::getTAInfo()
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tlist = pRoot->getChildren(XML_TAINFO_ELEMENT);
+ Element **pTL = tlist.First();
+ if ( pTL )
+ return *pTL;
+ }
+
+ return 0;
+}
+
+void CegoAdminHandler::getBuFileInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tsInfoList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+ Element **pInfo = tsInfoList.First();
+
+ Chain tsTicket = (*pInfo)->getAttributeValue(XML_TSTICKET_ATTR);
+ unsigned int maxLen=tsTicket.length();
+
+ CegoFieldValue b1(VARCHAR_TYPE, tsTicket);
+
+ ListT<CegoFieldValue> bl;
+
+ bl.Insert(b1);
+ info.Insert(bl);
+
+ Chain sysFile = (*pInfo)->getAttributeValue(XML_SYSFILE_ATTR);
+ if ( sysFile.length() > maxLen )
+ maxLen=sysFile.length();
+
+ CegoFieldValue s1(VARCHAR_TYPE, sysFile);
+
+ ListT<CegoFieldValue> sl;
+
+ sl.Insert(s1);
+ info.Insert(sl);
+
+ Chain tempFile = (*pInfo)->getAttributeValue(XML_TEMPFILE_ATTR);
+ if ( tempFile.length() > maxLen )
+ maxLen=tempFile.length();
+
+ CegoFieldValue t1(VARCHAR_TYPE, (*pInfo)->getAttributeValue(XML_TEMPFILE_ATTR));
+
+ ListT<CegoFieldValue> tl;
+
+ tl.Insert(t1);
+
+ info.Insert(tl);
+
+ ListT<Element*> dataFileList = (*pInfo)->getChildren(XML_DATAFILE_ELEMENT);
+ Element **pDF = dataFileList.First();
+
+ while ( pDF )
+ {
+ Chain fileName = (*pDF)->getAttributeValue(XML_NAME_ATTR);
+ if ( fileName.length() > maxLen )
+ maxLen = fileName.length();
+ pDF = dataFileList.Next();
+ }
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("BUFILEINFO"), Chain("BUILEINFO"), Chain("FILENAME"), VARCHAR_TYPE, maxLen));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("DATAFILEINFO"), schema, Chain("DATAFILEINFO"));
+
+ pDF = dataFileList.First();
+ while ( pDF )
+ {
+ Chain fileName = (*pDF)->getAttributeValue(XML_NAME_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, fileName);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+
+ info.Insert(fl);
+
+ pDF = dataFileList.Next();
+ }
+ }
+}
+
+
+void CegoAdminHandler::getDataFileInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info, Chain& format)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tsInfoList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+ Element **pInfo = tsInfoList.First();
+
+ Chain sysFile = (*pInfo)->getAttributeValue(XML_SYSFILE_ATTR);
+ unsigned int maxLen=sysFile.length();
+
+ CegoFieldValue s1(VARCHAR_TYPE, sysFile);
+ CegoFieldValue s2(VARCHAR_TYPE, Chain(XML_SYSFILE_ATTR));
+ CegoFieldValue s3(INT_TYPE, (*pInfo)->getAttributeValue(XML_SYSTOTAL_ATTR).asInteger());
+ CegoFieldValue s4(INT_TYPE, (*pInfo)->getAttributeValue(XML_SYSUSED_ATTR).asInteger());
+
+ ListT<CegoFieldValue> sl;
+
+ sl.Insert(s1);
+ sl.Insert(s2);
+ sl.Insert(s3);
+ sl.Insert(s4);
+
+ info.Insert(sl);
+
+ Chain tempFile = (*pInfo)->getAttributeValue(XML_TEMPFILE_ATTR);
+ if ( tempFile.length() > maxLen )
+ maxLen=tempFile.length();
+
+ CegoFieldValue t1(VARCHAR_TYPE, (*pInfo)->getAttributeValue(XML_TEMPFILE_ATTR));
+ CegoFieldValue t2(VARCHAR_TYPE, Chain(XML_TEMPFILE_ATTR));
+ CegoFieldValue t3(INT_TYPE, (*pInfo)->getAttributeValue(XML_TEMPTOTAL_ATTR).asInteger());
+ CegoFieldValue t4(INT_TYPE, (*pInfo)->getAttributeValue(XML_TEMPUSED_ATTR).asInteger());
+
+ ListT<CegoFieldValue> tl;
+
+ tl.Insert(t1);
+ tl.Insert(t2);
+ tl.Insert(t3);
+ tl.Insert(t4);
+
+ info.Insert(tl);
+
+
+ ListT<Element*> dataFileList = (*pInfo)->getChildren(XML_DATAFILE_ELEMENT);
+ Element **pDF = dataFileList.First();
+
+ while ( pDF )
+ {
+ Chain fileName = (*pDF)->getAttributeValue(XML_NAME_ATTR);
+ if ( fileName.length() > maxLen )
+ maxLen = fileName.length();
+ pDF = dataFileList.Next();
+ }
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("DATAFILEINFO"), Chain("DATAFILEINFO"), Chain("FILENAME"), VARCHAR_TYPE, maxLen));
+ schema.Insert(CegoField(Chain("DATAFILEINFO"), Chain("DATAFILEINFO"), Chain("FILETYPE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("DATAFILEINFO"), Chain("DATAFILEINFO"), Chain("SIZE"), INT_TYPE, sizeof(int)));
+ schema.Insert(CegoField(Chain("DATAFILEINFO"), Chain("DATAFILEINFO"), Chain("USED"), INT_TYPE, sizeof(int)));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("DATAFILEINFO"), schema, Chain("DATAFILEINFO"));
+
+ format = Chain("llrr");
+
+ pDF = dataFileList.First();
+ while ( pDF )
+ {
+ Chain fileName = (*pDF)->getAttributeValue(XML_NAME_ATTR);
+ Chain fileType = (*pDF)->getAttributeValue(XML_TYPE_ATTR);
+
+ Chain numTotal = (*pDF)->getAttributeValue(XML_NUMTOTAL_ATTR);
+ Chain numUsed = (*pDF)->getAttributeValue(XML_NUMUSED_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, fileName);
+ CegoFieldValue f2(VARCHAR_TYPE, fileType);
+ CegoFieldValue f3(INT_TYPE, numTotal);
+ CegoFieldValue f4(INT_TYPE, numUsed);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+
+ info.Insert(fl);
+
+ pDF = dataFileList.Next();
+ }
+ }
+}
+
+
+void CegoAdminHandler::getArchLogInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tsInfoList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+ Element **pInfo = tsInfoList.First();
+
+ ListT<Element*> archLogList = (*pInfo)->getChildren(XML_ARCHIVELOG_ELEMENT);
+ Element **pAL = archLogList.First();
+
+
+ unsigned int maxLen = 0;
+ while ( pAL )
+ {
+ Chain archPath = (*pAL)->getAttributeValue(XML_ARCHPATH_ATTR);
+
+ if ( maxLen < archPath.length() )
+ maxLen = archPath.length();
+
+ pAL = archLogList.Next();
+ }
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("ARCHLOGINFO"), Chain("ARCHLOGINFO"), Chain("ARCHID"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("ARCHLOGINFO"), Chain("ARCHLOGINFO"), Chain("ARCHPATH"), VARCHAR_TYPE, maxLen));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("ARCHLOGINFO"), schema, Chain("ARCHLOGINFO"));
+
+ pAL = archLogList.First();
+ while ( pAL )
+ {
+ Chain archId = (*pAL)->getAttributeValue(XML_ARCHID_ATTR);
+ Chain archPath = (*pAL)->getAttributeValue(XML_ARCHPATH_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, archId);
+ CegoFieldValue f2(VARCHAR_TYPE, archPath);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+
+ info.Insert(fl);
+
+ pAL = archLogList.Next();
+ }
+ }
+}
+
+
+void CegoAdminHandler::getObjectInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> oList = pRoot->getChildren(XML_OBJLIST_ELEMENT);
+ Element **pOL = oList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("OBJINFO"), Chain("OBJINFO"), Chain("Type"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("OBJINFO"), Chain("OBJINFO"), Chain("Name"), VARCHAR_TYPE, 20));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("OBJINFO"), schema, Chain("OBJINFO"));
+
+ if ( pOL )
+ {
+
+ ListT<Element*> oeList = (*pOL)->getChildren(XML_OBJ_ELEMENT);
+
+ Element **pOE = oeList.First();
+
+ while ( pOE )
+ {
+ Chain objType = (*pOE)->getAttributeValue(XML_OBJTYPE_ATTR);
+ Chain objName = (*pOE)->getAttributeValue(XML_OBJNAME_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, objType);
+ CegoFieldValue f2(VARCHAR_TYPE, objName);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+
+ info.Insert(fl);
+
+ pOE = oeList.Next();
+ }
+ }
+ }
+}
+
+void CegoAdminHandler::getTransactionInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> taList = pRoot->getChildren(XML_TAINFO_ELEMENT);
+ Element **pTA = taList.First();
+
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("TAINFO"), Chain("TAINFO"), Chain("RBO"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("TAINFO"), Chain("TAINFO"), Chain("NUMOP"), INT_TYPE, sizeof(int)));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("TAINFO"), schema, Chain("TAINFO"));
+
+ if ( pTA )
+ {
+
+ ListT<Element*> teList = (*pTA)->getChildren(XML_TAENTRY_ELEMENT);
+
+ Element **pTE = teList.First();
+
+ while ( pTE )
+ {
+ Chain rbo = (*pTE)->getAttributeValue(XML_RBO_ATTR);
+ Chain numOp = (*pTE)->getAttributeValue(XML_NUMOP_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, rbo);
+ CegoFieldValue f2(VARCHAR_TYPE, numOp);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+
+ info.Insert(fl);
+
+ pTE = teList.Next();
+ }
+ }
+ }
+}
+
+
+void CegoAdminHandler::getBUStatInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> busList = pRoot->getChildren(XML_BUSINFO_ELEMENT);
+ Element **pBUS = busList.First();
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("BUSTAT"), Chain("BUSTAT"), Chain("TS"), VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("BUSTAT"), Chain("BUSTAT"), Chain("BUINFO"), VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("BUSTAT"), Chain("BUSTAT"), Chain("BUMSG"), VARCHAR_TYPE, 50));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("BUSTAT"), schema, Chain("BUSTAT"));
+
+ if ( pBUS )
+ {
+
+ ListT<Element*> bueList = (*pBUS)->getChildren(XML_BUENTRY_ELEMENT);
+
+ Element **pBUE = bueList.First();
+
+ while ( pBUE )
+ {
+ Chain ts = (*pBUE)->getAttributeValue(XML_TIMESTAMP_ATTR);
+ Chain buinfo = (*pBUE)->getAttributeValue(XML_BUINFO_ATTR);
+ Chain bumsg = (*pBUE)->getAttributeValue(XML_BUMSG_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, ts);
+ CegoFieldValue f2(VARCHAR_TYPE, buinfo);
+ CegoFieldValue f3(VARCHAR_TYPE, bumsg);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+
+ info.Insert(fl);
+
+ pBUE = bueList.Next();
+ }
+ }
+ }
+}
+
+
+
+
+void CegoAdminHandler::getNodeInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> nodeInfoList = pRoot->getChildren(XML_NODEINFO_ELEMENT);
+ Element **pInfo = nodeInfoList.First();
+
+ ListT<Element*> nodeList = (*pInfo)->getChildren(XML_NODE_ELEMENT);
+ Element **pN = nodeList.First();
+
+ unsigned int maxLen = 0;
+ while ( pN )
+ {
+ Chain hostName = (*pN)->getAttributeValue(XML_HOSTNAME_ATTR);
+
+ if ( maxLen < hostName.length() )
+ maxLen = hostName.length();
+
+ pN = nodeList.Next();
+ }
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("NODEINFO"), Chain("NODEINFO"), Chain("NAME"), VARCHAR_TYPE, maxLen));
+ schema.Insert(CegoField(Chain("NODEINFO"), Chain("NODEINFO"), Chain("STATUS"), VARCHAR_TYPE, 10));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("NODEINFO"), schema, Chain("NODEINFO"));
+
+ pN = nodeList.First();
+ while ( pN )
+ {
+ Chain hostName = (*pN)->getAttributeValue(XML_HOSTNAME_ATTR);
+ Chain status = (*pN)->getAttributeValue(XML_STATUS_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, hostName);
+ CegoFieldValue f2(VARCHAR_TYPE, status);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+
+ info.Insert(fl);
+
+ pN = nodeList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getUserInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+ int userLen=10;
+ int roleLen=10;
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> userInfoList = pRoot->getChildren(XML_USERINFO_ELEMENT);
+ Element **pUserInfoElement = userInfoList.First();
+ if ( pUserInfoElement )
+ {
+ ListT<Element*> userElementList = (*pUserInfoElement)->getChildren(XML_USER_ELEMENT);
+ Element **pUserElement = userElementList.First();
+
+ while ( pUserElement )
+ {
+
+ Chain userName = (*pUserElement)->getAttributeValue(XML_NAME_ATTR);
+ if ( userName.length() > userLen )
+ userLen=userName.length();
+
+ Chain role = (*pUserElement)->getAttributeValue(XML_ROLE_ATTR);
+ if ( role.length() > roleLen )
+ roleLen=role.length();
+
+ Chain trace = (*pUserElement)->getAttributeValue(XML_TRACE_ATTR);
+
+ Chain numReq = (*pUserElement)->getAttributeValue(XML_NUMREQUEST_ATTR);
+ Chain numQuery = (*pUserElement)->getAttributeValue(XML_NUMQUERY_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, userName);
+ CegoFieldValue f2(VARCHAR_TYPE, role);
+ CegoFieldValue f3(VARCHAR_TYPE, trace);
+ CegoFieldValue f4(VARCHAR_TYPE, numReq);
+ CegoFieldValue f5(VARCHAR_TYPE, numQuery);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+ fl.Insert(f5);
+
+ info.Insert(fl);
+
+ pUserElement = userElementList.Next();
+ }
+ }
+ }
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("USERINFO"), Chain("USERINFO"), Chain("NAME"), VARCHAR_TYPE, userLen));
+ schema.Insert(CegoField(Chain("USERINFO"), Chain("USERINFO"), Chain("ROLE"), VARCHAR_TYPE, roleLen));
+ schema.Insert(CegoField(Chain("USERINFO"), Chain("USERINFO"), Chain("TRACE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("USERINFO"), Chain("USERINFO"), Chain("NUMREQ"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("USERINFO"), Chain("USERINFO"), Chain("NUMQUERY"), VARCHAR_TYPE, 10));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("USERINFO"), schema, Chain("USERINFO"));
+
+}
+
+void CegoAdminHandler::getTableSetVerificationInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("TSVERIFY"), Chain("TSVERIFY"), Chain("TYPE"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("TSVERIFY"), Chain("TSVERIFY"), Chain("NAME"), VARCHAR_TYPE, 40));
+ schema.Insert(CegoField(Chain("TSVERIFY"), Chain("TSVERIFY"), Chain("STATUS"), VARCHAR_TYPE, 50));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("TSVERIFY"), schema, Chain("TSVERIFY"));
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> verifyInfoList = pRoot->getChildren(XML_VERIFICATION_ELEMENT);
+ Element **pVerifyInfoElement = verifyInfoList.First();
+ if ( pVerifyInfoElement )
+ {
+ ListT<Element*> checkElementList = (*pVerifyInfoElement)->getChildren(XML_CHECK_ELEMENT);
+ Element **pCheckElement = checkElementList.First();
+
+
+ while ( pCheckElement )
+ {
+
+ Chain checkType = (*pCheckElement)->getAttributeValue(XML_TYPE_ATTR);
+ Chain checkName = (*pCheckElement)->getAttributeValue(XML_NAME_ATTR);
+ Chain checkStatus = (*pCheckElement)->getAttributeValue(XML_VALUE_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, checkType);
+ CegoFieldValue f2(VARCHAR_TYPE, checkName);
+ CegoFieldValue f3(VARCHAR_TYPE, checkStatus);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+
+ info.Insert(fl);
+
+ pCheckElement = checkElementList.Next();
+ }
+ }
+ }
+}
+
+
+void CegoAdminHandler::getTableSetCorrectionInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("TSCORRECT"), Chain("TSCORRECT"), Chain("TYPE"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("TSCORRECT"), Chain("TSCORRECT"), Chain("NAME"), VARCHAR_TYPE, 40));
+ schema.Insert(CegoField(Chain("TSCORRECT"), Chain("TSCORRECT"), Chain("STATUS"), VARCHAR_TYPE, 50));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("TSCORRECT"), schema, Chain("TSCORRECT"));
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> correctInfoList = pRoot->getChildren(XML_CORRECTION_ELEMENT);
+ Element **pCorrectInfoElement = correctInfoList.First();
+ if ( pCorrectInfoElement )
+ {
+ ListT<Element*> checkElementList = (*pCorrectInfoElement)->getChildren(XML_CHECK_ELEMENT);
+ Element **pCheckElement = checkElementList.First();
+
+ while ( pCheckElement )
+ {
+
+ Chain checkType = (*pCheckElement)->getAttributeValue(XML_TYPE_ATTR);
+ Chain checkName = (*pCheckElement)->getAttributeValue(XML_NAME_ATTR);
+ Chain checkStatus = (*pCheckElement)->getAttributeValue(XML_VALUE_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, checkType);
+ CegoFieldValue f2(VARCHAR_TYPE, checkName);
+ CegoFieldValue f3(VARCHAR_TYPE, checkStatus);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+
+ info.Insert(fl);
+
+ pCheckElement = checkElementList.Next();
+ }
+ }
+ }
+}
+
+
+void CegoAdminHandler::getRoleList(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("ROLELIST"), Chain("ROLELIST"), Chain("ROLE"), VARCHAR_TYPE, 15));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("ROLELIST"), schema, Chain("ROLELIST"));
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> roleListElementList = pRoot->getChildren(XML_ROLELIST_ELEMENT);
+ Element **pRoleListElement = roleListElementList.First();
+ if ( pRoleListElement )
+ {
+
+ ListT<Element*> roleList = (*pRoleListElement)->getChildren(XML_ROLE_ELEMENT);
+ Element **pRoleElement = roleList.First();
+ while ( pRoleElement )
+ {
+ Chain role = (*pRoleElement)->getAttributeValue(XML_NAME_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, role);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+
+ info.Insert(fl);
+
+ pRoleElement = roleList.Next();
+ }
+ }
+ }
+}
+
+void CegoAdminHandler::getRoleInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("ROLEINFO"), Chain("ROLEINFO"), Chain("PERMID"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("ROLEINFO"), Chain("ROLEINFO"), Chain("TABLESET"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("ROLEINFO"), Chain("ROLEINFO"), Chain("FILTER"), VARCHAR_TYPE, 15));
+ schema.Insert(CegoField(Chain("ROLEINFO"), Chain("ROLEINFO"), Chain("PERM"), VARCHAR_TYPE, 15));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("ROLEINFO"), schema, Chain("ROLEINFO"));
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> permInfoList = pRoot->getChildren(XML_PERMINFO_ELEMENT);
+
+ Element** pPermInfo = permInfoList.First();
+
+ if ( pPermInfo )
+ {
+ ListT<Element*> permList = (*pPermInfo)->getChildren(XML_PERM_ELEMENT);
+ Element **pPermElement = permList.First();
+ while ( pPermElement )
+ {
+ Chain permid = (*pPermElement)->getAttributeValue(XML_PERMID_ATTR);
+ Chain tableSet = (*pPermElement)->getAttributeValue(XML_TABLESET_ATTR);
+ Chain filter = (*pPermElement)->getAttributeValue(XML_FILTER_ATTR);
+ Chain perm = (*pPermElement)->getAttributeValue(XML_PERM_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, permid);
+ CegoFieldValue f2(VARCHAR_TYPE, tableSet);
+ CegoFieldValue f3(VARCHAR_TYPE, filter);
+ CegoFieldValue f4(VARCHAR_TYPE, perm);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+
+ info.Insert(fl);
+
+ pPermElement = permList.Next();
+ }
+ }
+ }
+}
+
+void CegoAdminHandler::getLogInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+
+ ListT<Element*> tsInfoList = pRoot->getChildren(XML_TABLESET_ELEMENT);
+ Element **pInfo = tsInfoList.First();
+
+ ListT<Element*> logList = (*pInfo)->getChildren(XML_LOGFILE_ELEMENT);
+ Element **pL = logList.First();
+
+
+ unsigned int maxLen = 0;
+ while ( pL )
+ {
+ Chain logName = (*pL)->getAttributeValue(XML_NAME_ATTR);
+
+ if ( maxLen < logName.length() )
+ maxLen = logName.length();
+
+ pL = logList.Next();
+ }
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("LOGFILE"), Chain("LOGFILE"), Chain("NAME"), VARCHAR_TYPE, maxLen));
+ schema.Insert(CegoField(Chain("LOGFILE"), Chain("LOGFILE"), Chain("STATUS"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("LOGFILE"), Chain("LOGFILE"), Chain("SIZE"), VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("LOGFILE"), Chain("LOGFILE"), Chain("OFFSET"), VARCHAR_TYPE, 20));
+ schema.Insert(CegoField(Chain("LOGFILE"), Chain("LOGFILE"), Chain("USAGE"), VARCHAR_TYPE, 20));
+
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("LOGFILE"), schema, Chain("LOGFILE"));
+
+ pL = logList.First();
+ while ( pL )
+ {
+ Chain logName = (*pL)->getAttributeValue(XML_NAME_ATTR);
+ Chain logStatus = (*pL)->getAttributeValue(XML_STATUS_ATTR);
+ Chain logSize = (*pL)->getAttributeValue(XML_SIZE_ATTR);
+ Chain logOffset = (*pL)->getAttributeValue(XML_OFFSET_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, logName);
+ CegoFieldValue f2(VARCHAR_TYPE, logStatus);
+ CegoFieldValue f3(VARCHAR_TYPE, logSize);
+ CegoFieldValue f4(VARCHAR_TYPE, logOffset);
+ long percentUsage = logOffset.asLong() / ( logSize.asLong() / 100 );
+ CegoFieldValue f5(VARCHAR_TYPE, Chain(percentUsage) + Chain("%"));
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+ fl.Insert(f3);
+ fl.Insert(f4);
+ fl.Insert(f5);
+
+
+ info.Insert(fl);
+
+ pL = logList.Next();
+ }
+ }
+}
+
+void CegoAdminHandler::getLogMngInfo(CegoTableObject& oe, ListT<ListT< CegoFieldValue > > & info)
+{
+
+ ListT<CegoField> schema;
+ schema.Insert(CegoField(Chain("LOGMNGINFO"), Chain("LOGMNGINFO"), Chain("LOGMANAGER"), VARCHAR_TYPE, 30));
+ schema.Insert(CegoField(Chain("LOGMNGINFO"), Chain("LOGMNGINFO"), Chain("TIMEOUT"), VARCHAR_TYPE, 10));
+ oe = CegoTableObject( 0, CegoObject::SYSTEM, Chain("LOGMNGINFO"), schema, Chain("LOGMNGINFO"));
+
+ Element *pRoot = _xml.getDocument()->getRootElement();
+
+ if ( pRoot )
+ {
+ ListT<Element*> logMngInfo = pRoot->getChildren(XML_LOGMNGINFO_ELEMENT);
+
+ Element** pLogMng = logMngInfo.First();
+
+ if ( pLogMng )
+ {
+ Chain logMng = (*pLogMng)->getAttributeValue(XML_LOGMNGPROG_ATTR);
+ Chain timeout = (*pLogMng)->getAttributeValue(XML_LOGMNGTIMEOUT_ATTR);
+
+ CegoFieldValue f1(VARCHAR_TYPE, logMng);
+ CegoFieldValue f2(VARCHAR_TYPE, timeout);
+
+ ListT<CegoFieldValue> fl;
+
+ fl.Insert(f1);
+ fl.Insert(f2);
+
+ info.Insert(fl);
+
+ }
+ }
+}
+
|
[-]
[+]
|
Added |
cego-2.15.5.tar.bz2/src/#CegoDbThread.cc#
^
|
@@ -0,0 +1,1187 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// CegoDbThread.cc
+// ---------------
+// Cego db thread class implementation
+//
+// Design and Implementation by Bjoern Lemke
+//
+// (C)opyright 2000-2010 Bjoern Lemke
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+//
+// IMPLEMENTATION MODULE
+//
+// Class: CegoDbThread
+//
+// Description: This class implements the functions of a single database thread.
+// It serves a database session dispatched from the database thread pool
+// and handles subsequent requests for this session.
+// Database requests can be request from a native client but also distributed
+// requests from a different cego database node.
+//
+//
+// Status: QG-2.6
+//
+///////////////////////////////////////////////////////////////////////////////
+
+// INCLUDES
+#include <lfc/Exception.h>
+#include <lfc/Sleeper.h>
+#include <lfc/ThreadLock.h>
+
+#include "CegoXMLdef.h"
+#include "CegoDefs.h"
+#include "CegoDbThread.h"
+#include "CegoDbThreadPool.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+CegoDbThread::CegoDbThread() : Thread()
+{
+}
+
+CegoDbThread::CegoDbThread(CegoDbThreadPool *pPool, CegoDatabaseManager *pDBMng, CegoDbHandler::ProtocolType protType) : Thread()
+{
+ _pPool = pPool;
+ _pDBMng = pDBMng;
+ _protType = protType;
+ _modId = _pDBMng->getModId("CegoDbThread");
+ _errorCode = 0;
+
+}
+
+CegoDbThread::~CegoDbThread()
+{
+ delete _pPA;
+ delete _pTabMng;
+}
+
+const Chain& CegoDbThread::lastAction() const
+{
+ return _lastAction;
+}
+
+void CegoDbThread::abortSession()
+{
+ _pTabMng->abort();
+}
+
+int CegoDbThread::getErrorCode() const
+{
+ return _errorCode;
+}
+
+void CegoDbThread::addReloadRequest(int tabSetId)
+{
+ _pPool->P(_idx);
+ _loadList.Insert(tabSetId);
+ _pPool->V(_idx);
+}
+
+void CegoDbThread::checkReloadRequest()
+{
+
+ _pPool->P(_idx);
+ int *pTS = _loadList.First();
+ if ( pTS )
+ {
+ int ts = *pTS;
+ _loadList.Remove(*pTS);
+ _pPool->V(_idx);
+
+ _pTabMng->disableAuth();
+
+ try
+ {
+
+ loadObjects(ts);
+ }
+ catch ( Exception e )
+ {
+
+ Chain msg;
+ e.pop(msg);
+ _pDBMng->log(_modId, Logger::LOGERR, Chain("Thread ") + Chain(_idx) + Chain(" reload error : ") + msg);
+ }
+
+ _pTabMng->enableAuth();
+
+ }
+ else
+ {
+ _pPool->V(_idx);
+ }
+}
+
+void* CegoDbThread::job(void* arg)
+{
+
+ try
+ {
+
+ _idx = *(long*)arg;
+
+ _pTabMng = new CegoDistManager(_pDBMng);
+ _pPA = new CegoAction(_pTabMng, _pPool);
+
+ _pTim = new NanoTimer();
+
+ _pTabMng->setPoolSyncInfo(_pPool, _idx);
+ _pTabMng->setThreadId(getTid());
+ _pPool->setTid(_idx, getTid());
+ _pPool->setThreadState(_idx, CegoDbThreadPool::READY);
+
+ while ( ! _pPool->isTerminated() )
+ {
+ try
+ {
+ _pTim->reset();
+ _pTim->start();
+
+ _pRequest = _pPool->nextRequest();
+
+ if ( _pRequest )
+ {
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Serving service request"));
+#endif
+
+ _pPool->setState(_idx, CegoDbThreadPool::CONNECTED);
+ _pPool->incNumRequest(_idx);
+
+ _pDBMng->increaseActiveDbThread();
+
+ CegoDistDbHandler *pSH = 0;
+ try {
+
+ pSH = new CegoDistDbHandler(_pRequest, _protType, _pDBMng);
+ serveSession(pSH);
+ delete pSH;
+ }
+ catch ( Exception e)
+ {
+ if ( pSH )
+ delete pSH;
+
+ Chain msg;
+ Chain module;
+ int line;
+
+ Chain exep;
+ while ( e.pop(module, line, msg) )
+ {
+ exep += Chain("\n\t") + module + Chain("(") + Chain(line) + Chain(") : ") + msg;
+ }
+
+ _pDBMng->log(_modId, Logger::LOGERR, Chain("Thread ") + Chain(_idx) + Chain(" : DB session aborted : ") + exep);
+
+ }
+
+ // in any case, rollbak any open transactions
+ _pTabMng->rollbackDistTransaction(_pPA->getTableSet());
+
+ _pDBMng->decreaseActiveDbThread();
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Service request finished"));
+#endif
+
+ _pPool->setState(_idx, CegoDbThreadPool::READY);
+
+ if ( _pTabMng->isAborted() )
+ {
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Thread ") + Chain(_idx) + Chain(" : Abort catched, proceed with session"));
+ _pTabMng->proceed();
+ }
+
+ delete _pRequest;
+ }
+ else
+ {
+ Sleeper s;
+ s.nanoSleep(NETMNG_QUEUE_DELAY);
+
+ }
+
+ checkReloadRequest();
+
+ _pTim->stop();
+ _pPool->addThreadIdle(_idx, _pTim->getSum());
+
+ }
+ catch ( Exception e)
+ {
+ Chain msg;
+ e.pop(msg);
+ _pDBMng->log(_modId, Logger::LOGERR, Chain("Thread ") + Chain(_idx) + Chain(" : ") + msg);
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ Chain msg;
+ e.pop(msg);
+ _pDBMng->log(_modId, Logger::LOGERR, Chain("Thread ") + Chain(_idx) + Chain(" : ") + msg);
+ _errorCode = 1;
+ }
+ return 0;
+}
+
+void CegoDbThread::loadObjects(int tabSetId)
+{
+
+ Chain tableSet = _pDBMng->getTabSetName(tabSetId);
+
+ _pPA->setTableSet(tableSet);
+
+ ListT<Chain> procList;
+ _pTabMng->getObjectList(tabSetId, CegoObject::PROCEDURE, procList);
+
+ Chain *pProcName = procList.First();
+ while ( pProcName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Compiling procedure ") + *pProcName);
+#endif
+
+ CegoProcObject po;
+ _pTabMng->getObject(tabSetId, *pProcName, CegoObject::PROCEDURE, po);
+
+ Chain loadString = Chain("load ") + po.getProcText();
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Loading <<< ") + loadString + Chain(">>>"));
+#endif
+
+ // cout << "Loading procedure " << loadString << endl;
+
+ try
+ {
+ _pPA->cleanUp();
+ _pPA->setCommandChain(loadString);
+ _pPA->parse();
+
+ CegoProcedure* pProc = _pPA->getProcedure();
+ _pTabMng->addCompProcedure(tabSetId, pProc);
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Procedure ") + *pProcName + Chain(" added"));
+#endif
+
+
+ }
+ catch ( Exception e )
+ {
+
+ Chain msg;
+ e.pop(msg);
+ _pDBMng->log(_modId, Logger::LOGERR, Chain("Thread ") + Chain(_idx) + Chain(" procedure load error : ") + msg);
+ _pPA->cleanUp();
+ }
+
+
+ pProcName = procList.Next();
+ }
+
+ ListT<Chain> viewList;
+ _pTabMng->getObjectList(tabSetId, CegoObject::VIEW, viewList);
+
+ Chain *pViewName = viewList.First();
+ while ( pViewName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Compiling view ") + *pViewName);
+#endif
+ CegoViewObject vo;
+ _pTabMng->getObject(tabSetId, *pViewName, CegoObject::VIEW, vo);
+
+ Chain loadString = Chain("load ") + vo.getViewStmt();
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Loading <<< ") + loadString + Chain(">>>"));
+#endif
+
+
+ _pPA->cleanUp();
+ _pPA->setCommandChain(loadString);
+ _pPA->parse();
+
+ CegoSelect* pSelect = _pPA->getSelect();
+
+ CegoView *pView = new CegoView(*pViewName, pSelect);
+
+ _pTabMng->addCompView(tabSetId, pView);
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : View ") + *pViewName + Chain(" added"));
+#endif
+ pViewName = viewList.Next();
+ }
+
+}
+
+void CegoDbThread::unloadObjects(int tabSetId)
+{
+ try
+ {
+ _pTabMng->getTransactionManager()->release(tabSetId);
+ _pTabMng->removeAllComp(tabSetId);
+ }
+ catch ( Exception e )
+ {
+ throw e;
+ }
+}
+
+void CegoDbThread::invalidateObject(int tabSetId, const Chain& objName, CegoObject::ObjectType type)
+{
+
+ if ( type == CegoObject::VIEW )
+ {
+ _pTabMng->removeCompView(tabSetId, objName);
+ }
+ else if ( type == CegoObject::PROCEDURE )
+ {
+ _pTabMng->removeCompProcedure(tabSetId, objName);
+ }
+ else
+ {
+ throw Exception(EXLOC, "Unknown object type for invalidation");
+ }
+}
+
+void CegoDbThread::serveSession(CegoDistDbHandler *pSH)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Serving session"));
+#endif
+
+ if ( pSH->acceptSession() )
+ {
+ bool isTraceOn;
+ Chain msg;
+ if ( _pDBMng->checkUser(pSH->getUser(), pSH->getPassword(), msg, isTraceOn) == false )
+ {
+ pSH->sendError(msg);
+ return;
+ }
+ else
+ {
+
+ if ( _pDBMng->tableSetExists(pSH->getTableSet()) == false )
+ {
+ Chain msg = Chain("Unknown tableset ") + pSH->getTableSet();
+ pSH->sendError(msg);
+ return;
+ }
+
+ _pTabMng->setActiveUser(pSH->getTableSet(), pSH->getUser(), pSH->getPassword());
+
+ msg = Chain("Access granted");
+ pSH->sendSessionConfirm(msg, _idx, XML_DBPRODNAME_VALUE, XML_DBPRODVERSION_VALUE);
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Accepted session for tableset ") + pSH->getTableSet());
+#endif
+
+ }
+
+
+ _pPA->setTableSet(pSH->getTableSet());
+
+ bool isTerminated = false;
+
+ while ( isTerminated == false && _pPool->isTerminated() == false )
+ {
+
+ CegoDbHandler::RequestType reqType;
+ reqType = pSH->acceptRequest();
+
+ _pTim->stop();
+ _pPool->addThreadIdle(_idx, _pTim->getSum());
+ _pTim->reset();
+ _pTim->start();
+
+ if ( reqType != CegoDbHandler::REQTIMEOUT )
+ {
+ Chain runState = _pDBMng->getTableSetRunState(pSH->getTableSet());
+ if ( runState != Chain(XML_ONLINE_VALUE) && runState != Chain(XML_BACKUP_VALUE) )
+ {
+ Chain msg = Chain("Tableset " + pSH->getTableSet() + " not online ( run state is " + runState + ")");
+ pSH->sendError(msg);
+ }
+ else
+ {
+
+ if ( isTraceOn )
+ {
+ _pDBMng->incUserQuery(pSH->getUser());
+ }
+
+ _pPool->incNumQueryRequest(_idx);
+
+ _pPool->setState(_idx, CegoDbThreadPool::BUSY);
+
+
+ _pTim->stop();
+ _pPool->addThreadIdle(_idx, _pTim->getSum());
+
+ isTerminated = serveRequest(pSH, reqType);
+
+ _pTim->reset();
+ _pTim->start();
+
+ _pPool->setState(_idx, CegoDbThreadPool::CONNECTED);
+ }
+ }
+ else
+ {
+
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Client request timeout occured, waiting ..."));
+#endif
+ }
+
+ checkReloadRequest();
+
+
+ }
+ }
+}
+
+bool CegoDbThread::serveRequest(CegoDistDbHandler *pSH, CegoDbHandler::RequestType reqType)
+{
+ bool isTerminated=false;
+
+ // at the beginning of the request, in any case we reset abort status
+ _pTabMng->proceed();
+
+ try {
+
+ switch ( reqType )
+ {
+
+ case CegoDbHandler::DBPRODINFO:
+ {
+ pSH->sendProdInfo();
+ break;
+ }
+ case CegoDbHandler::QUERYABORT:
+ {
+ long idx;
+
+ idx = pSH->getTid();
+ _pPool->abortThread(idx);
+ pSH->sendResponse(Chain("Query aborted"));
+ break;
+ }
+ case CegoDbHandler::QUERY:
+ {
+
+ _lastAction = pSH->getQueryArg();
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Query Arg = <<<") + _lastAction + Chain(">>>"));
+#endif
+
+ _pPA->cleanUp();
+ _pPA->setCommandChain( _lastAction );
+ _pPA->setDbHandle(pSH);
+
+ _pPA->parse();
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Thread ") + Chain(_idx) + Chain(" : Query request done"));
+#endif
+
+ break;
+ }
+ case CegoDbHandler::INSERT:
+ {
+ Chain tableSet;
+ Chain tableName;
+ ListT<CegoField> fl;
+
+ pSH->getInsertArg(tableSet, tableName,fl);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ CegoTableObject oe;
+ _pTabMng->getObject(tabSetId, tableName, CegoObject::TABLE, oe);
+ _pTabMng->insertLocalDataTable(oe, fl);
+
+ pSH->sendResponse(Chain("insert ok"));
+
+ break;
+ }
+ case CegoDbHandler::DELETETABLE:
+ {
+
+ Chain tableSet;
+ Chain tableName;
+ CegoPredDesc *pPred = 0;
+
+ pSH->getDeleteArg(tableSet, tableName, pPred, _pTabMng);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ CegoTableObject oe;
+ _pTabMng->getObject(tabSetId, tableName, CegoObject::TABLE, oe);
+
+ long delCount = _pTabMng->deleteLocalDataTable(oe, pPred);
+
+ pSH->sendResponse(Chain("delete ok"), delCount);
+
+ break;
+ }
+ case CegoDbHandler::UPDATE:
+ {
+
+ Chain tableSet;
+ Chain tableName;
+ CegoPredDesc *pPred = 0;
+ ListT<CegoField> updSchema;
+ ListT<CegoExpr*> exprList;
+
+ pSH->getUpdateArg(tableSet, tableName, updSchema, exprList, pPred, _pTabMng);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ CegoTableObject oe;
+ _pTabMng->getObject(tabSetId, tableName, CegoObject::TABLE, oe);
+
+ long updCount = _pTabMng->updateLocalDataTable(oe, pPred, updSchema, exprList);
+
+ pSH->sendResponse(Chain("update ok"), updCount);
+
+ break;
+ }
+ case CegoDbHandler::CREATETABLE:
+ {
+ Chain tableSet;
+ Chain tableName;
+ ListT<CegoField> fl;
+ ListT<CegoField> idxList;
+
+ pSH->getCreateTableArg(tableSet, tableName, fl, idxList);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->createLocalDataTable(tabSetId, tableName, CegoObject::TABLE, fl, idxList);
+
+ _pDBMng->addObject(tabSetId, tableName, CegoObject::TABLE);
+ if ( ! idxList.isEmpty() )
+ {
+ Chain idxName = tableName + Chain(TABMNG_PIDX_SUFFIX);
+ _pDBMng->addObject(tabSetId, idxName, CegoObject::INDEX);
+ }
+
+ pSH->sendResponse(Chain("create ok"));
+ break;
+ }
+ case CegoDbHandler::CREATEVIEW:
+ {
+ Chain tableSet;
+ Chain viewName;
+ Chain viewText;
+ ListT<CegoField> fl;
+
+ pSH->getCreateViewArg(tableSet, viewName, fl, viewText);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->createLocalView(tabSetId, viewName, fl, viewText);
+
+ _pDBMng->addObject(tabSetId, viewName, CegoObject::VIEW);
+
+ pSH->sendResponse(Chain("create view ok"));
+ break;
+ }
+ case CegoDbHandler::CREATEPROCEDURE:
+ {
+ Chain tableSet;
+ Chain procName;
+ Chain procText;
+
+ pSH->getCreateProcedureArg(tableSet, procName, procText);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->createLocalProc(tabSetId, procName, procText);
+
+ _pDBMng->addObject(tabSetId, procName, CegoObject::PROCEDURE);
+
+ pSH->sendResponse(Chain("create procedure ok"));
+ break;
+ }
+ case CegoDbHandler::CREATECHECK:
+ {
+ Chain tableSet;
+ Chain checkName;
+ Chain tableName;
+ CegoPredDesc *pPred;
+
+ pSH->getCreateCheckArg(tableSet, checkName, tableName, pPred, _pTabMng);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->createLocalCheck(tabSetId, checkName, tableName, pPred);
+
+ _pDBMng->addObject(tabSetId, checkName, CegoObject::CHECK);
+
+ pSH->sendResponse(Chain("create check ok"));
+ break;
+ }
+
+ case CegoDbHandler::ALTERTABLE:
+ {
+ Chain tableSet;
+ Chain tableName;
+ ListT<CegoAlterDesc> alterList;
+
+ pSH->getAlterTableArg(tableSet, tableName, alterList);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->alterDataTable(tabSetId, tableName, CegoObject::TABLE, alterList);
+ pSH->sendResponse(Chain("alter ok"));
+ break;
+ }
+ case CegoDbHandler::DROPOBJECT:
+ {
+ Chain tableSet;
+ CegoObject::ObjectType objType;
+ Chain objName;
+
+ pSH->getDropTableArg(tableSet, objName, objType);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->dropLocalObject(tabSetId, objName, objType);
+ pSH->sendResponse(Chain("Drop ok"));
+ break;
+ }
+ case CegoDbHandler::CREATEINDEX:
+ {
+ Chain tableSet;
+ Chain indexName;
+ Chain tableName;
+ ListT<CegoField> idxList;
+ CegoObject::ObjectType type;
+ pSH->getCreateIndexArg(tableSet, indexName, tableName, idxList, type);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->createLocalIndexTable(tabSetId, indexName, tableName, type, idxList);
+
+ _pDBMng->addObject(tabSetId, indexName, type);
+
+ pSH->sendResponse(Chain("create ok"));
+ break;
+ }
+ case CegoDbHandler::OBJECTINFO:
+ {
+ int tabSetId;
+ Chain objName;
+ CegoObject::ObjectType objType;
+
+ pSH->getObjectInfoArg(tabSetId, objName, objType);
+
+ switch ( objType )
+ {
+ case CegoObject::SYSTEM:
+ case CegoObject::TABLE:
+ case CegoObject::PINDEX:
+ case CegoObject::UINDEX:
+ case CegoObject::INDEX:
+ {
+ CegoTableObject to;
+ _pTabMng->getLocalObject(tabSetId, objName, objType, to);
+ pSH->sendObjInfo(to);
+ break;
+ }
+ case CegoObject::VIEW:
+ {
+ CegoViewObject vo;
+ _pTabMng->getLocalObject(tabSetId, objName, objType, vo);
+ pSH->sendObjInfo(vo);
+ break;
+ }
+ case CegoObject::PROCEDURE:
+ {
+ CegoProcObject po;
+ _pTabMng->getLocalObject(tabSetId, objName, objType, po);
+ pSH->sendObjInfo(po);
+ break;
+ }
+ case CegoObject::FKEY:
+ {
+ CegoKeyObject ko;
+ _pTabMng->getLocalObject(tabSetId, objName, objType, ko);
+ pSH->sendObjInfo(ko);
+ break;
+ }
+ case CegoObject::CHECK:
+ {
+ CegoCheckObject co;
+ _pTabMng->getLocalObject(tabSetId, objName, objType, co);
+ pSH->sendObjInfo(co);
+ break;
+ }
+ case CegoObject::JOIN:
+ case CegoObject::RBSEG:
+ case CegoObject::UNDEFINED:
+ {
+ throw Exception(EXLOC, "Objectinfo not supported for this object type");
+ break;
+ }
+ }
+ break;
+ }
+ case CegoDbHandler::GETTABLE:
+ {
+ int tabSetId;
+ Chain tableName;
+ CegoObject::ObjectType type;
+
+ pSH->getGetTableArg(tabSetId, tableName, type);
+
+ CegoTableObject oe;
+ _pTabMng->getLocalObject(tabSetId, tableName, type, oe);
+
+ ListT<CegoField> schema = oe.getSchema();
+
+ pSH->collectSchema(schema);
+
+ CegoObjectCursor *pOC = _pTabMng->getObjectCursor(tabSetId, tableName, tableName, type);
+
+ int tupleCount=0;
+
+ CegoDataPointer dp;
+ bool moreTuple = _pTabMng->getFirstTuple(pOC, schema, dp);
+
+ while ( moreTuple )
+ {
+ pSH->collectData(schema);
+ tupleCount++;
+
+ if ( tupleCount == NETMNG_MAXTUPLECOUNT )
+ {
+ pSH->sendCollectedData();
+ tupleCount=0;
+ }
+ moreTuple = _pTabMng->getNextTuple(pOC, schema, dp);
+ }
+
+ if ( tupleCount > 0)
+ {
+ pSH->sendCollectedData();
+ }
+
+ pSH->sendFinishData();
+
+ break;
+ }
+ case CegoDbHandler::GETOBJLIST:
+ {
+ int tabSetId;
+ CegoObject::ObjectType type;
+
+ pSH->getGetObjectListArg(tabSetId, type);
+
+ ListT<Chain> objList;
+ _pTabMng->getObjectList(tabSetId, type, objList);
+
+ pSH->sendObjList(objList);
+
+ break;
+
+ }
+ case CegoDbHandler::GETOBJLISTBYTABLE:
+ {
+ Chain tableSet;
+ Chain tableName;
+
+ pSH->getGetObjectByTableListArg(tableSet, tableName);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+
+ ListT<CegoTableObject> idxList;
+ ListT<CegoKeyObject> keyList;
+ ListT<CegoCheckObject> checkList;
+
+ _pTabMng->getObjectListByTable(tabSetId, tableName, idxList, keyList, checkList);
+
+ pSH->sendObjByTableList(idxList, keyList, checkList);
+
+ break;
+
+ }
+ case CegoDbHandler::OBJRENAME:
+ {
+ Chain tableSet;
+ CegoObject::ObjectType type;
+ Chain objName;
+ Chain newObjName;
+
+ pSH->getRenameArg(tableSet, objName, type, newObjName);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ _pTabMng->renameObject(tabSetId, objName, type, newObjName);
+
+ pSH->sendResponse(Chain("rename ok"));
+
+ break;
+
+ }
+ case CegoDbHandler::REORGOBJ:
+ {
+ Chain tableSet;
+ CegoObject::ObjectType type;
+ Chain objName;
+ Chain newObjName;
+
+ pSH->getReorgArg(tableSet, objName, type);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ _pTabMng->reorgObject(tabSetId, objName, type);
+
+ pSH->sendResponse(Chain("reorg ok"));
+
+ break;
+
+ }
+
+ case CegoDbHandler::SYNC:
+ {
+ Chain tableSet;
+ Chain escCmd;
+ int timeout;
+
+ pSH->getSyncArg(tableSet, escCmd, timeout);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ _pTabMng->writeCheckPoint(tabSetId, true, true, escCmd, timeout);
+
+ pSH->sendResponse(Chain("sync ok"));
+
+ break;
+
+ }
+ case CegoDbHandler::GETPAGECOUNT:
+ {
+ Chain tableSet;
+ Chain objName;
+ CegoObject::ObjectType type;
+
+ pSH->getPageCountArg(tableSet, objName, type);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ int pageCount = 0;
+ _pTabMng->getPageCount(tabSetId, objName, type);
+
+ pSH->sendPageCount(pageCount);
+
+ break;
+
+ }
+ case CegoDbHandler::PUTBLOB:
+ {
+
+ _lastAction = Chain("put blob");
+
+ Chain tableSet;
+ long blobSize;
+
+ pSH->getPutBlobArg(tableSet, blobSize);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ NetHandler *pN = pSH->getNetHandler();
+
+ int fileId = 0;
+ int pageId = 0;
+
+ CegoBufferPage bp;
+
+ try
+ {
+
+ _pTabMng->getNewFilePage(bp, tabSetId, CegoObject::TABLE);
+ bp.initPage(CegoBufferPage::BLOB);
+
+ fileId = bp.getFileId();
+ pageId = bp.getPageId();
+
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain(" Thread ") + Chain(_idx) + Chain(" : Sending blob info [") + Chain(fileId) + Chain(",") + Chain(pageId) + Chain("]"));
+#endif
+ pSH->sendBlobInfo(fileId, pageId);
+
+ int freeInPage = bp.getChunkLen();
+ char* pagePtr = bp.getBlobEntry();
+
+ memcpy(pagePtr, &blobSize, sizeof(long));
+ pagePtr += sizeof(long);
+ freeInPage -= sizeof(long);
+
+ char *bufPtr = 0;
+ int availFromBuf = 0;
+
+ long recvSize = 0;
+ while ( recvSize < blobSize )
+ {
+ if ( availFromBuf == 0 )
+ {
+ if ( pN->waitMsg(NETMNG_WAITMSG_TIMEOUT) == false )
+ throw Exception(EXLOC, "Timeout exceeded for blob chunk");
+ pN->readMsg();
+ pN->sendAck();
+ bufPtr = pN->getMsg();
+ availFromBuf = pN->getMsgSize();
+ }
+
+ if ( freeInPage == 0 )
+ {
+ CegoBufferPage nextPage;
+ _pTabMng->getNewFilePage(nextPage, tabSetId, CegoObject::TABLE);
+ nextPage.initPage(CegoBufferPage::BLOB);
+
+ bp.setNextFileId(nextPage.getFileId());
+ bp.setNextPageId(nextPage.getPageId());
+
+ _pDBMng->bufferUnfix(bp, true, _pTabMng->getLockHandler());
+
+ bp = nextPage;
+
+ freeInPage = bp.getChunkLen();
+ pagePtr = bp.getBlobEntry();
+ }
+
+ if ( freeInPage >= availFromBuf )
+ {
+ memcpy(pagePtr, bufPtr, availFromBuf);
+ recvSize += availFromBuf;
+ pagePtr += availFromBuf;
+ freeInPage -= availFromBuf;
+ availFromBuf = 0;
+ }
+ else if ( freeInPage < availFromBuf )
+ {
+ memcpy(pagePtr, bufPtr, freeInPage);
+ recvSize += freeInPage;
+ bufPtr += freeInPage;
+ availFromBuf -= freeInPage;
+ freeInPage = 0;
+ }
+ }
+ _pDBMng->bufferUnfix(bp, true, _pTabMng->getLockHandler());
+ }
+ catch ( Exception e )
+ {
+ if ( bp.isFixed() )
+ _pDBMng->bufferUnfix(bp, true, _pTabMng->getLockHandler());
+ if ( fileId || pageId )
+ {
+ _pTabMng->releaseBlob(tabSetId, fileId, pageId);
+ }
+ }
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain(" Thread ") + Chain(_idx) + Chain(" : Blob transfer finished"));
+#endif
+
+ break;
+
+ }
+ case CegoDbHandler::GETBLOB:
+ {
+
+ _lastAction = Chain("get blob");
+
+ Chain tableSet;
+ int fileId;
+ int pageId;
+
+ pSH->getGetBlobArg(tableSet, fileId, pageId);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ NetHandler *pN = pSH->getNetHandler();
+
+ bool isFixed = false;
+ CegoBufferPage bp;
+ try
+ {
+
+ _pDBMng->bufferFix(bp, tabSetId, fileId, pageId, CegoBufferPool::SYNC,
+ _pTabMng->getLockHandler());
+
+
+ long blobSize;
+ memcpy (&blobSize, bp.getBlobEntry(), sizeof(long));
+
+ pSH->sendBlobSize(blobSize);
+
+ long sentByte = 0;
+
+ while ( bp.isFixed() )
+ {
+ pN->recvAck();
+
+ int chunkSize;
+ if ( bp.getChunkLen() < blobSize - sentByte )
+ {
+ chunkSize = bp.getChunkLen();
+ if ( sentByte == 0 )
+ chunkSize -= sizeof(long);
+ }
+ else
+ {
+ chunkSize = blobSize - sentByte;
+ }
+
+ if ( sentByte == 0 )
+ {
+ pN->setMsg(bp.getBlobEntry() + sizeof(long), chunkSize );
+ }
+ else
+ {
+ pN->setMsg(bp.getBlobEntry(), chunkSize);
+ }
+ sentByte += chunkSize;
+
+ pN->writeMsg();
+
+ fileId = bp.getNextFileId();
+ pageId = bp.getNextPageId();
+
+ _pDBMng->bufferUnfix(bp, false, _pTabMng->getLockHandler());
+
+ if ( fileId || pageId )
+ {
+ _pDBMng->bufferFix(bp, tabSetId, fileId, pageId, CegoBufferPool::SYNC,
+ _pTabMng->getLockHandler());
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ if ( bp.isFixed() )
+ _pDBMng->bufferUnfix(bp, true, _pTabMng->getLockHandler());
+ }
+
+ break;
+
+ }
+ case CegoDbHandler::DELBLOB:
+ {
+
+ _lastAction = Chain("del blob");
+
+ Chain tableSet;
+ int fileId;
+ int pageId;
+
+ pSH->getGetBlobArg(tableSet, fileId, pageId);
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ _pTabMng->releaseBlob(tabSetId, fileId, pageId);
+
+ pSH->sendResponse(Chain("Blob deleted"));
+
+ break;
+
+ }
+ case CegoDbHandler::STARTTRANSACTION:
+ {
+ _lastAction = Chain("start transaction");
+
+ Chain tableSet;
+ pSH->getArgValue(XML_TABLESET_ATTR, tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->beginTransaction(tabSetId);
+ pSH->sendResponse(Chain("Transaction started"));
+ break;
+ }
+ case CegoDbHandler::COMMITTRANSACTION:
+ {
+ _lastAction = Chain("commit transaction");
+ Chain tableSet;
+ pSH->getArgValue(XML_TABLESET_ATTR, tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->commitTransaction(tabSetId);
+ pSH->sendResponse(Chain("Transaction committed"));
+ break;
+ }
+ case CegoDbHandler::ROLLBACKTRANSACTION:
+ {
+ _lastAction = Chain("rollback transaction");
+ Chain tableSet;
+ pSH->getArgValue(XML_TABLESET_ATTR, tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ _pTabMng->rollbackTransaction(tabSetId);
+ pSH->sendResponse(Chain("Transaction rollbacked"));
+ break;
+ }
+ case CegoDbHandler::GETTID:
+ {
+ _lastAction = Chain("get tid");
+ Chain tableSet;
+ pSH->getArgValue(XML_TABLESET_ATTR, tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ pSH->sendTID(_pTabMng->getTID(tabSetId));
+ break;
+ }
+ case CegoDbHandler::SESSION_CLOSE:
+ {
+ isTerminated=true;
+ pSH->sendResponse(Chain("Session Closed"));
+ break;
+ }
+ case CegoDbHandler::REQTIMEOUT:
+ case CegoDbHandler::UNKNOWN:
+ {
+ break;
+ }
+ }
+ }
+ catch ( Exception e)
+ {
+
+ Chain msg;
+ Chain module;
+ int line;
+
+ Chain exep;
+ while ( e.pop(module, line, msg) )
+ {
+ exep += Chain("\n\t") + module + Chain("(") + Chain(line) + Chain(") : ") + msg;
+ }
+
+ _pDBMng->log(_modId, Logger::LOGERR, Chain("Thread ") + Chain(_idx) + Chain(" : DB request failed : ") + exep);
+
+ if ( _pTabMng->isAborted() )
+ {
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Thread ") + Chain(_idx) + Chain(" : Abort catched, proceed with session"));
+ _pTabMng->proceed();
+ }
+
+ pSH->sendError(e.getBaseMsg());
+ }
+
+ return isTerminated;
+}
+
|
[-]
[+]
|
Added |
cego-2.15.5.tar.bz2/src/#CegoDistManager.cc#
^
|
@@ -0,0 +1,2593 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// CegoDistManager.cc
+// ------------------
+// Cego distributed table manager class implementation
+//
+// Design and Implementation by Bjoern Lemke
+//
+// (C)opyright 2000-2010 Bjoern Lemke
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+//
+// IMPLEMENTATION MODULE
+//
+// Class: CegoDistManager
+//
+// Description:
+//
+// Status: QG-2.6
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include "CegoDistManager.h"
+
+#include <lfc/Exception.h>
+#include <lfc/Host.h>
+
+#include "CegoIndexCursor.h"
+#include "CegoAction.h"
+#include "CegoXMLdef.h"
+#include "CegoTypeConverter.h"
+#include "CegoRecoveryManager.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+CegoDistManager::ActiveTSUser::ActiveTSUser()
+{
+}
+
+CegoDistManager::ActiveTSUser::ActiveTSUser(const Chain& tableSet)
+{
+ _tableSet = tableSet;
+}
+
+CegoDistManager::ActiveTSUser::ActiveTSUser (const Chain& tableSet, const Chain& userName, const Chain& passwd)
+{
+ _tableSet = tableSet;
+ _userName = userName;
+ _passwd = passwd;
+}
+
+CegoDistManager::ActiveTSUser::~ActiveTSUser()
+{
+}
+
+const Chain& CegoDistManager::ActiveTSUser::getUserName() const
+{
+ return _userName;
+}
+
+const Chain& CegoDistManager::ActiveTSUser::getPasswd() const
+{
+ return _passwd;
+}
+
+CegoDistManager::ActiveTSUser& CegoDistManager::ActiveTSUser::operator = (const ActiveTSUser& u)
+{
+ _tableSet = u._tableSet;
+ _userName = u._userName;
+ _passwd = u._passwd;
+ return (*this);
+}
+
+bool CegoDistManager::ActiveTSUser::operator == (const CegoDistManager::ActiveTSUser& u) const
+{
+ if ( _tableSet == u._tableSet)
+ return true;
+ return false;
+}
+
+CegoDistManager::CegoDistManager(CegoDatabaseManager *pDBMng) : CegoTableManager(pDBMng)
+{
+ _modId = pDBMng->getModId("CegoDistManager");
+ _authEnabled = true;
+}
+
+CegoDistManager::~CegoDistManager()
+{
+}
+
+void CegoDistManager::startDistTableSet(const Chain& tableSet, const Chain& secondary, bool cleanIt)
+{
+ startTableSet(tableSet, secondary, cleanIt);
+ registerObjects(tableSet);
+}
+
+void CegoDistManager::registerObjects(const Chain& tableSet)
+{
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ ListT<Chain> tabList;
+ getObjectList(tabSetId, CegoObject::TABLE, tabList);
+
+ Chain *pTableName = tabList.First();
+ while ( pTableName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Adding table ") + *pTableName + Chain(" to tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pTableName, CegoObject::TABLE);
+ pTableName = tabList.Next();
+ }
+
+ ListT<Chain> viewList;
+ getObjectList(tabSetId, CegoObject::VIEW, viewList);
+ Chain *pViewName = viewList.First();
+ while ( pViewName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Adding view ") + *pViewName + Chain(" to tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pViewName, CegoObject::VIEW);
+ pViewName = viewList.Next();
+ }
+
+ ListT<Chain> idxList;
+ getObjectList(tabSetId, CegoObject::INDEX, idxList);
+ Chain *pIdxName = idxList.First();
+ while ( pIdxName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Adding index ") + *pIdxName + Chain(" to tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pIdxName, CegoObject::INDEX);
+ pIdxName = idxList.Next();
+ }
+
+ ListT<Chain> procList;
+ getObjectList(tabSetId, CegoObject::PROCEDURE, procList);
+ Chain *pProcName = procList.First();
+ while ( pProcName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Adding procedure ") + *pProcName + Chain(" to tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pProcName, CegoObject::PROCEDURE);
+ pProcName = procList.Next();
+ }
+}
+
+
+void CegoDistManager::stopDistTableSet(const Chain& tableSet, bool archComplete)
+{
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ ListT<Chain> tabList;
+ getObjectList(tabSetId, CegoObject::TABLE, tabList);
+
+ Chain *pTableName = tabList.First();
+ while ( pTableName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Removing table ") + *pTableName + Chain(" from tableset ") + tableSet);
+#endif
+ _pDBMng->removeObject(tabSetId, *pTableName, CegoObject::TABLE);
+ pTableName = tabList.Next();
+ }
+
+ ListT<Chain> viewList;
+ getObjectList(tabSetId, CegoObject::VIEW, viewList);
+ Chain *pViewName = viewList.First();
+ while ( pViewName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Removing view ") + *pViewName + Chain(" from tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pViewName, CegoObject::VIEW);
+ pViewName = viewList.Next();
+ }
+
+ ListT<Chain> idxList;
+ getObjectList(tabSetId, CegoObject::INDEX, idxList);
+ Chain *pIdxName = idxList.First();
+ while ( pIdxName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Removing index ") + *pIdxName + Chain(" from tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pIdxName, CegoObject::INDEX);
+ pIdxName = idxList.Next();
+ }
+
+ ListT<Chain> procList;
+ getObjectList(tabSetId, CegoObject::PROCEDURE, procList);
+ Chain *pProcName = procList.First();
+ while ( pProcName )
+ {
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Removing procedure ") + *pProcName + Chain(" from tableset ") + tableSet);
+#endif
+ _pDBMng->addObject(tabSetId, *pProcName, CegoObject::PROCEDURE);
+ pProcName = procList.Next();
+ }
+
+ stopTableSet(tableSet, archComplete);
+}
+
+
+void CegoDistManager::startTableSet(const Chain& tableSet, const Chain& secondary, bool cleanIt)
+{
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Starting tableset ") + tableSet + Chain(" ..."));
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ initLock(tabSetId);
+ regDataFiles(tableSet, cleanIt);
+
+ Host h;
+
+ if ( secondary != h.getName() )
+ {
+ int logPort;
+ _pDBMng->getLogPort(logPort);
+
+ _pDBMng->allocateLogConnection(tabSetId, tableSet, secondary, logPort);
+ long cplsn = _pDBMng->getCommittedLSN(tableSet);
+
+ _pDBMng->setLSN(tabSetId, cplsn+1);
+ _pDBMng->startLog(tabSetId);
+ }
+ else
+ {
+
+ _pDBMng->setActiveLogFile(tableSet);
+
+ // get checkpoint lsn
+ long cplsn = _pDBMng->getCommittedLSN(tableSet);
+
+ // get max written lsn
+ long maxlsn = _pDBMng->getMaxLSN(tabSetId);
+
+ if ( cplsn == maxlsn || ( cplsn == 0 && maxlsn == 0 ) )
+ {
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Tableset ") + tableSet + Chain(" in sync at lsn=") + Chain(cplsn) + Chain(", no recovery required"));
+ finishOpenTransaction(tabSetId);
+ }
+ else if ( cplsn < maxlsn )
+ {
+ long minlsn = _pDBMng->getMinLSN(tabSetId);
+
+ if ( cplsn + 1 < minlsn )
+ {
+ throw Exception(EXLOC, Chain("Checkpoint lsn=") + Chain(cplsn) + Chain(" is too small ( minlsn=") + Chain(minlsn) + Chain(")"));
+ }
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Tableset ") + tableSet + Chain(" not in sync, recovery required"));
+
+ _pDBMng->setLSN(tabSetId, cplsn+1);
+
+ long lsn;
+ int ts = 0;
+
+ CegoRecoveryManager recoveryMng(this);
+ recoveryMng.recoverCurrentTransactionLog(tabSetId, 0, lsn, ts);
+
+ if ( lsn != maxlsn )
+ {
+ throw Exception(EXLOC, Chain("Incomplete recovery"));
+ }
+
+ finishOpenTransaction(tabSetId);
+
+ // set lsn to last lsn in log
+ maxlsn = writeCheckPoint(tableSet, true, false);
+
+ }
+ else
+ {
+ throw Exception(EXLOC, "Checkpoint lsn is too high ( maxlsn = " + Chain(maxlsn) + ", lsn=" + Chain(cplsn) + Chain(")"));
+ }
+
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Starting log for tableset ") + tableSet + Chain(" ..."));
+
+ _pDBMng->setLSN(tabSetId, maxlsn+1);
+ _pDBMng->startLog(tabSetId);
+
+ }
+
+ _pDBMng->setTableSetRunState(tableSet, XML_ONLINE_VALUE);
+ _pDBMng->setTableSetSyncState(tableSet, XML_SYNCHED_VALUE);
+
+}
+
+
+
+bool CegoDistManager::distObjectExists(const Chain& tableSet, const Chain& objName, CegoObject::ObjectType objType)
+{
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ if ( _pDBMng->objectExists(tabSetId, objName, objType) )
+ return true;
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ Chain msg;
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqObjectInfoOp(tabSetId, objName, objType);
+
+ _pDBMng->releaseSession(pSH);
+
+ if ( res == CegoDbHandler::DB_INFO )
+ return true;
+ }
+
+ return false;
+}
+
+void CegoDistManager::getDistObject(const Chain& tableSet, const Chain& objName, CegoObject::ObjectType type, CegoDecodableObject& oe)
+{
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, objName, type, CegoXMLSpace::READ, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + objName;
+ throw Exception(EXLOC, msg);
+ }
+
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Getting object ") + objName);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ getLocalObject(tabSetId, objName, type, oe);
+ oe.setLocal(true);
+ oe.setTableSet(tableSet);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ Chain msg;
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqObjectInfoOp(tabSetId, objName, type);
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ oe.putElement( pSH->getObjElement() );
+ oe.setLocal(false);
+ _pDBMng->releaseSession(pSH);
+
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+void CegoDistManager::getLocalObject(int tabSetId, const Chain& objName, CegoObject::ObjectType type, CegoDecodableObject& oe)
+{
+ getObject(tabSetId, objName, type, oe);
+}
+
+void CegoDistManager::dropDistObject(const Chain& objName, const Chain& tableSet, CegoObject::ObjectType type)
+{
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Dropping object ") + objName);
+#endif
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, objName, type, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + objName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ dropLocalObject(tabSetId, objName, type);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ Chain msg;
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqDropObjectOp(tableSet, objName, type);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+
+}
+
+void CegoDistManager::dropLocalObject(int tabSetId, const Chain& objName, CegoObject::ObjectType type)
+{
+
+ Chain tableName;
+ bool useIt = false;
+ CegoObject::ObjectType useType;
+
+ if ( type == CegoObject::INDEX
+ || type == CegoObject::UINDEX
+ || type == CegoObject::PINDEX )
+ {
+ CegoTableObject io;
+ getObject(tabSetId, objName, type, io);
+ tableName = io.getTabName();
+ useType=CegoObject::TABLE;
+ useIt = true;
+ }
+ else if ( type == CegoObject::TABLE )
+ {
+ tableName = objName;
+ useIt = true;
+ useType=type;
+ }
+ else if ( type == CegoObject::PROCEDURE
+ || type == CegoObject::VIEW
+ || type == CegoObject::FKEY
+ || type == CegoObject::CHECK
+ || type == CegoObject::RBSEG )
+ {
+ // no lock need via useObject
+ }
+
+ if ( useIt )
+ {
+ _pDBMng->useObject(tabSetId, tableName, useType, CegoDatabaseManager::EXCLUSIVE, _threadId);
+ }
+
+ ListT<CegoTableObject> idxList;
+ ListT<CegoKeyObject> keyList;
+ ListT<CegoCheckObject> checkList;
+
+ switch ( type )
+ {
+ case CegoObject::TABLE:
+ dropTable(tabSetId, objName, CegoObject::TABLE, idxList, keyList, checkList);
+ break;
+ case CegoObject::INDEX:
+ case CegoObject::UINDEX:
+ case CegoObject::PINDEX:
+ dropIndex(tabSetId, objName);
+ break;
+ case CegoObject::VIEW:
+ dropView(tabSetId, objName);
+ break;
+ case CegoObject::PROCEDURE:
+ dropProcedure(tabSetId, objName);
+ break;
+ case CegoObject::FKEY:
+ dropFKey(tabSetId, objName);
+ break;
+ case CegoObject::CHECK:
+ dropCheck(tabSetId, objName);
+ break;
+ case CegoObject::SYSTEM:
+ case CegoObject::RBSEG:
+ case CegoObject::JOIN:
+ case CegoObject::UNDEFINED:
+ throw Exception(EXLOC, "Invalid object type for drop");
+ }
+
+ CegoTableObject *pIO = idxList.First();
+ while ( pIO )
+ {
+ _pDBMng->removeObject(tabSetId, pIO->getName(), pIO->getType());
+ pIO = idxList.Next();
+ }
+
+ CegoKeyObject *pKO = keyList.First();
+ while ( pKO )
+ {
+ _pDBMng->removeObject(tabSetId, pKO->getName(), pKO->getType());
+ pKO = keyList.Next();
+ }
+
+ CegoCheckObject *pCO = checkList.First();
+ while ( pCO )
+ {
+ _pDBMng->removeObject(tabSetId, pCO->getName(), pCO->getType());
+ pCO = checkList.Next();
+ }
+
+ _pDBMng->removeObject(tabSetId, objName, type);
+
+ if ( tableName != objName && useIt )
+ _pDBMng->unuseObject(tabSetId, tableName, useType, CegoDatabaseManager::EXCLUSIVE);
+
+}
+
+void CegoDistManager::createDistDataTable(const Chain& tableSet, const Chain& tableName, CegoObject::ObjectType type, ListT<CegoField>& fldList, ListT<CegoField>& idxList, bool useColumnId)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Creating global table ") + tableName + Chain(" in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, tableName, type, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + tableName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ createLocalDataTable(tabSetId, tableName, CegoObject::TABLE, fldList, idxList, useColumnId);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+ res = pSH->reqCreateTableOp(tableSet, tableName, type, fldList, idxList);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+void CegoDistManager::createLocalDataTable(int tabSetId, const Chain& tableName, CegoObject::ObjectType type, ListT<CegoField>& fldList, ListT<CegoField>& idxList, bool useColumnId)
+{
+
+ createDataTable(tabSetId, tableName, type, fldList, useColumnId);
+
+ if ( ! idxList.isEmpty() )
+ {
+ Chain idxName = tableName + Chain(TABMNG_PIDX_SUFFIX);
+ createPrimaryIndexTable(tabSetId, idxName, tableName, idxList);
+ }
+
+ _pDBMng->addObject(tabSetId, tableName, CegoObject::TABLE);
+
+ if ( ! idxList.isEmpty() )
+ {
+ Chain idxName = tableName + Chain(TABMNG_PIDX_SUFFIX);
+ _pDBMng->addObject(tabSetId, idxName, CegoObject::INDEX);
+ }
+
+}
+
+void CegoDistManager::createDistIndexTable( const Chain& tableSet, const Chain& indexName, const Chain& tableName, ListT<CegoField>& idxList, CegoObject::ObjectType type)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Creating global index ") + indexName + Chain(" in tableset ") + tableSet);
+#endif
+
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, indexName, CegoObject::INDEX, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for index ") + indexName;
+ throw Exception(EXLOC, msg);
+ }
+
+
+ Chain hostName =_pDBMng->getPrimary(tableSet);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ createLocalIndexTable(tabSetId, indexName, tableName, type, idxList);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqCreateIndexOp(tableSet, indexName, tableName, type, idxList);
+ _pDBMng->releaseSession(pSH);
+ }
+}
+
+void CegoDistManager::createLocalIndexTable(int tabSetId, const Chain& indexName, const Chain& tableName, CegoObject::ObjectType type, ListT<CegoField>& idxList)
+{
+ _pDBMng->useObject(tabSetId, tableName, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE, _threadId);
+
+ try {
+ createIndexTable(tabSetId, indexName, tableName, idxList, type);
+ }
+ catch ( Exception e )
+ {
+ _pDBMng->unuseObject(tabSetId, tableName, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+ throw Exception(e);
+ }
+ _pDBMng->unuseObject(tabSetId, tableName, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+
+ _pDBMng->addObject(tabSetId, indexName, type);
+
+}
+
+void CegoDistManager::createDistForeignKey( const Chain& tableSet, const Chain& fkey, const Chain& tableName, const ListT<CegoField>& keyList, const Chain& refTable, const ListT<CegoField>& refList)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Creating global foreign key ") + fkey + Chain(" in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, tableName, CegoObject::TABLE, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + tableName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Host h;
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ createLocalForeignKey(tabSetId, fkey, tableName, keyList, refTable, refList);
+ }
+ else
+ {
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqCreateFKeyOp(tabSetId, fkey, tableName, keyList, refTable, refList);
+ _pDBMng->releaseSession(pSH);
+ }
+
+}
+
+void CegoDistManager::createLocalForeignKey(int tabSetId, const Chain& fkey, const Chain& tableName, const ListT<CegoField>& keyList, const Chain& refTable, const ListT<CegoField>& refList)
+{
+ createForeignKey(tabSetId, fkey, tableName, keyList, refTable, refList);
+
+ _pDBMng->addObject(tabSetId, fkey, CegoObject::FKEY);
+}
+
+void CegoDistManager::createDistCheck( const Chain& tableSet, const Chain& checkName, const Chain& tableName, CegoPredDesc *pPredDesc)
+{
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Creating global check ") + checkName + Chain(" in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, tableName, CegoObject::TABLE, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + tableName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Host h;
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ createLocalCheck(tabSetId, checkName, tableName, pPredDesc);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqCreateCheckOp(tableSet, checkName, tableName, pPredDesc);
+ _pDBMng->releaseSession(pSH);
+ }
+}
+
+void CegoDistManager::createLocalCheck(int tabSetId, const Chain& checkName, const Chain& tableName, CegoPredDesc *pPredDesc)
+{
+ createCheck(tabSetId, checkName, tableName, pPredDesc);
+ _pDBMng->addObject(tabSetId, checkName, CegoObject::CHECK);
+}
+
+void CegoDistManager::reorgDistObject(const Chain& tableSet, const Chain& objName, CegoObject::ObjectType type)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Reorg global object ") + objName + Chain(" in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, objName, type, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + objName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+
+ _pDBMng->useObject(tabSetId, objName, type, CegoDatabaseManager::EXCLUSIVE_WRITE, _threadId);
+
+ try {
+
+ reorgObject(tabSetId, objName, type);
+
+ }
+ catch ( Exception e )
+ {
+ _pDBMng->unuseObject(tabSetId, objName, type, CegoDatabaseManager::EXCLUSIVE_WRITE);
+ }
+
+ _pDBMng->unuseObject(tabSetId, objName, type, CegoDatabaseManager::EXCLUSIVE_WRITE);
+
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+ res = pSH->reqReorgObjectOp(tableSet, objName, type);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+
+void CegoDistManager::startDistTransaction( const Chain& tableSet)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Starting global transaction in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Host h;
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ beginTransaction(tabSetId);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+ res = pSH->reqStartTransactionOp(tableSet);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+long CegoDistManager::endDistTransaction( const Chain& tableSet)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Ending global transaction in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Host h;
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+
+ long numCommitOp=0;
+
+ SetT<Chain> tableList;
+
+ getTransactionAffectedTables(tabSetId, tableList);
+
+ Chain *pTable;
+
+ pTable = tableList.First();
+ while ( pTable )
+ {
+
+ _pDBMng->useObject(tabSetId, *pTable, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE, _threadId);
+ pTable = tableList.Next();
+ }
+
+ try {
+
+ numCommitOp = commitTransaction(tabSetId);
+ }
+ catch ( Exception e )
+ {
+ pTable = tableList.First();
+ while ( pTable )
+ {
+ _pDBMng->unuseObject(tabSetId, *pTable, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
+ pTable = tableList.Next();
+ }
+ }
+ pTable = tableList.First();
+ while ( pTable )
+ {
+ _pDBMng->unuseObject(tabSetId, *pTable, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
+ pTable = tableList.Next();
+ }
+
+ return numCommitOp;
+
+ }
+ else
+ {
+
+
+ Chain user;
+ Chain password;
+
+ long numCommitOp=0;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+ res = pSH->reqCommitTransactionOp(tableSet);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+
+ // TODO : numCommitOp still not set up for distributed queries
+ return numCommitOp;
+ }
+}
+
+long CegoDistManager::rollbackDistTransaction(const Chain& tableSet)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Rollbacking global transaction in tableset ") + tableSet);
+#endif
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Host h;
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+
+ long numRollbackOp=0;
+
+ SetT<Chain> tableList;
+ getTransactionAffectedTables(tabSetId, tableList);
+
+ Chain *pTable;
+
+ pTable = tableList.First();
+ while ( pTable )
+ {
+
+ _pDBMng->useObject(tabSetId, *pTable, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE, _threadId);
+ pTable = tableList.Next();
+ }
+
+ try {
+
+ numRollbackOp = rollbackTransaction(tabSetId);
+ }
+ catch ( Exception e )
+ {
+ pTable = tableList.First();
+ while ( pTable )
+ {
+ _pDBMng->unuseObject(tabSetId, *pTable, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
+ pTable = tableList.Next();
+ }
+ }
+ pTable = tableList.First();
+ while ( pTable )
+ {
+ _pDBMng->unuseObject(tabSetId, *pTable, CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
+ pTable = tableList.Next();
+ }
+
+ return numRollbackOp;
+
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ long numRollbackOp=0;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+ res = pSH->reqRollbackTransactionOp(tableSet);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+
+ // TODO : numRollbackOp still not set up for distributed queries
+ return numRollbackOp;
+
+ }
+}
+
+int CegoDistManager::getDistTid( const Chain& tableSet)
+{
+
+
+ Chain hostName = _pDBMng->getPrimary(tableSet);
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Host h;
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ return getLocalTid(tabSetId);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ Chain msg;
+ CegoDbHandler::ResultType res;
+
+ int tid = 0;
+ res = pSH->reqGetTidOp(tableSet);
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ Chain tidString;
+ pSH->getArgValue(XML_TID_ATTR, tidString);
+
+ tid = tidString.asInteger();
+
+ _pDBMng->releaseSession(pSH);
+
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+
+ return tid;
+ }
+}
+
+int CegoDistManager::getLocalTid(int tabSetId)
+{
+ return getTID(tabSetId);
+}
+
+void CegoDistManager::setThreadId(long tid)
+{
+ _threadId = tid;
+}
+
+long CegoDistManager::getThreadId() const
+{
+ return _threadId;
+}
+
+void CegoDistManager::insertDistDataTable(CegoTableObject& oe, ListT<CegoField>& fvl)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Inserting into global table ") + oe.getName());
+#endif
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(oe.getTabSetId(), oe.getName(), oe.getType(), CegoXMLSpace::WRITE, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + oe.getName();
+ throw Exception(EXLOC, msg);
+ }
+
+
+ Chain hostName = _pDBMng->getPrimary(oe.getTabSetId());
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ insertLocalDataTable(oe, fvl);
+ }
+ else
+ {
+
+ Chain tableSet = _pDBMng->getTabSetName(oe.getTabSetId());
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ Chain msg;
+ CegoDbHandler::ResultType res;
+ res = pSH->reqInsertOp(tableSet, oe.getName(), fvl);
+
+ if ( res == CegoDbHandler::DB_OK )
+ {
+ _pDBMng->releaseSession(pSH);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+void CegoDistManager::insertLocalDataTable(CegoTableObject& oe, ListT<CegoField>& fvl)
+{
+ _pDBMng->useObject(oe.getTabSetId(), oe.getName(), oe.getType(), CegoDatabaseManager::EXCLUSIVE_WRITE, _threadId);
+
+ try {
+
+ CegoDataPointer dp;
+ insertDataTable(oe, fvl, dp, true);
+ }
+ catch ( Exception e )
+ {
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getName(), oe.getType(), CegoDatabaseManager::EXCLUSIVE_WRITE);
+ throw Exception(EXLOC, "Cannot insert local row", e);
+ }
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getName(), oe.getType(), CegoDatabaseManager::EXCLUSIVE_WRITE);
+}
+
+long CegoDistManager::deleteDistDataTable(CegoTableObject& oe, CegoPredDesc* pPred, CegoProcBlock* pBlock)
+{
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Deleting from global table ") + oe.getName());
+#endif
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(oe.getTabSetId(), oe.getName(), oe.getType(), CegoXMLSpace::WRITE, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + oe.getName();
+ throw Exception(EXLOC, msg);
+ }
+
+
+ Chain hostName = _pDBMng->getPrimary(oe.getTabSetId());
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ return deleteLocalDataTable(oe, pPred, pBlock);
+ }
+ else
+ {
+
+ Chain tableSet = _pDBMng->getTabSetName(oe.getTabSetId());
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqDeleteOp(tableSet, oe.getName(), pPred);
+ long delCount = pSH->getAffected();
+ _pDBMng->releaseSession(pSH);
+
+ return delCount;
+ }
+}
+
+long CegoDistManager::deleteLocalDataTable(CegoTableObject& oe, CegoPredDesc* pPred, CegoProcBlock* pBlock)
+{
+ long delCount = 0;
+
+ _pDBMng->useObject(oe.getTabSetId(), oe.getName(), oe.getType(), CegoDatabaseManager::EXCLUSIVE_WRITE, _threadId);
+
+ try {
+
+ delCount = deleteDataTable(oe, pPred, pBlock);
+ }
+ catch ( Exception e)
+ {
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+ throw Exception(EXLOC, "Cannot delete local row", e);
+ }
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+
+ return delCount;
+}
+
+long CegoDistManager::updateDistDataTable(CegoTableObject& oe,
+ CegoPredDesc* pPred,
+ ListT<CegoField>& updSchema,
+ ListT<CegoExpr*>& exprList,
+ CegoProcBlock* pBlock)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Updating global table ") + oe.getName());
+#endif
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(oe.getTabSetId(), oe.getName(), oe.getType(), CegoXMLSpace::WRITE, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + oe.getName();
+ throw Exception(EXLOC, msg);
+ }
+
+ Chain hostName = _pDBMng->getPrimary(oe.getTabSetId());
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ return updateLocalDataTable(oe, pPred, updSchema, exprList, pBlock);
+ }
+ else
+ {
+ Chain tableSet = _pDBMng->getTabSetName(oe.getTabSetId());
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqUpdateOp(tableSet, oe.getName(), updSchema, exprList, pPred);
+ long updCount = pSH->getAffected();
+ _pDBMng->releaseSession(pSH);
+
+ return updCount;
+ }
+}
+
+long CegoDistManager::updateLocalDataTable(CegoTableObject& oe, CegoPredDesc* pPred, ListT<CegoField>& updSchema, ListT<CegoExpr*>& exprList, CegoProcBlock* pBlock)
+{
+
+ long updCount = 0;
+ bool forceTransaction=false;
+ if ( getTID(oe.getTabSetId()) == 0 )
+ {
+ forceTransaction=true;
+ beginTransaction(oe.getTabSetId());
+ }
+
+ _pDBMng->useObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE, _threadId);
+
+ try {
+
+ updCount = updateDataTable(oe.getTabSetId(), oe.getTabName(), oe.getTabAlias(), pPred, updSchema, exprList, pBlock);
+
+ }
+ catch ( Exception e )
+ {
+
+ Chain msg;
+ Chain module;
+ int line;
+
+ Chain exep;
+ while ( e.pop(module, line, msg) )
+ {
+ exep += Chain("\n\t") + module + Chain("(") + Chain(line) + Chain(") : ") + msg;
+ }
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Update for ") + oe.getTabName() + Chain(" failed, rolling back, reason was ") + exep);
+
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+
+ if ( forceTransaction )
+ {
+ _pDBMng->useObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE, _threadId);
+
+ try
+ {
+ rollbackTransaction(oe.getTabSetId());
+ }
+ catch ( Exception e )
+ {
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+ throw Exception(EXLOC, "Cannot update local row", e);
+ }
+ }
+
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+ throw Exception(EXLOC, "Cannot update local row", e);
+
+ }
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE_WRITE);
+
+ if ( forceTransaction )
+ {
+
+ _pDBMng->useObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE, _threadId);
+
+ try
+ {
+ commitTransaction(oe.getTabSetId());
+ }
+ catch ( Exception e )
+ {
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
+ throw Exception(EXLOC, "Cannot update table", e);
+ }
+
+ _pDBMng->unuseObject(oe.getTabSetId(), oe.getTabName(), CegoObject::TABLE, CegoDatabaseManager::EXCLUSIVE);
+
+ }
+
+ return updCount;
+}
+
+
+void CegoDistManager::alterDistDataTable(CegoTableObject& oe, const ListT<CegoAlterDesc>& alterList)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Altering global table ") + oe.getName());
+#endif
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(oe.getTabSetId(), oe.getName(), oe.getType(), CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + oe.getName();
+ throw Exception(EXLOC, msg);
+ }
+
+
+ Chain hostName = _pDBMng->getPrimary(oe.getTabSetId());
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ alterDataTable(oe.getTabSetId(), oe.getName(), CegoObject::TABLE, alterList);
+ }
+ else
+ {
+
+ Chain tableSet = _pDBMng->getTabSetName(oe.getTabSetId());
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqAlterTableOp(tableSet, oe.getName(), alterList);
+ _pDBMng->releaseSession(pSH);
+ }
+}
+
+void CegoDistManager::renameDistObject(const Chain& tableSet, const Chain& objName, CegoObject::ObjectType type, const Chain& newObjName)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Renaming global table ") + objName);
+#endif
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, objName, type, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + objName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ renameLocalObject(tabSetId, objName, type, newObjName);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqRenameOp(tableSet, objName, type, newObjName);
+ _pDBMng->releaseSession(pSH);
+
+ }
+}
+
+void CegoDistManager::renameLocalObject(int tabSetId, const Chain& objName, CegoObject::ObjectType type, const Chain& newObjName)
+{
+ _pDBMng->removeObject(tabSetId, objName, type);
+ renameObject(tabSetId, objName, type, newObjName);
+ _pDBMng->addObject(tabSetId, newObjName, type);
+}
+
+void CegoDistManager::createDistView(const Chain& tableSet, const Chain& viewName, const ListT<CegoField>& schema, const Chain& viewText)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Creating global view ") + viewName + Chain(" in tableset ") + tableSet);
+#endif
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, viewName, CegoObject::VIEW, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + viewName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Chain hostName =_pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ createLocalView(tabSetId, viewName, schema, viewText);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqCreateViewOp(tableSet, viewName, schema, viewText);
+ _pDBMng->releaseSession(pSH);
+ }
+}
+
+void CegoDistManager::createLocalView( int tabSetId, const Chain& viewName, const ListT<CegoField>& schema, const Chain& viewText)
+{
+ CegoViewObject vo( tabSetId, viewName, schema, viewText);
+
+ createViewObject(vo);
+
+ // create log entry
+ CegoLogRecord lr;
+ lr.setObjectInfo(vo.getName(), vo.getType());
+ lr.setAction(CegoLogRecord::LOGREC_CREATE);
+
+ char *buf;
+ buf = (char*)malloc(vo.getEntrySize());
+ vo.encode(buf);
+ lr.setData(buf);
+ lr.setDataLen(vo.getEntrySize());
+ // lr.setTID(0);
+ logIt(vo.getTabSetId(), lr);
+ free(buf);
+
+ _pDBMng->addObject(tabSetId, viewName, CegoObject::VIEW);
+
+}
+
+void CegoDistManager::createDistProc(const Chain& tableSet, const Chain& procName, const Chain& procText)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Creating global procedure ") + procName + Chain(" in tableset ") + tableSet);
+#endif
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ if ( _authEnabled == true && _pDBMng->verifyAccess(tabSetId, procName, CegoObject::PROCEDURE, CegoXMLSpace::MODIFY, _authUser) == false )
+ {
+ Chain msg = Chain("Access not allowed for object ") + procName;
+ throw Exception(EXLOC, msg);
+ }
+
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ createLocalProc(tabSetId, procName, procText);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqCreateProcOp(tableSet, procName, procText);
+ _pDBMng->releaseSession(pSH);
+ }
+}
+
+void CegoDistManager::createLocalProc(int tabSetId, const Chain& procName, const Chain& procText)
+{
+ CegoProcObject po(tabSetId, procName, procText);
+
+ createProcObject(po);
+
+ // create log entry
+ CegoLogRecord lr;
+ lr.setObjectInfo(po.getName(), po.getType());
+ lr.setAction(CegoLogRecord::LOGREC_CREATE);
+
+ char *buf;
+ buf = (char*)malloc(po.getEntrySize());
+ po.encode(buf);
+ lr.setData(buf);
+ lr.setDataLen(po.getEntrySize());
+ // lr.setTID(0);
+ logIt(po.getTabSetId(), lr);
+ free(buf);
+
+ _pDBMng->addObject(tabSetId,procName, CegoObject::PROCEDURE);
+
+}
+
+void CegoDistManager::getDistObjectList(const Chain& tableSet, CegoObject::ObjectType type, ListT<Chain> &objList)
+{
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Getting global object list in tableset ") + tableSet);
+#endif
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ getLocalObjectList(tabSetId, type, objList);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqGetObjectListOp(tabSetId, type);
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ pSH->getObjectList(objList);
+ _pDBMng->releaseSession(pSH);
+
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+void CegoDistManager::getLocalObjectList(int tabSetId, CegoObject::ObjectType type, ListT<Chain> &objList)
+{
+ getObjectList(tabSetId, type, objList);
+}
+
+void CegoDistManager::getDistObjectByTableList(const Chain& tableSet, const Chain& tabName, ListT<CegoTableObject>& idxList, ListT<CegoKeyObject>& keyList, ListT<CegoCheckObject>& checkList, bool ignoreInvalid)
+{
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Getting global object list by table ") + tabName + Chain(" in tableset ") + tableSet);
+#endif
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ getLocalObjectByTableList(tabSetId, tabName, idxList, keyList, checkList, ignoreInvalid);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqGetObjectByTableListOp(tableSet, tabName);
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ pSH->getObjectByTableList(idxList, keyList, checkList);
+ _pDBMng->releaseSession(pSH);
+
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ }
+}
+
+int CegoDistManager::getDistPageCount(const Chain& tableSet, const Chain& tabName, CegoObject::ObjectType type)
+{
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ return getLocalPageCount(tabSetId, tabName, type);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqGetPageCount(tableSet, tabName, type);
+
+ int pageCount = 0;
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ pSH->getPageCount(pageCount);
+ _pDBMng->releaseSession(pSH);
+
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+
+ return pageCount;
+
+ }
+}
+
+int CegoDistManager::getLocalPageCount(int tabSetId, const Chain& tabName, CegoObject::ObjectType type)
+{
+ return getPageCount(tabSetId, tabName, type);
+}
+
+void CegoDistManager::getLocalObjectByTableList(int tabSetId, const Chain& tabName, ListT<CegoTableObject>& idxList, ListT<CegoKeyObject>& keyList, ListT<CegoCheckObject>& checkList, bool ignoreInvalid)
+{
+ getObjectListByTable(tabSetId, tabName, idxList, keyList, checkList, ignoreInvalid);
+}
+
+CegoAttrCond::IndexMatch CegoDistManager::distIndexExists(int tabSetId, const Chain& tableName, CegoAttrCond& ac)
+{
+ ListT<CegoTableObject> idxList;
+ ListT<CegoKeyObject> keyList;
+ ListT<CegoCheckObject> checkList;
+
+ Host h;
+
+ Chain hostName = _pDBMng->getPrimary(tabSetId);
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ getObjectListByTable(tabSetId, tableName, idxList, keyList, checkList);
+
+ CegoAttrCond::IndexMatch idxMatch = CegoAttrCond::INAPP;
+
+ CegoTableObject *pIO = idxList.First();
+ while ( pIO )
+ {
+ CegoTableObject idx;
+
+ getObject(tabSetId, pIO->getName(), pIO->getType(), idx);
+
+ CegoAttrCond::IndexMatch nextMatch = ac.checkIndex(idx.getSchema());
+
+ if ( nextMatch == CegoAttrCond::FULL )
+ return nextMatch;
+ if ( idxMatch == CegoAttrCond::INAPP && nextMatch == CegoAttrCond::PART )
+ idxMatch = CegoAttrCond::PART;
+
+ pIO = idxList.Next();
+ }
+ return idxMatch;
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ Chain tableSet = _pDBMng->getTabSetName(tabSetId);
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ CegoDbHandler::ResultType res;
+
+ res = pSH->reqGetObjectByTableListOp(tableSet, tableName);
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ pSH->getObjectByTableList(idxList, keyList, checkList);
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+
+ CegoAttrCond::IndexMatch idxMatch = CegoAttrCond::INAPP;
+
+ CegoTableObject *pIO = idxList.First();
+ while ( pIO )
+ {
+ CegoTableObject idx;
+
+ res = pSH->reqObjectInfoOp(tabSetId, pIO->getName(), pIO->getType());
+
+ if ( res == CegoDbHandler::DB_INFO )
+ {
+ idx.putElement( pSH->getObjElement() );
+ idx.setLocal(false);
+
+
+ CegoAttrCond::IndexMatch nextMatch = ac.checkIndex(idx.getSchema());
+
+ if ( nextMatch == CegoAttrCond::FULL )
+ {
+ _pDBMng->releaseSession(pSH);
+ return nextMatch;
+ }
+ if ( idxMatch == CegoAttrCond::INAPP && nextMatch == CegoAttrCond::PART )
+ idxMatch = CegoAttrCond::PART;
+
+ }
+ else if ( res == CegoDbHandler::DB_ERROR )
+ {
+ Chain msg = pSH->getMsg();
+ _pDBMng->releaseSession(pSH);
+ throw Exception(EXLOC, msg);
+ }
+ pIO = idxList.Next();
+ }
+ _pDBMng->releaseSession(pSH);
+ return idxMatch;
+ }
+}
+
+CegoLockHandler* CegoDistManager::getLockHandle()
+{
+ return _pLockHandle;
+}
+
+void CegoDistManager::syncDistTableSet(const Chain& tableSet, const Chain& msg, const Chain& escCmd, int timeout)
+{
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ Chain hostName =_pDBMng->getPrimary(tabSetId);
+ Host h;
+
+ if ( hostName.toUpper() == h.getName().toUpper() )
+ {
+ syncTableSet(tableSet, msg, escCmd, timeout);
+ }
+ else
+ {
+
+ Chain user;
+ Chain password;
+
+ getActiveUser(tableSet, user, password);
+
+ CegoDistDbHandler *pSH = _pDBMng->allocateSession(hostName, tableSet, user, password);
+
+ pSH->reqSyncOp(tableSet, escCmd, timeout);
+ _pDBMng->releaseSession(pSH);
+
+ }
+}
+
+void CegoDistManager::enableAuth()
+{
+ _authEnabled = true;
+}
+
+void CegoDistManager::disableAuth()
+{
+ _authEnabled = false;
+}
+
+void CegoDistManager::setActiveUser(const Chain& tableSet, const Chain& user, const Chain& passwd)
+{
+ _authUser = user;
+
+ if ( _userList.Find(ActiveTSUser(tableSet)) == 0 )
+ _userList.Insert( ActiveTSUser(tableSet, user, passwd));
+}
+
+const Chain& CegoDistManager::getUser() const
+{
+ return _authUser;
+}
+
+void CegoDistManager::getActiveUser(const Chain& tableSet, Chain& user, Chain& passwd)
+{
+
+ ActiveTSUser *pTSA = _userList.Find( ActiveTSUser(tableSet));
+ if ( pTSA )
+ {
+ user = pTSA->getUserName();
+ passwd = pTSA->getPasswd();
+ return;
+ }
+
+ Chain msg = Chain("No active user for tableset <") + tableSet + Chain(">");
+ throw Exception(EXLOC, msg);
+
+}
+
+Element* CegoDistManager::verifyTable(const Chain& tableSet, const Chain& tableName)
+{
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Verifying table ") + tableName + Chain(" ..."));
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Element *pVerification = new Element(XML_VERIFICATION_ELEMENT);
+
+ int errorCount = 0;
+
+ ListT<CegoTableObject> idxList;
+ ListT<CegoKeyObject> keyList;
+ ListT<CegoCheckObject> checkList;
+
+ getObjectListByTable(tabSetId, tableName, idxList, keyList, checkList, false);
+
+ CegoTableObject oe;
+ getObject(tabSetId, tableName, CegoObject::TABLE, oe);
+
+ CegoTableCursor tc(this, tabSetId, tableName);
+ ListT<CegoField> fl = oe.getSchema();
+ CegoDataPointer dp;
+ long tabCount = 0;
+
+ if ( tc.getFirst(fl, dp) )
+ {
+ tabCount++;
+ while ( tc.getNext(fl, dp) )
+ {
+ tabCount++;
+ }
+ }
+
+ // verify keys
+ bool keyCheck = true;
+ CegoKeyObject *pKey = keyList.First();
+ while ( pKey )
+ {
+ checkKey(pKey);
+ pKey = keyList.Next();
+ }
+
+
+ if ( keyCheck == false )
+ {
+ errorCount++;
+ Chain tableStatus = Chain("Key constraint violation");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pVerification->addContent(pTableCheck);
+ }
+
+ // verify indexes
+ CegoTableObject *pIdx = idxList.First();
+ while ( pIdx )
+ {
+
+ if ( pIdx->isValid() )
+ {
+ CegoIndexManager idxMng(this, pIdx->getType());
+ char c = idxMng.checkIndex(tabSetId, pIdx->getName(), pIdx->getType());
+
+ if ( c < 0 )
+ {
+ errorCount++;
+ Chain tableStatus = Chain("Index ") + pIdx->getName() + Chain(" due to height corrupted ");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pVerification->addContent(pTableCheck);
+ }
+
+ CegoIndexCursor ic(this, tabSetId, pIdx->getName(), pIdx->getType(), 0, false, false);
+
+ ListT<CegoField> fl = oe.getSchema();
+ CegoDataPointer dp;
+ long idxCount = 0;
+ if ( ic.getFirst(fl, dp) )
+ {
+ idxCount++;
+ while ( ic.getNext(fl, dp) )
+ idxCount++;
+ }
+ if ( tabCount != idxCount )
+ {
+ errorCount++;
+ Chain tableStatus = Chain("Index ") + pIdx->getName() + Chain(" due to row count corrupted");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pVerification->addContent(pTableCheck);
+ }
+ }
+ else
+ {
+ errorCount++;
+ Chain tableStatus = Chain("Index ") + pIdx->getName() + Chain(" not valid");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pVerification->addContent(pTableCheck);
+ }
+
+ pIdx = idxList.Next();
+ }
+
+ if ( errorCount == 0 )
+ {
+ Chain tableStatus("ok");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pVerification->addContent(pTableCheck);
+ }
+
+ return pVerification;
+
+}
+
+
+Element* CegoDistManager::verifyView(const Chain& tableSet, const Chain& viewName)
+{
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ Element *pVerification = new Element(XML_VERIFICATION_ELEMENT);
+
+ CegoViewObject vo;
+ getObject(tabSetId, viewName, CegoObject::VIEW, vo);
+
+ Chain loadString = Chain("load ") + vo.getViewStmt();
+
+ CegoAction *pPA = new CegoAction(this);
+ pPA->setTableSet(tableSet);
+ pPA->setCommandChain(loadString);
+ pPA->parse();
+
+ delete pPA;
+
+ Chain viewStatus("ok");
+ Element *pViewCheck = new Element(XML_CHECK_ELEMENT);
+ pViewCheck->setAttribute(XML_TYPE_ATTR, Chain("View"));
+ pViewCheck->setAttribute(XML_NAME_ATTR, viewName);
+ pViewCheck->setAttribute(XML_VALUE_ATTR, viewStatus);
+ pVerification->addContent(pViewCheck);
+
+ return pVerification;
+
+}
+
+Element* CegoDistManager::verifyProcedure(const Chain& tableSet, const Chain& procName)
+{
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+ Element *pVerification = new Element(XML_VERIFICATION_ELEMENT);
+
+ CegoProcObject po;
+ getObject(tabSetId, procName, CegoObject::PROCEDURE, po);
+
+ Chain loadString = Chain("load ") + po.getProcText();
+
+ CegoAction *pPA = new CegoAction(this);
+ pPA->setTableSet(tableSet);
+ pPA->setCommandChain(loadString);
+ pPA->parse();
+
+ delete pPA;
+
+ Chain procStatus("ok");
+ Element *pProcCheck = new Element(XML_CHECK_ELEMENT);
+ pProcCheck->setAttribute(XML_TYPE_ATTR, Chain("Procedure"));
+ pProcCheck->setAttribute(XML_NAME_ATTR, procName);
+ pProcCheck->setAttribute(XML_VALUE_ATTR, procStatus);
+ pVerification->addContent(pProcCheck);
+
+ return pVerification;
+}
+
+Element* CegoDistManager::correctTable(const Chain& tableSet, const Chain& tableName)
+{
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Correcting table ") + tableName + Chain(" ..."));
+
+ int tabSetId = _pDBMng->getTabSetId(tableSet);
+
+ Element *pCorrection = new Element(XML_CORRECTION_ELEMENT);
+
+ int errorCount = 0;
+
+ ListT<CegoTableObject> idxList;
+ ListT<CegoKeyObject> keyList;
+ ListT<CegoCheckObject> checkList;
+
+ getObjectListByTable(tabSetId, tableName, idxList, keyList, checkList, false);
+
+ CegoTableObject oe;
+ getObject(tabSetId, tableName, CegoObject::TABLE, oe);
+
+ CegoTableCursor tc(this, tabSetId, tableName);
+ ListT<CegoField> fl = oe.getSchema();
+ CegoDataPointer dp;
+ long tabCount = 0;
+
+ if ( tc.getFirst(fl, dp) )
+ {
+ tabCount++;
+ while ( tc.getNext(fl, dp) )
+ {
+ tabCount++;
+ }
+ }
+
+
+ // correct indexes
+ CegoTableObject *pIdx = idxList.First();
+ while ( pIdx )
+ {
+
+ if ( pIdx->isValid() == false )
+ {
+ errorCount++;
+
+ dropIndex(tabSetId, pIdx->getName());
+ createIndexTable(tabSetId, pIdx->getName(), pIdx->getTabName(), pIdx->getSchema(), pIdx->getType());
+
+ Chain tableStatus = Chain("Index ") + pIdx->getName() + Chain(" was corrected");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pCorrection->addContent(pTableCheck);
+ }
+
+ pIdx = idxList.Next();
+ }
+
+ if ( errorCount == 0 )
+ {
+ Chain tableStatus("ok");
+ Element *pTableCheck = new Element(XML_CHECK_ELEMENT);
+ pTableCheck->setAttribute(XML_TYPE_ATTR, Chain("Table"));
+ pTableCheck->setAttribute(XML_NAME_ATTR, tableName);
+ pTableCheck->setAttribute(XML_VALUE_ATTR, tableStatus);
+ pCorrection->addContent(pTableCheck);
+ }
+
+ return pCorrection;
+
+}
+
+
+bool CegoDistManager::checkKey(CegoKeyObject *pKey)
+{
+
+ CegoField *pRF = pKey->getKeySchema().First();
+ if ( pRF )
+ {
+
+ CegoTableCursor rtc(this, pKey->getTabSetId(), pKey->getTabName());
+
+ ListT<CegoField> rfl = pKey->getKeySchema();
+
+ CegoDataPointer rdp;
+
+ bool moreRefTuple = rtc.getFirst(rfl, rdp);
+
+ while ( moreRefTuple )
+ {
+
+ CegoTableCursor tc(this, pKey->getTabSetId(), pKey->getRefTable());
+
+ CegoField *pF = rfl.First();
+ if ( pF )
+ {
+
+ CegoAttrCond ac;
+ ac.add(CegoAttrComp(pF->getAttrName(), EQUAL, pF->getValue()));
+
+ ListT<CegoField> fl;
+
+ if ( tc.setup(ac) == false )
+ {
+ CegoTableObject oe;
+ getObject(pKey->getTabSetId(), pKey->getTabName(), CegoObject::TABLE, oe);
+ fl = oe.getSchema();
+ }
+ else
+ {
+ tc.getIdxSchema(fl);
+ }
+
+
+ CegoDataPointer dp;
+ bool moreTuple = tc.getFirst(fl, dp);
+ while ( moreTuple )
+ {
+ bool isMatch;
+ CegoField *pCF = fl.First();
+ while ( pCF )
+ {
+ isMatch = true;
+ CegoField *pD = rfl.Find(*pCF);
+ if ( pD )
+ {
+ if ( (CegoFieldValue)pD->getValue() != (CegoFieldValue)pCF->getValue() )
+ {
+ isMatch=false;
+ }
+ }
+ pCF = fl.Next();
+ }
+ }
+ }
+ moreRefTuple = rtc.getNext(rfl, rdp);
+ }
+ }
+ return true;
+}
+
+void CegoDistManager::getObjectDesc(const Chain& tableSet, const Chain& objName, CegoObject::ObjectType type,
+ ListT<CegoField>& schema, ListT< ListT<CegoFieldValue> > &fa)
+{
+
+ switch ( type )
+ {
+ case CegoObject::SYSTEM:
+ case CegoObject::TABLE:
+ {
+ CegoTableObject to;
+ getDistObject(tableSet, objName, type, to);
+
+ int maxAttrLen=10;
+ CegoField *pF = to.getSchema().First();
+ while ( pF )
+ {
+ if ( pF->getAttrName().length() > maxAttrLen )
+ maxAttrLen = pF->getAttrName().length();
+ pF = to.getSchema().Next();
+ }
+
+ schema.Insert(CegoField(Chain("TABLEDESC"), Chain("TABLEDESC"), Chain("ATTR"), VARCHAR_TYPE, maxAttrLen));
+ schema.Insert(CegoField(Chain("TABLEDESC"), Chain("TABLEDESC"), Chain("TYPE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("TABLEDESC"), Chain("TABLEDESC"), Chain("LENGTH"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("TABLEDESC"), Chain("TABLEDESC"), Chain("DEFAULT"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("TABLEDESC"), Chain("TABLEDESC"), Chain("NULLABLE"), VARCHAR_TYPE, 10));
+
+ pF = to.getSchema().First();
+ while ( pF )
+ {
+ ListT<CegoFieldValue> fvl;
+ CegoTypeConverter tc;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pF->getAttrName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, tc.getTypeString(pF->getType())));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain(pF->getLength())));
+
+ // UNDER INVESTIGATION
+ // fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pF->getValue().valAsChain(false)));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pF->getValue().toChain()));
+ if ( pF->isNullable() )
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("yes")));
+ else
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("no")));
+
+ fa.Insert(fvl);
+
+ pF = to.getSchema().Next();
+ }
+ break;
+ }
+ case CegoObject::INDEX:
+ case CegoObject::UINDEX:
+ case CegoObject::PINDEX:
+ {
+ CegoTableObject io;
+ getDistObject(tableSet, objName, type, io);
+
+ int maxAttrLen=10;
+ CegoField *pF = io.getSchema().First();
+ while ( pF )
+ {
+ if ( pF->getAttrName().length() > maxAttrLen )
+ maxAttrLen = pF->getAttrName().length();
+ pF = io.getSchema().Next();
+ }
+
+ int maxTabLen=10;
+ if ( io.getTabName().length() > maxTabLen )
+ maxTabLen = io.getTabName().length();
+
+ schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("ATTR"), VARCHAR_TYPE, maxAttrLen));
+ schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("TABLE"), VARCHAR_TYPE, maxTabLen));
+ schema.Insert(CegoField(Chain("INDEXDESC"), Chain("TABLEDESC"), Chain("TYPE"), VARCHAR_TYPE, 10));
+
+ pF = io.getSchema().First();
+ while ( pF )
+ {
+ ListT<CegoFieldValue> fvl;
+ CegoTypeConverter tc;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pF->getAttrName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, io.getTabName()));
+
+ if ( io.getType() == CegoObject::INDEX)
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, XML_INDEX_VALUE));
+ else if ( io.getType() == CegoObject::PINDEX)
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, XML_PINDEX_VALUE));
+ else if ( io.getType() == CegoObject::UINDEX)
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, XML_UINDEX_VALUE));
+
+ fa.Insert(fvl);
+
+ pF = io.getSchema().Next();
+ }
+ break;
+ }
+ case CegoObject::VIEW:
+ {
+
+ CegoViewObject vo;
+ getDistObject(tableSet, objName, type, vo);
+
+ int maxAttrLen=10;
+ CegoField *pF = vo.getSchema().First();
+ while ( pF )
+ {
+ if ( pF->getAttrName().length() > maxAttrLen )
+ maxAttrLen = pF->getAttrName().length();
+ pF = vo.getSchema().Next();
+ }
+
+ schema.Insert(CegoField(Chain("VIEWDESC"), Chain("VIEWDESC"), Chain("ATTR"), VARCHAR_TYPE, maxAttrLen));
+ schema.Insert(CegoField(Chain("VIEWDESC"), Chain("VIEWDESC"), Chain("TYPE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("VIEWDESC"), Chain("VIEWDESC"), Chain("LENGTH"), VARCHAR_TYPE, 10));
+
+ pF = vo.getSchema().First();
+ while ( pF )
+ {
+ ListT<CegoFieldValue> fvl;
+ CegoTypeConverter tc;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pF->getAttrName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, tc.getTypeString(pF->getType())));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain(pF->getLength())));
+
+ fa.Insert(fvl);
+
+ pF = vo.getSchema().Next();
+ }
+ break;
+ }
+ case CegoObject::PROCEDURE:
+ {
+
+ int tabSetId = getDBMng()->getTabSetId(tableSet);
+
+ if ( checkCompProcedure(tabSetId, objName) == false )
+ reloadProcedure( tabSetId, objName );
+
+ CegoProcedure* pProc = getCompProcedure(tabSetId, objName);
+
+ ListT<CegoProcVar> argList;
+ pProc->getArgList(argList);
+
+ int maxAttrLen=10;
+ CegoProcVar *pArg = argList.First();
+ while ( pArg )
+ {
+ if ( pArg->getName().length() > maxAttrLen )
+ maxAttrLen = pArg->getName().length();
+ pArg = argList.Next();
+ }
+
+ schema.Insert(CegoField(Chain("PROCDESC"), Chain("PROCDESC"), Chain("ATTR"), VARCHAR_TYPE, maxAttrLen));
+ schema.Insert(CegoField(Chain("PROCDESC"), Chain("PROCDESC"), Chain("TYPE"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("PROCDESC"), Chain("PROCDESC"), Chain("LENGTH"), VARCHAR_TYPE, 10));
+ schema.Insert(CegoField(Chain("PROCDESC"), Chain("PROCDESC"), Chain("INOUT"), VARCHAR_TYPE, 10));
+
+ pArg = argList.First();
+ while ( pArg )
+ {
+ ListT<CegoFieldValue> fvl;
+ CegoTypeConverter tc;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pArg->getName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, tc.getTypeString(pArg->getType())));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain(pArg->getLength())));
+
+ if ( pArg->getVarType() == CegoProcVar::INVAR )
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("in")));
+ else if ( pArg->getVarType() == CegoProcVar::OUTVAR )
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("out")));
+ else
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("n/a")));
+
+ fa.Insert(fvl);
+
+ pArg = argList.Next();
+
+ }
+ break;
+ }
+ case CegoObject::FKEY:
+ {
+
+ CegoKeyObject ko;
+ getDistObject(tableSet, objName, type, ko);
+
+ int maxTabLen=10;
+ if ( objName.length() > maxTabLen )
+ maxTabLen = objName.length();
+
+ int maxAttrLen=10;
+ CegoField *pK = ko.getKeySchema().First();
+ while ( pK )
+ {
+ if ( pK->getAttrName().length() > maxAttrLen )
+ maxAttrLen = pK->getAttrName().length();
+
+ pK = ko.getKeySchema().Next();
+ }
+ CegoField *pR = ko.getRefSchema().First();
+ while ( pR )
+ {
+ if ( pR->getAttrName().length() > maxAttrLen )
+ maxAttrLen = pR->getAttrName().length();
+ pR = ko.getRefSchema().Next();
+ }
+
+ schema.Insert(CegoField(Chain("KEYDESC"), Chain("KEYDESC"), Chain("TABLE"), VARCHAR_TYPE, maxTabLen));
+ schema.Insert(CegoField(Chain("KEYDESC"), Chain("KEYDESC"), Chain("ATTR"), VARCHAR_TYPE, maxAttrLen));
+ schema.Insert(CegoField(Chain("KEYDESC"), Chain("KEYDESC"), Chain("TYPE"), VARCHAR_TYPE, 10));
+
+ pK = ko.getKeySchema().First();
+ while ( pK )
+ {
+ ListT<CegoFieldValue> fvl;
+ CegoTypeConverter tc;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, ko.getTabName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pK->getAttrName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("key")));
+
+ fa.Insert(fvl);
+
+ pK = ko.getKeySchema().Next();
+ }
+ pR = ko.getRefSchema().First();
+ while ( pR )
+ {
+ ListT<CegoFieldValue> fvl;
+ CegoTypeConverter tc;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, ko.getRefTable()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, pR->getAttrName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, Chain("reference")));
+
+ fa.Insert(fvl);
+
+ pR = ko.getRefSchema().Next();
+ }
+ break;
+
+ }
+ case CegoObject::CHECK:
+ {
+
+ CegoCheckObject co;
+ getDistObject(tableSet, objName, type, co);
+
+ int maxTabLen=10;
+ if ( objName.length() > maxTabLen )
+ maxTabLen = objName.length();
+
+ int maxCheckLen=30;
+ schema.Insert(CegoField(Chain("CHECKDESC"), Chain("CHECKDESC"), Chain("TABLE"), VARCHAR_TYPE, maxTabLen));
+ schema.Insert(CegoField(Chain("CHECKDESC"), Chain("CHECKDESC"), Chain("CONDITION"), VARCHAR_TYPE, maxCheckLen));
+
+ ListT<CegoFieldValue> fvl;
+
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, co.getTabName()));
+ fvl.Insert(CegoFieldValue(VARCHAR_TYPE, co.getPredDesc()->toChain()));
+
+ fa.Insert(fvl);
+
+ break;
+
+ }
+ case CegoObject::RBSEG:
+ case CegoObject::JOIN:
+ case CegoObject::UNDEFINED:
+ {
+ throw Exception(EXLOC, Chain("Cannot get description for object type"));
+ }
+ }
+}
+
+CegoView* CegoDistManager::getView(int tabSetId, const Chain& viewName)
+{
+ if ( checkCompView(tabSetId, viewName) == false )
+ reloadView( tabSetId, viewName );
+ return getCompView(tabSetId, viewName );
+}
+
+void CegoDistManager::reloadView(int tabSetId, const Chain& viewName)
+{
+ CegoViewObject vo;
+ getObject(tabSetId, viewName, CegoObject::VIEW, vo);
+
+ Chain loadString = Chain("load ") + vo.getViewStmt();
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("View ") + viewName + Chain(" is reloaded"));
+
+ CegoAction* pPA = new CegoAction(this);
+
+ try
+ {
+ Chain tableSet = _pDBMng->getTabSetName(tabSetId);
+ pPA->setTableSet(tableSet);
+ pPA->setCommandChain(loadString);
+ pPA->parse();
+
+ CegoSelect* pSelect = pPA->getSelect();
+ CegoView *pView = new CegoView(viewName, pSelect);
+
+ pSelect->setTabSetId(tabSetId);
+
+ pSelect->prepare();
+
+ ListT<CegoField> schema;
+ pSelect->getSchema(schema);
+
+ addCompView(tabSetId, pView);
+
+ // if schema is zero, recompile is required
+ if ( vo.getSchema().Size() == 0 )
+ {
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("View ") + viewName + Chain(" detected as invalid"));
+
+ dropView(tabSetId, viewName);
+ Chain viewStmt = Chain("view ") + viewName + Chain(" as\n") + pSelect->toChain() + Chain(";");
+ createLocalView( tabSetId, viewName, schema, viewStmt);
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("View ") + viewName + Chain(" validated sucessful"));
+
+ }
+
+ delete pPA;
+ }
+ catch ( Exception e )
+ {
+ delete pPA;
+ Chain msg = Chain("Cannot load view ") + viewName;
+ throw Exception(EXLOC, msg, e);
+ }
+}
+
+CegoProcedure* CegoDistManager::getProcedure(int tabSetId, const Chain& procName)
+{
+ if ( checkCompProcedure(tabSetId, procName) == false )
+ reloadProcedure( tabSetId, procName );
+ return getCompProcedure(tabSetId, procName );
+}
+
+void CegoDistManager::reloadProcedure(int tabSetId, const Chain& procName)
+{
+
+ CegoProcObject po;
+ getObject(tabSetId, procName, CegoObject::PROCEDURE, po);
+
+ Chain loadString = Chain("load ") + po.getProcText();
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Procedure ") + procName + Chain(" is reloaded"));
+
+ CegoAction* pPA = new CegoAction(this);
+
+ try
+ {
+ Chain tableSet = _pDBMng->getTabSetName(tabSetId);
+
+ pPA->setTableSet(tableSet);
+ pPA->setCommandChain(loadString);
+ pPA->parse();
+
+ CegoProcedure* pProc = pPA->getProcedure();
+ addCompProcedure(tabSetId, pProc);
+
+ delete pPA;
+ }
+ catch ( Exception e )
+ {
+ delete pPA;
+ Chain msg = Chain("Cannot load procedure ") + procName;
+ throw Exception(EXLOC, msg, e);
+ }
+}
+
+
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoAction.cc
^
|
@@ -1367,7 +1367,7 @@
}
catch ( Exception e )
{
- moreTuple=false;
+ moreTuple=false;
output.abort(e.getBaseMsg());
delete _pSelect;
return;
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoAdm.cc
^
|
@@ -2395,35 +2395,35 @@
_actionMap[134][IDENTIFIER] = ActionEntry(SHIFT, 195);
_actionMap[135][SEMICOLON] = ActionEntry(REDUCE, 52);
_actionMap[136][SEMICOLON] = ActionEntry(REDUCE, 37);
- _actionMap[137][FOR] = ActionEntry(SHIFT, 196);
- _actionMap[138][FOR] = ActionEntry(SHIFT, 197);
- _actionMap[139][IDENTIFIER] = ActionEntry(SHIFT, 198);
- _actionMap[140][IDENTIFIER] = ActionEntry(SHIFT, 199);
- _actionMap[141][IDENTIFIER] = ActionEntry(SHIFT, 200);
- _actionMap[142][IDENTIFIER] = ActionEntry(SHIFT, 202);
- _actionMap[142][STRUCTURE] = ActionEntry(SHIFT, 201);
- _actionMap[143][IDENTIFIER] = ActionEntry(SHIFT, 203);
- _actionMap[144][IDENTIFIER] = ActionEntry(SHIFT, 205);
+ _actionMap[137][SEMICOLON] = ActionEntry(REDUCE, 45);
+ _actionMap[138][FOR] = ActionEntry(SHIFT, 196);
+ _actionMap[139][FOR] = ActionEntry(SHIFT, 197);
+ _actionMap[140][IDENTIFIER] = ActionEntry(SHIFT, 198);
+ _actionMap[141][IDENTIFIER] = ActionEntry(SHIFT, 199);
+ _actionMap[142][IDENTIFIER] = ActionEntry(SHIFT, 200);
+ _actionMap[143][IDENTIFIER] = ActionEntry(SHIFT, 202);
+ _actionMap[143][STRUCTURE] = ActionEntry(SHIFT, 201);
+ _actionMap[144][IDENTIFIER] = ActionEntry(SHIFT, 203);
}
void CegoAdm::loadParser7()
{
- _actionMap[144][STRUCTURE] = ActionEntry(SHIFT, 204);
- _actionMap[145][IDENTIFIER] = ActionEntry(SHIFT, 206);
- _actionMap[146][IDENTIFIER] = ActionEntry(SHIFT, 207);
- _actionMap[147][IDENTIFIER] = ActionEntry(SHIFT, 208);
- _actionMap[148][IDENTIFIER] = ActionEntry(SHIFT, 209);
- _actionMap[149][IDENTIFIER] = ActionEntry(SHIFT, 210);
- _actionMap[150][IDENTIFIER] = ActionEntry(SHIFT, 211);
- _actionMap[151][IDENTIFIER] = ActionEntry(SHIFT, 212);
- _actionMap[152][SEMICOLON] = ActionEntry(REDUCE, 6);
- _actionMap[153][IDENTIFIED] = ActionEntry(SHIFT, 213);
- _actionMap[154][IDENTIFIER] = ActionEntry(SHIFT, 214);
- _actionMap[155][IDENTIFIER] = ActionEntry(SHIFT, 215);
- _actionMap[156][FROM] = ActionEntry(SHIFT, 216);
- _actionMap[157][FROM] = ActionEntry(SHIFT, 217);
- _actionMap[158][FROM] = ActionEntry(SHIFT, 218);
- _actionMap[159][SEMICOLON] = ActionEntry(REDUCE, 38);
- _actionMap[160][SEMICOLON] = ActionEntry(REDUCE, 45);
+ _actionMap[145][IDENTIFIER] = ActionEntry(SHIFT, 205);
+ _actionMap[145][STRUCTURE] = ActionEntry(SHIFT, 204);
+ _actionMap[146][IDENTIFIER] = ActionEntry(SHIFT, 206);
+ _actionMap[147][IDENTIFIER] = ActionEntry(SHIFT, 207);
+ _actionMap[148][IDENTIFIER] = ActionEntry(SHIFT, 208);
+ _actionMap[149][IDENTIFIER] = ActionEntry(SHIFT, 209);
+ _actionMap[150][IDENTIFIER] = ActionEntry(SHIFT, 210);
+ _actionMap[151][IDENTIFIER] = ActionEntry(SHIFT, 211);
+ _actionMap[152][IDENTIFIER] = ActionEntry(SHIFT, 212);
+ _actionMap[153][SEMICOLON] = ActionEntry(REDUCE, 6);
+ _actionMap[154][IDENTIFIED] = ActionEntry(SHIFT, 213);
+ _actionMap[155][IDENTIFIER] = ActionEntry(SHIFT, 214);
+ _actionMap[156][IDENTIFIER] = ActionEntry(SHIFT, 215);
+ _actionMap[157][FROM] = ActionEntry(SHIFT, 216);
+ _actionMap[158][FROM] = ActionEntry(SHIFT, 217);
+ _actionMap[159][FROM] = ActionEntry(SHIFT, 218);
+ _actionMap[160][SEMICOLON] = ActionEntry(REDUCE, 38);
_actionMap[161][TO] = ActionEntry(SHIFT, 220);
_actionMap[161][SEMICOLON] = ActionEntry(REDUCE, 117);
_jumpMap[161][PitOption] = 219;
@@ -2485,42 +2485,42 @@
_actionMap[55][IDENTIFIER] = ActionEntry(SHIFT, 136);
_actionMap[56][IDENTIFIER] = ActionEntry(SHIFT, 137);
_actionMap[57][IDENTIFIER] = ActionEntry(SHIFT, 138);
- _actionMap[58][FOR] = ActionEntry(SHIFT, 139);
+ _actionMap[58][IDENTIFIER] = ActionEntry(SHIFT, 139);
_actionMap[59][FOR] = ActionEntry(SHIFT, 140);
- _actionMap[60][TABLESET] = ActionEntry(SHIFT, 142);
- _actionMap[60][TABLE] = ActionEntry(SHIFT, 141);
- _actionMap[61][TABLESET] = ActionEntry(REDUCE, 102);
- _actionMap[61][TABLE] = ActionEntry(REDUCE, 102);
- _actionMap[62][TABLESET] = ActionEntry(REDUCE, 103);
- _actionMap[62][TABLE] = ActionEntry(REDUCE, 103);
- _actionMap[63][TABLESET] = ActionEntry(REDUCE, 101);
- _actionMap[63][TABLE] = ActionEntry(REDUCE, 101);
- _actionMap[64][TABLESET] = ActionEntry(SHIFT, 144);
- _actionMap[64][TABLE] = ActionEntry(SHIFT, 143);
- _actionMap[65][FOR] = ActionEntry(SHIFT, 145);
+ _actionMap[60][FOR] = ActionEntry(SHIFT, 141);
+ _actionMap[61][TABLESET] = ActionEntry(SHIFT, 143);
+ _actionMap[61][TABLE] = ActionEntry(SHIFT, 142);
+ _actionMap[62][TABLESET] = ActionEntry(REDUCE, 102);
+ _actionMap[62][TABLE] = ActionEntry(REDUCE, 102);
+ _actionMap[63][TABLESET] = ActionEntry(REDUCE, 103);
+ _actionMap[63][TABLE] = ActionEntry(REDUCE, 103);
+ _actionMap[64][TABLESET] = ActionEntry(REDUCE, 101);
+ _actionMap[64][TABLE] = ActionEntry(REDUCE, 101);
+ _actionMap[65][TABLESET] = ActionEntry(SHIFT, 145);
+ _actionMap[65][TABLE] = ActionEntry(SHIFT, 144);
_actionMap[66][FOR] = ActionEntry(SHIFT, 146);
_actionMap[67][FOR] = ActionEntry(SHIFT, 147);
- _actionMap[68][SEMICOLON] = ActionEntry(REDUCE, 23);
- _actionMap[69][FOR] = ActionEntry(SHIFT, 148);
+ _actionMap[68][FOR] = ActionEntry(SHIFT, 148);
+ _actionMap[69][SEMICOLON] = ActionEntry(REDUCE, 23);
_actionMap[70][FOR] = ActionEntry(SHIFT, 149);
- _actionMap[71][SEMICOLON] = ActionEntry(REDUCE, 12);
- _actionMap[72][FOR] = ActionEntry(SHIFT, 150);
- _actionMap[73][SEMICOLON] = ActionEntry(REDUCE, 3);
- _actionMap[74][SEMICOLON] = ActionEntry(REDUCE, 49);
- _actionMap[75][SEMICOLON] = ActionEntry(REDUCE, 13);
- _actionMap[76][SEMICOLON] = ActionEntry(REDUCE, 7);
- _actionMap[77][FOR] = ActionEntry(SHIFT, 151);
+ _actionMap[71][FOR] = ActionEntry(SHIFT, 150);
+ _actionMap[72][SEMICOLON] = ActionEntry(REDUCE, 12);
+ _actionMap[73][FOR] = ActionEntry(SHIFT, 151);
+ _actionMap[74][SEMICOLON] = ActionEntry(REDUCE, 3);
+ _actionMap[75][SEMICOLON] = ActionEntry(REDUCE, 49);
+ _actionMap[76][SEMICOLON] = ActionEntry(REDUCE, 13);
+ _actionMap[77][SEMICOLON] = ActionEntry(REDUCE, 7);
}
void CegoAdm::loadParser9()
{
- _actionMap[78][SEMICOLON] = ActionEntry(REDUCE, 44);
- _actionMap[79][LOCK] = ActionEntry(SHIFT, 152);
- _actionMap[80][IDENTIFIER] = ActionEntry(SHIFT, 153);
- _actionMap[81][SEMICOLON] = ActionEntry(REDUCE, 5);
- _actionMap[82][SEMICOLON] = ActionEntry(REDUCE, 4);
- _actionMap[83][FOR] = ActionEntry(SHIFT, 154);
+ _actionMap[78][FOR] = ActionEntry(SHIFT, 152);
+ _actionMap[79][SEMICOLON] = ActionEntry(REDUCE, 44);
+ _actionMap[80][LOCK] = ActionEntry(SHIFT, 153);
+ _actionMap[81][IDENTIFIER] = ActionEntry(SHIFT, 154);
+ _actionMap[82][SEMICOLON] = ActionEntry(REDUCE, 5);
+ _actionMap[83][SEMICOLON] = ActionEntry(REDUCE, 4);
_actionMap[84][FOR] = ActionEntry(SHIFT, 155);
- _actionMap[85][IDENTIFIER] = ActionEntry(SHIFT, 156);
+ _actionMap[85][FOR] = ActionEntry(SHIFT, 156);
_actionMap[86][IDENTIFIER] = ActionEntry(SHIFT, 157);
_actionMap[87][IDENTIFIER] = ActionEntry(SHIFT, 158);
_actionMap[88][IDENTIFIER] = ActionEntry(SHIFT, 159);
@@ -2576,54 +2576,54 @@
_actionMap[10][TABLESET] = ActionEntry(SHIFT, 52);
_actionMap[11][ARCHLOG] = ActionEntry(SHIFT, 53);
_actionMap[12][TABLESET] = ActionEntry(SHIFT, 55);
+ _actionMap[12][USER] = ActionEntry(SHIFT, 56);
_actionMap[12][ROLE] = ActionEntry(SHIFT, 54);
- _actionMap[13][TABLE] = ActionEntry(SHIFT, 57);
- _actionMap[13][UINDEX] = ActionEntry(SHIFT, 56);
- _actionMap[14][ARCHLOG] = ActionEntry(SHIFT, 58);
- _actionMap[15][BACKUP] = ActionEntry(SHIFT, 59);
- _actionMap[16][XML] = ActionEntry(SHIFT, 63);
- _actionMap[16][BINARY] = ActionEntry(SHIFT, 61);
- _actionMap[16][PLAIN] = ActionEntry(SHIFT, 62);
+ _actionMap[13][TABLE] = ActionEntry(SHIFT, 58);
+ _actionMap[13][UINDEX] = ActionEntry(SHIFT, 57);
+ _actionMap[14][ARCHLOG] = ActionEntry(SHIFT, 59);
+ _actionMap[15][BACKUP] = ActionEntry(SHIFT, 60);
+ _actionMap[16][XML] = ActionEntry(SHIFT, 64);
+ _actionMap[16][BINARY] = ActionEntry(SHIFT, 62);
+ _actionMap[16][PLAIN] = ActionEntry(SHIFT, 63);
_actionMap[16][TABLE] = ActionEntry(REDUCE, 104);
_actionMap[16][TABLESET] = ActionEntry(REDUCE, 104);
- _jumpMap[16][XPMode] = 60;
+ _jumpMap[16][XPMode] = 61;
_actionMap[17][SEMICOLON] = ActionEntry(REDUCE, 118);
_actionMap[18][SEMICOLON] = ActionEntry(REDUCE, 119);
- _actionMap[19][XML] = ActionEntry(SHIFT, 63);
- _actionMap[19][BINARY] = ActionEntry(SHIFT, 61);
- _actionMap[19][PLAIN] = ActionEntry(SHIFT, 62);
+ _actionMap[19][XML] = ActionEntry(SHIFT, 64);
+ _actionMap[19][BINARY] = ActionEntry(SHIFT, 62);
+ _actionMap[19][PLAIN] = ActionEntry(SHIFT, 63);
_actionMap[19][TABLE] = ActionEntry(REDUCE, 104);
_actionMap[19][TABLESET] = ActionEntry(REDUCE, 104);
- _jumpMap[19][XPMode] = 64;
- _actionMap[20][POOL] = ActionEntry(SHIFT, 73);
- _actionMap[20][IDENTIFIER] = ActionEntry(SHIFT, 79);
- _actionMap[20][TABLESET] = ActionEntry(SHIFT, 76);
- _actionMap[20][DATAFILE] = ActionEntry(SHIFT, 69);
- _actionMap[20][ARCHLOG] = ActionEntry(SHIFT, 65);
- _actionMap[20][LOGFILE] = ActionEntry(SHIFT, 70);
- _actionMap[20][OBJECT] = ActionEntry(SHIFT, 72);
- _actionMap[20][NODE] = ActionEntry(SHIFT, 71);
- _actionMap[20][SESSION] = ActionEntry(SHIFT, 75);
- _actionMap[20][BUFILE] = ActionEntry(SHIFT, 66);
- _actionMap[20][BUSTAT] = ActionEntry(SHIFT, 67);
- _actionMap[20][COPY] = ActionEntry(SHIFT, 68);
- _actionMap[20][TRANSACTION] = ActionEntry(SHIFT, 77);
- _actionMap[20][USER] = ActionEntry(SHIFT, 78);
- _actionMap[20][ROLE] = ActionEntry(SHIFT, 74);
+ _jumpMap[19][XPMode] = 65;
+ _actionMap[20][POOL] = ActionEntry(SHIFT, 74);
+ _actionMap[20][IDENTIFIER] = ActionEntry(SHIFT, 80);
+ _actionMap[20][TABLESET] = ActionEntry(SHIFT, 77);
+ _actionMap[20][DATAFILE] = ActionEntry(SHIFT, 70);
+ _actionMap[20][ARCHLOG] = ActionEntry(SHIFT, 66);
+ _actionMap[20][LOGFILE] = ActionEntry(SHIFT, 71);
+ _actionMap[20][OBJECT] = ActionEntry(SHIFT, 73);
+ _actionMap[20][NODE] = ActionEntry(SHIFT, 72);
+ _actionMap[20][SESSION] = ActionEntry(SHIFT, 76);
+ _actionMap[20][BUFILE] = ActionEntry(SHIFT, 67);
+ _actionMap[20][BUSTAT] = ActionEntry(SHIFT, 68);
+ _actionMap[20][COPY] = ActionEntry(SHIFT, 69);
+ _actionMap[20][TRANSACTION] = ActionEntry(SHIFT, 78);
+ _actionMap[20][USER] = ActionEntry(SHIFT, 79);
+ _actionMap[20][ROLE] = ActionEntry(SHIFT, 75);
_actionMap[21][SEMICOLON] = ActionEntry(REDUCE, 18);
- _actionMap[22][USER] = ActionEntry(SHIFT, 80);
- _actionMap[23][ON] = ActionEntry(SHIFT, 82);
- _actionMap[23][OFF] = ActionEntry(SHIFT, 81);
- _actionMap[24][SECONDARY] = ActionEntry(SHIFT, 84);
- _actionMap[24][MEDIATOR] = ActionEntry(SHIFT, 83);
+ _actionMap[22][USER] = ActionEntry(SHIFT, 81);
+ _actionMap[23][ON] = ActionEntry(SHIFT, 83);
+ _actionMap[23][OFF] = ActionEntry(SHIFT, 82);
+ _actionMap[24][SECONDARY] = ActionEntry(SHIFT, 85);
}
void CegoAdm::loadParser11()
{
- _actionMap[25][TABLESET] = ActionEntry(SHIFT, 88);
- _actionMap[25][USER] = ActionEntry(SHIFT, 89);
- _actionMap[25][ROLE] = ActionEntry(SHIFT, 87);
- _actionMap[25][PERMISSION] = ActionEntry(SHIFT, 86);
- _actionMap[25][ARCHLOG] = ActionEntry(SHIFT, 85);
+ _actionMap[24][MEDIATOR] = ActionEntry(SHIFT, 84);
+ _actionMap[25][TABLESET] = ActionEntry(SHIFT, 89);
+ _actionMap[25][ROLE] = ActionEntry(SHIFT, 88);
+ _actionMap[25][PERMISSION] = ActionEntry(SHIFT, 87);
+ _actionMap[25][ARCHLOG] = ActionEntry(SHIFT, 86);
_actionMap[26][TABLESET] = ActionEntry(SHIFT, 90);
_actionMap[27][BUSTAT] = ActionEntry(SHIFT, 91);
_actionMap[28][TABLESET] = ActionEntry(SHIFT, 92);
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoAdm.def
^
|
@@ -187,7 +187,7 @@
#
Statement : ADD USER IDENTIFIER IDENTIFIED BY STRINGVAL ; addUserAction
Statement : LIST USER ; listUserAction
-Statement : REMOVE USER IDENTIFIER ; removeUserAction
+Statement : DROP USER IDENTIFIER ; removeUserAction
Statement : PASSWD USER IDENTIFIER IDENTIFIED BY STRINGVAL ; changePwdAction
Statement : ASSIGN ROLE IDENTIFIER TO IDENTIFIER ; assignRoleAction
Statement : REMOVE ROLE IDENTIFIER FROM IDENTIFIER ; removeRoleAction
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoAdmAction.cc
^
|
@@ -1601,7 +1601,7 @@
_pAH->getDetailedTableSetInfo(oe, info);
- CegoOutput output(oe.getSchema());
+ CegoOutput output(oe.getSchema(), Chain("rl"));
output.setRawMode(_rawMode);
output.tabOut(info);
if ( _rawMode == false )
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoAdmin.cc
^
|
@@ -555,7 +555,7 @@
cout << " [u1] add user <userid> identified by '<passwd>'" << endl;
cout << " [u2] passwd user <userid> identified by '<passwd>'" << endl;
cout << " [u3] trace [ on | off ] user <userid>" << endl;
- cout << " [u4] remove user <userid>" << endl;
+ cout << " [u4] drop user <userid>" << endl;
cout << " [u5] list role" << endl;
cout << " [u6] create role <role>" << endl;
cout << " [u7] show role <role>" << endl;
@@ -577,7 +577,7 @@
cout << " [b7] end backup for <tableset> [ message 'system message' ] [ keep ticket ]" << endl;
cout << " [b8] recover tableset <tableset> [ to <point in time> ]" << endl;
cout << " [b9] export [ xml | binary | plain ] table <table> from <tableset> to '<filename>'" << endl;
- cout << " [b10 ] export [ xml | binary | plain ] tableset [ structure ] <tableset> to '<filename>'" << endl;
+ cout << " [b10] export [ xml | binary | plain ] tableset [ structure ] <tableset> to '<filename>'" << endl;
cout << " [b11] import [ xml | binary | plain ] table <table> to <tableset> from '<filename>' [ nologging ]" << endl;
cout << " [b12] import [ xml | binary | plain ] tableset [ structure ] <tableset> from '<filename>' [ nologging ]" << endl;
cout << " [b13] list bustat for <tableset>" << endl;
@@ -846,7 +846,7 @@
cout << " It consists of a triple describing tableset, filter and right" << endl;
cout << " The triple must be specified in a comma separated list" << endl;
cout << endl;
- cout << " Sample : add permission p1 with tableset=TS1,filter='*T',right=READ to role R1" << endl;
+ cout << " Sample : set permission p1 with tableset=TS1,filter='*T',right=READ to role R1" << endl;
cout << endl;
cout << " Valid right values are READ,WRITE,MODIFY,EXEC or ALL" << endl;
cout << endl;
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoAdminThread.cc
^
|
@@ -166,10 +166,9 @@
try
{
_pDBMng->increaseActiveAdmThread();
- // _pTabMng->startRecoveryMode(tableSet);
- CegoRecoveryManager recoveryMng(_pTabMng);
- long lsn = recoveryMng.recoverTableSet(tableSet, 0, true);
+ CegoRecoveryManager recoveryMng(_pTabMng, CegoRecoveryManager::REMOTE);
+ long lsn = recoveryMng.recoverTableSet(tableSet, 0);
_pDBMng->decreaseActiveAdmThread();
_pPool->setState(_idx, CegoAdminThreadPool::READY);
@@ -3033,8 +3032,8 @@
pAH->getTableSet(tableSet);
pAH->getPit(pit);
- CegoRecoveryManager recoveryMng(_pTabMng);
- long lsn = recoveryMng.recoverTableSet(tableSet, pit, true);
+ CegoRecoveryManager recoveryMng(_pTabMng, CegoRecoveryManager::LOCAL);
+ long lsn = recoveryMng.recoverTableSet(tableSet, pit);
pAH->sendResponse(Chain("Tableset recovered to lsn ") + Chain(lsn));
}
@@ -5221,8 +5220,8 @@
{
long lsn;
- CegoRecoveryManager recoveryMng(_pTabMng);
- lsn = recoveryMng.recoverTableSet(tableSet, pit, true);
+ CegoRecoveryManager recoveryMng(_pTabMng, CegoRecoveryManager::LOCAL);
+ lsn = recoveryMng.recoverTableSet(tableSet, pit);
pAH->syncWithInfo(Chain("mediator"), mediator, Chain("Tableset recovered to lsn ") + Chain(lsn));
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoBufferPool.cc
^
|
@@ -574,7 +574,14 @@
{
log(_modId, Logger::NOTICE, Chain("Executing escape command <") + escCmd + Chain(">"));
- CommandExecuter cmdExe;
+
+ char *pShell = getenv(CGEXESHELLVARNAME);
+ if ( pShell == NULL )
+ {
+ throw Exception(EXLOC, "Execution shell not set");
+ }
+
+ CommandExecuter cmdExe(pShell);
try
{
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoClient.cc
^
|
@@ -976,8 +976,6 @@
if ( res == CegoDbHandler::DB_ERROR )
{
msg = pSH->getMsg();
- // cerr << msg << endl;
- // cout << "Query failed" << endl;
exitCode = 1;
return false;
}
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoDbHandler.cc
^
|
@@ -360,7 +360,6 @@
_serMsg = pRoot->getAttributeValue(XML_MSG_ATTR);
}
-
if ( docType == Chain(XML_OK_DOC) )
{
return DB_OK;
@@ -1773,6 +1772,7 @@
}
else if ( req == Chain(SER_ERROR) )
{
+ _serMsg = _pSer->readChain();
_pSer->reset();
return DB_ERROR;
}
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoDefs.h
^
|
@@ -40,9 +40,11 @@
#endif
#define CEGO_PRODUCT "Cego"
-#define CEGO_VERSION "2.15.4"
+#define CEGO_VERSION "2.15.5"
#define CEGO_COPYRIGHT "Copyright (C) 2000-2013 by Bjoern Lemke. All rights reserved"
+#define CGEXESHELLVARNAME "CGEXESHELL"
+
/*******************************/
/* File Management Parameters */
/*******************************/
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoDistManager.cc
^
|
@@ -276,7 +276,7 @@
long lsn;
int ts = 0;
- CegoRecoveryManager recoveryMng(this);
+ CegoRecoveryManager recoveryMng(this, CegoRecoveryManager::LOCAL);
recoveryMng.recoverCurrentTransactionLog(tabSetId, 0, lsn, ts);
if ( lsn != maxlsn )
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoMain.cc
^
|
@@ -1245,7 +1245,7 @@
Chain lockFile = longOpt.getOptValue("lockfile");
Chain pidFile = longOpt.getOptValue("pidfile");
Chain dbXML = longOpt.getOptValue("dbxml");
- Chain tableSetArray = longOpt.getOptValue("tableset");
+ Chain tableSetList = longOpt.getOptValue("tableset");
Chain poolSize = longOpt.getOptValue("poolsize");
Chain numDbThread = longOpt.getOptValue("numdbthread");
@@ -1311,16 +1311,16 @@
pDBMng->configureLogger();
pMedThread->getDbSpec(dbXML, beat.getHostName(), beat.getPortNo(), beat.getUser(), beat.getPasswd());
pDBMng->setXmlDef(dbXML);
+
+ pDBMng->xml2Doc();
+ Host h;
+ pDBMng->setDBHost(h.getName());
+ pDBMng->doc2Xml();
}
pDBMng->initPool(poolSize.asInteger());
pDBMng->configureLogger();
- bool startTableSet = true;
- if ( tableSetArray.length() == 0 || tableSetArray == Chain("") )
- {
- startTableSet = false;
- }
#ifdef CGDEBUG
pDBMng->log(modId, Logger::DEBUG, "Initializing page and record locks ...");
@@ -1431,13 +1431,22 @@
}
+ bool startTableSet = true;
+ if ( tableSetList.length() == 0 || tableSetList == Chain("") )
+ {
+ startTableSet = false;
+ }
+
if ( startTableSet )
{
- Tokenizer tok(tableSetArray, Chain(","));
+ Tokenizer tok(tableSetList, Chain(","));
CegoDistManager* pTabMng = new CegoDistManager(pDBMng);
+ // we have to allow the main thread to access all objects
+ pTabMng->disableAuth();
+
Chain tableSet;
try
@@ -1475,8 +1484,6 @@
}
-
-
Chain batchFileName = pDBMng->getTSInitFile(tableSet);
File batchFile(batchFileName);
@@ -1485,7 +1492,7 @@
{
CegoAction* pAction = new CegoAction(pTabMng);
-
+
try
{
pAction->setTableSet(tableSet);
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoObjectManager.cc
^
|
@@ -2761,8 +2761,6 @@
throw e;
}
-
-
}
CegoObjectCursor* CegoObjectManager::getObjectCursor(int tabSetId, const Chain& hashName, const Chain& objName, CegoObject::ObjectType type)
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoRecoveryManager.cc
^
|
@@ -47,11 +47,12 @@
#include <string.h>
#include <stdlib.h>
-CegoRecoveryManager::CegoRecoveryManager(CegoDistManager *pGTM)
+CegoRecoveryManager::CegoRecoveryManager(CegoDistManager *pGTM, CegoRecoveryManager::RecoveryMode mode)
{
_pGTM = pGTM;
_pLogger = _pGTM->getDBMng();
_pDBMng = _pGTM->getDBMng();
+ _recoveryMode = mode;
_modId = _pDBMng->getModId("CegoRecoveryManager");
}
@@ -59,152 +60,163 @@
{
}
-long CegoRecoveryManager::recoverTableSet(const Chain& tableSet, int pit, bool waitForSync)
+long CegoRecoveryManager::recoverTableSet(const Chain& tableSet, int pit)
{
_pLogger->log(_modId, Logger::NOTICE, Chain("Recovering tableset ") + tableSet + Chain(" ..."));
+ char *pShell = getenv(CGEXESHELLVARNAME);
+ if ( pShell == NULL )
+ {
+ throw Exception(EXLOC, "Execution shell not set");
+ }
+
+ _shellCmd = Chain(pShell);
+
int tabSetId = _pDBMng->getTabSetId(tableSet);
_pDBMng->setTableSetRunState(tableSet, XML_RECOVERY_VALUE);
_pDBMng->setRecoveryMode(tabSetId, CegoDatabaseManager::ON );
- if ( waitForSync )
+ try
{
+
while ( _pDBMng->getTableSetSyncState(tableSet) != Chain(XML_SYNCHED_VALUE) && _pDBMng->getRecoveryMode(tabSetId) == CegoDatabaseManager::ON)
{
#ifdef CGDEBUG
_pDBMng->log(_modId, Logger::DEBUG, Chain("Waiting for tableset sync ... "));
#endif
-
+
Sleeper s;
s.secSleep(LOGMNG_RECOVERY_DELAY);
}
- }
-
- if ( _pDBMng->getTableSetSyncState(tableSet) != Chain(XML_SYNCHED_VALUE) )
- {
- Chain msg = Chain("No sync on tableset ") + tableSet + Chain(", recovery failed");
- _pDBMng->setRecoveryMode(tabSetId, CegoDatabaseManager::OFF );
- _pDBMng->log(_modId, Logger::LOGERR, msg);
- throw Exception(EXLOC, msg);
- }
-
- _pGTM->initLock(tabSetId);
- _pGTM->regDataFiles(tableSet);
-
-
- // release logfiles to force archiving of current online log
- _pDBMng->releaseLogFiles(tableSet, true);
-
+
+ if ( _pDBMng->getTableSetSyncState(tableSet) != Chain(XML_SYNCHED_VALUE) )
+ {
+ Chain msg = Chain("No sync on tableset ") + tableSet + Chain(", recovery failed");
+ _pDBMng->setRecoveryMode(tabSetId, CegoDatabaseManager::OFF );
+ _pDBMng->log(_modId, Logger::LOGERR, msg);
+ throw Exception(EXLOC, msg);
+ }
+
+ _pGTM->initLock(tabSetId);
+ _pGTM->regDataFiles(tableSet);
+
+ // release logfiles to force archiving of current online log
+ if ( _recoveryMode == LOCAL )
+ _pDBMng->releaseLogFiles(tableSet, true);
+
+
+ long cplsn;
+
+ Chain tsTicketName = _pDBMng->getTSTicket(tableSet);
+
+ File tsTicket(tsTicketName);
+ if ( tsTicket.exists() )
+ {
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Backup tableset ticket detected, datafile file recovery required ..."));
+ tsTicket.open(File::READ);
+
+ XMLSuite xml;
+
+ Document *pDoc = new Document;
+ pDoc->setAttribute(XML_VERSION_ATTR, XML_VERSION_VALUE);
+
+ xml.setDocument(pDoc);
+ xml.setFile(&tsTicket);
+
+ xml.parse();
+
+ Element *pRoot = pDoc->getRootElement();
+ pDoc->setRootElement(0);
+ delete pDoc;
+
+ _pDBMng->setTableSetInfo(tableSet, pRoot);
+
+ cplsn = _pDBMng->getCommittedLSN(tableSet);
+
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Starting datafile recovery for tableset ") + tableSet + Chain(" ..."));
+ dataFileRecovery(tableSet, tabSetId, cplsn + 1);
+
- long cplsn;
-
- Chain tsTicketName = _pDBMng->getTSTicket(tableSet);
-
- File tsTicket(tsTicketName);
- if ( tsTicket.exists() )
- {
- _pDBMng->log(_modId, Logger::NOTICE, Chain("Backup tableset ticket detected, datafile file recovery required ..."));
- tsTicket.open(File::READ);
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Datafile recovery for tableset ") + tableSet + Chain(" finished"));
+
+ tsTicket.close();
+
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Removing backup ticket ") + tsTicket.getFileName() + Chain(" ..."));
+#endif
+
+ tsTicket.remove();
+
+ }
+ else
+ {
+ cplsn = _pDBMng->getCommittedLSN(tableSet);
+ }
- XMLSuite xml;
+ if ( pit == 0 )
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Starting up-to-crash transaction recovery for tableset ") + tableSet + Chain(" ..."));
+ else
+ {
+ Datetime d(pit);
+ _pDBMng->log(_modId, Logger::NOTICE,
+ Chain("Starting point-in-time transaction recovery to ") + d.asChain() + Chain(" for tableset ") + tableSet + Chain(" ..."));
+
+ }
- Document *pDoc = new Document;
- pDoc->setAttribute(XML_VERSION_ATTR, XML_VERSION_VALUE);
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Commited lsn = ") + Chain(cplsn));
- xml.setDocument(pDoc);
- xml.setFile(&tsTicket);
+ cplsn = transactionRecovery(tableSet, tabSetId, cplsn + 1, pit);
- xml.parse();
+#ifdef CGDEBUG
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Transaction recovery finished with cplsn = ") + Chain(cplsn));
+#endif
- Element *pRoot = pDoc->getRootElement();
- pDoc->setRootElement(0);
- delete pDoc;
+ _pDBMng->initLogFiles(tableSet, true);
- _pDBMng->setTableSetInfo(tableSet, pRoot);
+ _pDBMng->setActiveLogFile(tableSet);
+ _pDBMng->setLSN(tabSetId, cplsn + 1);
+ _pDBMng->startLog(tabSetId);
+
+ CegoLogRecord logRec;
+ CegoLogRecord lr;
+ lr.setAction(CegoLogRecord::LOGREC_SYNC);
+ if ( _pDBMng->logAction(tabSetId, lr) == CegoLogManager::LOG_ERROR )
+ {
+ throw Exception(EXLOC, "Cannot write sync point after tableset recovery");
+ }
- cplsn = _pDBMng->getCommittedLSN(tableSet);
-
- _pDBMng->log(_modId, Logger::NOTICE, Chain("Starting datafile recovery for tableset ") + tableSet + Chain(" ..."));
- dataFileRecovery(tableSet, tabSetId, cplsn + 1);
- _pDBMng->log(_modId, Logger::NOTICE, Chain("Datafile recovery for tableset ") + tableSet + Chain(" finished"));
+ _pDBMng->setTableSetRunState(tableSet, XML_ONLINE_VALUE);
+
+ _pDBMng->setRecoveryMode(tabSetId, CegoDatabaseManager::OFF );
+
+ long lsn = _pDBMng->getLSN(tabSetId);
+ _pDBMng->setCommittedLSN(tabSetId, lsn - 1);
- tsTicket.close();
-
#ifdef CGDEBUG
- _pDBMng->log(_modId, Logger::DEBUG, Chain("Removing backup ticket ") + tsTicket.getFileName() + Chain(" ..."));
+ _pDBMng->log(_modId, Logger::DEBUG, Chain("Writing sync point ..."));
#endif
-
- tsTicket.remove();
- }
- else
- {
- cplsn = _pDBMng->getCommittedLSN(tableSet);
- }
-
- if ( pit == 0 )
- _pDBMng->log(_modId, Logger::NOTICE, Chain("Starting up-to-crash transaction recovery for tableset ") + tableSet + Chain(" ..."));
- else
- {
- Datetime d(pit);
- _pDBMng->log(_modId, Logger::NOTICE,
- Chain("Starting point-in-time transaction recovery to ") + d.asChain() + Chain(" for tableset ") + tableSet + Chain(" ..."));
-
- }
-
- _pDBMng->log(_modId, Logger::NOTICE, Chain("Commited lsn = ") + Chain(cplsn));
+ _pGTM->registerObjects(tableSet);
+
+ _pGTM->writeCheckPoint(tableSet, true, false);
- try
- {
- cplsn = transactionRecovery(tableSet, tabSetId, cplsn + 1, pit);
+ _pDBMng->log(_modId, Logger::NOTICE, Chain("Recovery for tableset ") + tableSet + Chain(" finished"));
+
+ return cplsn;
+
}
catch ( Exception e )
{
Chain msg = e.getBaseMsg();
+ _pDBMng->setTableSetRunState(tableSet, XML_OFFLINE_VALUE);
_pDBMng->setRecoveryMode(tabSetId, CegoDatabaseManager::OFF );
- throw Exception(EXLOC, Chain("Recovery failed : ") + msg);
- }
-
-#ifdef CGDEBUG
- _pDBMng->log(_modId, Logger::DEBUG, Chain("Transaction recovery finished with cplsn = ") + Chain(cplsn));
-#endif
- _pDBMng->initLogFiles(tableSet, true);
-
- _pDBMng->setActiveLogFile(tableSet);
- _pDBMng->setLSN(tabSetId, cplsn + 1);
- _pDBMng->startLog(tabSetId);
-
- CegoLogRecord logRec;
- CegoLogRecord lr;
- lr.setAction(CegoLogRecord::LOGREC_SYNC);
- if ( _pDBMng->logAction(tabSetId, lr) == CegoLogManager::LOG_ERROR )
- {
- throw Exception(EXLOC, "Cannot write sync point after tableset recovery");
+ throw Exception(EXLOC, Chain("Recovery failed : ") + msg);
}
-
- _pDBMng->setTableSetRunState(tableSet, XML_ONLINE_VALUE);
-
- _pDBMng->setRecoveryMode(tabSetId, CegoDatabaseManager::OFF );
-
- long lsn = _pDBMng->getLSN(tabSetId);
- _pDBMng->setCommittedLSN(tabSetId, lsn - 1);
-
-#ifdef CGDEBUG
- _pDBMng->log(_modId, Logger::DEBUG, Chain("Writing sync point ..."));
-#endif
-
- _pGTM->registerObjects(tableSet);
-
- _pGTM->writeCheckPoint(tableSet, true, false);
-
- _pDBMng->log(_modId, Logger::NOTICE, Chain("Recovery for tableset ") + tableSet + Chain(" finished"));
-
- return cplsn;
}
void CegoRecoveryManager::dataFileRecovery(const Chain& tableSet, int tabSetId, long cplsn)
@@ -261,7 +273,7 @@
cplsn = recoverCurrentDataFileLog(tabSetId, endOfBackup);
}
- else
+ else if ( _recoveryMode == LOCAL )
{
_pDBMng->log(_modId, Logger::NOTICE, Chain("Waiting for logfile ") + sourceFileName + Chain(" ..."));
@@ -279,14 +291,12 @@
if ( pArchLogPath )
pathString += Chain(":");
}
+
+ CommandExecuter cmdExe(_shellCmd);
-
- CommandExecuter cmdExe;
-
int archRestoreTimeout = _pDBMng->getArchRestoreTimeout();
- Chain restoreCmd = archRestoreProg + Chain(" ") + archLogFileName + Chain(" ") + pathString;
-
+ Chain restoreCmd = archRestoreProg + Chain(" ") + archLogFileName + Chain(" ") + pathString;
_pDBMng->log(_modId, Logger::NOTICE, Chain("Triggering external log manager with <") + Chain(restoreCmd) + Chain(">"));
int retCode = cmdExe.execute(restoreCmd, archRestoreTimeout);
_pDBMng->log(_modId, Logger::NOTICE, Chain("External log manager returned : <") + Chain(retCode) + Chain(">"));
@@ -310,6 +320,11 @@
s.secSleep(LOGMNG_RECOVERY_DELAY);
}
}
+ else
+ {
+ Sleeper s;
+ s.secSleep(LOGMNG_RECOVERY_DELAY);
+ }
}
}
@@ -360,9 +375,10 @@
pArchLogPath = archPathList.Next();
}
}
- if ( fileFound == false )
+
+ if ( fileFound == false && _recoveryMode == LOCAL)
{
-
+
Chain archRestoreProg = _pDBMng->getArchRestoreProg();
if ( archRestoreProg != Chain("NONE") )
@@ -380,7 +396,8 @@
pathString += Chain(":");
}
- CommandExecuter cmdExe;
+
+ CommandExecuter cmdExe(_shellCmd);
int archRestoreTimeout = _pDBMng->getArchRestoreTimeout();
@@ -410,6 +427,7 @@
}
}
+ // if we found the appropriate file, we try to recover it
if ( fileFound )
{
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoRecoveryManager.h
^
|
@@ -62,12 +62,13 @@
public:
+ enum RecoveryMode { LOCAL, REMOTE };
enum RecoveryState { RECPITREACHED, RECINCOMPLETE, RECOK };
- CegoRecoveryManager(CegoDistManager *pTabMng);
+ CegoRecoveryManager(CegoDistManager *pTabMng, RecoveryMode mode);
~CegoRecoveryManager();
- long recoverTableSet(const Chain& tableSet, int pit, bool waitForSync);
+ long recoverTableSet(const Chain& tableSet, int pit);
RecoveryState recoverCurrentTransactionLog(int tabSetId, int pit, long& lsn, int& ts);
private:
@@ -214,6 +215,10 @@
Logger* _pLogger;
CegoDistManager* _pGTM;
CegoDatabaseManager* _pDBMng;
+
+ Chain _shellCmd;
+
+ RecoveryMode _recoveryMode;
unsigned long _modId;
};
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoXMLSpace.cc
^
|
@@ -2028,6 +2028,13 @@
V();
}
+void CegoXMLSpace::setDBHost(const Chain& dbHost)
+{
+ P();
+ _pDoc->getRootElement()->setAttribute(XML_HOSTNAME_ATTR, dbHost);
+ V();
+}
+
void CegoXMLSpace::getDBHost(Chain& dbHost)
{
P();
|
[-]
[+]
|
Changed |
cego-2.15.5.tar.bz2/src/CegoXMLSpace.h
^
|
@@ -172,6 +172,7 @@
void rmTableSetDef(const Chain& tabSetName);
+ void setDBHost(const Chain& dbHost);
void getDBHost(Chain& dbHost);
void getDataPort(int& dataPort);
void getAdminPort(int& adminPort);
|