× News Cego SysMT Croom Web Statistics Impressum
SysMT Logo
13   Using the CegoAdmNet C++ API
Back to TOC

For an administrator, it may be useful to access the cego database with a more low level programming interface. For those guys, cego provides a C++ programming interface.

To use the C++ API, you should have compiled and installed the base library, the xml library and the cego client library. All packages are available as opensource at www.lemke-it.com. Please refer to the README information of each package, how to compile and install it.

13.1   Connecting to the database

The first thing, you have to do in your application program is to connect to the cego database daemon. For this, you can use the following code.

/* from base */ 
#include <Chain.h>
#include <Logger.h>
#include <Exception.h>
#include <Net.h>
#include <NetHandler.h>


main(int argc, char **argv)
{	

    Chain serverName("myServer");
    int portNo = 2000;

    Chain user("lemke");
    Chain password("lemke");
    Chain logFile("cg.log");
    Chain logMode("notice");

	
    CegoAdmNet *pCegoAdmNet = new CegoAdmNet( logFile, logMode );	
    pCegoAdmNet->connect(serverName, portNo, user, password);

    ...

13.2   Administration methods

In the following a description is given for the current CegoAdmNet methods

CegoAdmNet
Method Description
CegoAdmNet() Class constructor method. No logging is active.
CegoAdmNet( const Chain& logFile, const Chain& logLevel ) Class constructor method. With the logFile argument a name to a file is given, where log messages are written. The logLevel is the level of logging, either notice, error or debug
~CegoAdmNet() Class desctructor method
void connect(const Chain& serverName, int port, const Chain& user, const Chain& pwd) Connect to the database.
void getTableSetList(ListT<Chain>& tslist) Get a list of all defined tablesets in the database.
void getTableSetInfo(const Chain& tableSet, ListT<Chain>& tsInfoList, ListT<Chain>& fileInfoList, ListT<Chain>& logInfoList) Get information about a tableset.
void startTableSet(const Chain& tableset, bool doCleanup)
void stopTableSet(const Chain& tableset)
void getThreadInfo(ListT<Chain>& threadInfoList)
void getDbThreadInfo(ListT<Chain>& dbThreadInfoList)
void getAdmThreadInfo(ListT<Chain>& admThreadInfoList)
void getLogThreadInfo(ListT<Chain>& logThreadInfoList)
void importTableSet(const Chain& tableSet, const Chain& impMode, const Chain& impFile)
void exportTableSet(const Chain& tableSet, const Chain& expMode, const Chain& expFile)
void addDataFile(const Chain& tableSet, const Chain& fileType, const Chain& dataFile, int numPages)
void defineTableSet(const Chain& tableSet, const Chain& tsRoot, const Chain& tsTicket, const Chain& primary, const Chain& secondary, int sysSize, int tmpSize, int logNum)
void createTableSet(const Chain& tableSet)
void dropTableSet(const Chain& tableSet)
void switchSecondary(const Chain& tableSet)
void switchMediatorAction(const Chain& tableSet)
void relocateSecondary(const Chain& tableSet, const Chain& secondary)
void relocateMediator(const Chain& tableSet, const Chain& mediator)
void recoverTableSet(const Chain& tableSet, int pit)
void disconnect()