[-]
[+]
|
Changed |
cego.changes
|
|
[-]
[+]
|
Changed |
cego.spec
^
|
|
[-]
[+]
|
Deleted |
cego-2.13.2.tar.bz2/src/#CegoClient.cc#
^
|
@@ -1,1683 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-// CegoClient.cc
-// -------------
-// Cego client program
-//
-// Design and Implementation by Bjoern Lemke
-//
-// (C)opyright 2000-2012 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: main
-//
-// Description:
-//
-// Status: QG-2.6
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <locale.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <readline/readline.h>
-#include <readline/history.h>
-
-#include <lfc/Chain.h>
-#include <lfc/Exception.h>
-#include <lfc/GetLongOpt.h>
-#include <lfc/File.h>
-#include <lfc/Timer.h>
-#include <lfc/Tokenizer.h>
-#include <lfc/Net.h>
-#include <lfc/SigHandler.h>
-#include <lfc/Tokenizer.h>
-
-#include <lfc/Element.h>
-#include <lfc/Document.h>
-#include <lfc/XMLSuite.h>
-
-#include "CegoOutput.h"
-#include "CegoViewObject.h"
-#include "CegoProcObject.h"
-#include "CegoKeyObject.h"
-#include "CegoDbHandler.h"
-#include "CegoModule.h"
-#include "CegoNet.h"
-#include "CegoXMLdef.h"
-
-#include "CegoDefs.h"
-
-
-#define USAGE "Usage: cgclt --user=<user>/<password>\n\
- [ --server=<host>]\n\
- [ --port=<port> ]\n\
- [ --protocol={serial|xml} ]\n\
- [ --tableset=<tableset> ]\n\
- [ --batchfile=<batchfile> ]\n\
- [ --dumpfile=<dumpfile> ]\n\
- [ --structure ]\n\
- [ --cmd=<command> ]\n\
- [ --logfile=<logfile> ]\n\
- [ --raw ]\n\
- [ --ignore ]\n\
- [ --profile=<pid> ]\n\
- [ --debug ] [ --version ] [ --help ]"
-
-
-#define DEFAULTPORT 2200
-#define DEFAULTSERVER "localhost"
-#define DEFAULTPROTOCOL "xml"
-
-#define HISTFILE ".cgclt_history"
-#define PROMPT "CGCLT > "
-#define PROMPT2 "> "
-
-#define CGPROFILE ".cgprofile"
-
-#define LANGUAGE_ENV "LANG"
-#define LOCALE_CATEGORY LC_TIME
-
-#define MAXCMDLEN 5000
-
-enum RunMode { INTERACTIVE, BATCH, COMMAND, DUMP };
-
-extern char __lfcVersionString[];
-extern char __lfcxmlVersionString[];
-extern char __quoteEscapeFlag;
-
-bool flowCtl = false;
-int flowCount = 10;
-
-class AbortHandler : public SigHandler
-{
-
-public:
-
- AbortHandler(const Chain& serverName,
- int portNo,
- const Chain& tableSet,
- const Chain& user,
- const Chain& password,
- long tid,
- CegoModule *pModule);
- ~AbortHandler();
- void sigCatch(int sig);
-
- void setQueryAbort(bool doAbort);
-
-private:
-
- long _tid;
- bool _doAbort;
- CegoModule *_pModule;
- int _portNo;
- Chain _serverName;
- Chain _user;
- Chain _password;
- Chain _tableSet;
-};
-
-class ProfileEntry
-{
-
-public:
-
- ProfileEntry();
- ProfileEntry(const Chain& pid);
- ProfileEntry(const Chain& pid,
- const Chain& serverName,
- int portNo,
- const Chain& protocol,
- const Chain& tableSet,
- const Chain& auth,
- const Chain& prompt);
- ~ProfileEntry();
-
- const Chain& getId() const;
- const Chain& getServerName() const;
- int getPortNo() const;
- const Chain& getProtocol() const;
- const Chain& getTableSet() const;
- const Chain& getAuth() const;
- const Chain& getPrompt() const;
-
- ProfileEntry& operator = ( const ProfileEntry& ad);
- bool operator == ( const ProfileEntry& ad);
-
-private:
-
- Chain _pid;
- int _portNo;
- Chain _serverName;
- Chain _protocol;
- Chain _tableSet;
- Chain _auth;
- Chain _prompt;
-};
-
-int execute();
-bool dispatchCmd(CegoDbHandler* pNetHandle, AbortHandler* pAH, Chain cmd, bool outMode, int& exitCode, Chain& msg);
-void loadProfile(const Chain& rcFileName, ListT<ProfileEntry>& pfeList);
-void dumpTableSet(CegoNet *pCegoNet, const Chain& dumpFileName, bool isStructure);
-void dumpCounter(CegoNet *pCegoNet, File *pDF);
-void dumpTable(CegoNet *pCegoNet, File *pDF, bool isStructure);
-void dumpIndex(CegoNet *pCegoNet, File *pDF);
-void dumpKey(CegoNet *pCegoNet, File *pDF);
-void dumpCheck(CegoNet *pCegoNet, File *pDF);
-void dumpView(CegoNet *pCegoNet, File *pDF);
-void dumpProcedure(CegoNet *pCegoNet, File *pDF);
-
-Chain user;
-Chain password;
-Chain serverName;
-Chain tableSet;
-int portNo;
-Chain authString;
-Chain promptString;
-bool rawMode = false;
-bool ignoreError = false;
-bool isStructure = false;
-Chain batchFileName;
-Chain dumpFileName;
-Chain command;
-Chain logFile;
-RunMode runMode = INTERACTIVE;
-bool debug=false;
-CegoModule *pModule = 0;
-unsigned long modId;
-Chain homeDir;
-Chain histPath;
-CegoDbHandler::ProtocolType protType;
-
-int main(int argc, char **argv)
-{
-
- GetLongOpt longOpt(argc, argv);
-
- longOpt.addOpt("version");
- longOpt.addOpt("help");
- longOpt.addOpt("logfile");
- longOpt.addOpt("tableset");
- longOpt.addOpt("user");
- longOpt.addOpt("cmd");
- longOpt.addOpt("batchfile");
- longOpt.addOpt("dumpfile");
- longOpt.addOpt("structure");
- longOpt.addOpt("qescmode");
- longOpt.addOpt("debug");
- longOpt.addOpt("raw");
- longOpt.addOpt("ignore");
- longOpt.addOpt("server", DEFAULTSERVER);
- longOpt.addOpt("protocol", DEFAULTPROTOCOL);
- longOpt.addOpt("port", Chain(DEFAULTPORT));
- longOpt.addOpt("profile");
-
- try
- {
- longOpt.parseOpt();
- }
- catch ( Exception e )
- {
- Chain msg;
- e.pop(msg);
- cerr << msg << endl;
- cerr << USAGE << endl;
- exit(1);
- }
-
-
-#ifdef HAVE_MINGW32
- homeDir = getenv("HOMEPATH");
- histPath = homeDir + "\\" + Chain(HISTFILE);
-#else
- Chain homeDir(getenv("HOME"));
- Chain histPath = homeDir + "/" + Chain(HISTFILE);
-#endif
-
- if ( longOpt.isSet("debug") )
- debug=true;
-
- if ( longOpt.isSet("qescmode") )
- __quoteEscapeFlag=1;
- else
- __quoteEscapeFlag=0;
-
-
- if ( longOpt.isSet("raw") )
- rawMode=true;
-
- if ( longOpt.isSet("ignore") )
- ignoreError=true;
-
-
- if ( longOpt.isSet("structure") )
- isStructure=true;
-
- if ( longOpt.isSet( Chain("help") ) )
- {
- cerr << USAGE << endl;
- exit(0);
- }
-
- if ( longOpt.isSet( Chain("version") ) )
- {
- cout << CEGO_PRODUCT << " (" << sizeof(long) * 8 << " bit), Version " << CEGO_VERSION
- << " [ lfc : " << __lfcVersionString
- << ", lfcxml : " << __lfcxmlVersionString << " ]" << endl;
- cout << CEGO_COPYRIGHT << endl;
- exit(0);
- }
-
-
- ListT<ProfileEntry> pfeList;
-
- try
- {
- loadProfile(homeDir + "/" + Chain(CGPROFILE), pfeList);
- }
- catch ( Exception e )
- {
- Chain msg;
- e.pop(msg);
- cerr << msg << endl;
- exit(1);
- }
-
- logFile = longOpt.getOptValue("logfile");
-
- if ( longOpt.isSet("batchfile") )
- {
- runMode = BATCH;
- batchFileName = longOpt.getOptValue("batchfile");
- }
- if ( longOpt.isSet("dumpfile") )
- {
- runMode = DUMP;
- dumpFileName = longOpt.getOptValue("dumpfile");
- }
- else if ( longOpt.isSet("cmd") )
- {
- runMode = COMMAND;
- command = longOpt.getOptValue("cmd");
- }
-
-
- if ( longOpt.isSet("profile") )
- {
- Chain profile;
- profile = longOpt.getOptValue("profile");
-
- ProfileEntry *pE;
- if ( ( pE = pfeList.Find( ProfileEntry(profile))) != 0 )
- {
- serverName = pE->getServerName();
- tableSet = pE->getTableSet();
- portNo = pE->getPortNo();
- authString = pE->getAuth();
- promptString = pE->getPrompt();
- }
- else
- {
- cerr << "Profile entry " << profile << " not found" << endl;
- exit(1);
- }
- }
- else
- {
- serverName = longOpt.getOptValue("server");
- tableSet = longOpt.getOptValue("tableset");
- portNo = longOpt.getOptValue("port").asInteger();
- authString = longOpt.getOptValue("user");
- promptString = Chain(PROMPT);
- }
-
- Tokenizer authTok(authString, Chain("/"));
- authTok.nextToken(user);
- authTok.nextToken(password);
-
- if ( user.length() == 0 )
- {
- cerr << "User not set" << endl;
- exit (1);
- }
- if ( password.length() == 0 )
- {
- cerr << "Password not set" << endl;
- exit (1);
- }
- if ( tableSet.length() == 0 )
- {
- cerr << "Tableset not set" << endl;
- exit (1);
- }
-
- Chain prot = longOpt.getOptValue("protocol");
-
- if ( prot == Chain("serial") )
- {
- protType = CegoDbHandler::SERIAL;
- }
- else if ( prot == Chain("xml") )
- {
- protType = CegoDbHandler::XML;
- }
- else
- {
- cerr << "Invalid protocol " << prot;
- exit (1);
- }
-
- // for localization
- char* lang = 0;
- if ( ( lang = getenv(LANGUAGE_ENV) ) != 0)
- {
- if ( setlocale(LOCALE_CATEGORY, lang) == 0)
- {
- Chain msg = Chain("Cannot set locale ") + Chain(lang);
- cerr << msg << endl;
- exit(1);
- }
- }
-
- if ( logFile.length() > 0 )
- pModule = new CegoModule(logFile);
- else
- pModule = new CegoModule;
-
-
- modId = pModule->getModId("CegoClient");
-
- if ( debug )
- {
- pModule->logModule(modId, "CegoClient", Logger::DEBUG);
- unsigned long id = pModule->getModId("CegoDbHandler");
- pModule->logModule(id, "CegoDbHandler", Logger::DEBUG);
- }
- else
- {
- pModule->logModule(modId, "CegoClient", Logger::NOTICE);
- unsigned long id = pModule->getModId("CegoDbHandler");
- pModule->logModule(id, "CegoDbHandler", Logger::NOTICE);
- }
-
- int exitCode = execute();
-
- delete pModule;
- exit(exitCode);
-}
-
-int execute()
-{
- int exitCode = 0;
-
- switch ( runMode )
- {
-
- case COMMAND:
- {
-
- Net n ( NETMNG_MSG_BUFLEN, NETMNG_SIZEBUFLEN );
- NetHandler* pN;
-
- try
- {
- pN = n.connect(serverName, portNo);
- }
- catch ( Exception e )
- {
- cerr << "Cannot connect to database" << endl;
- return 1;
- }
-
- CegoDbHandler* pSH = new CegoDbHandler(pN, protType, pModule);
-
- CegoDbHandler::ResultType res = pSH->requestSession(tableSet, user, password);
- if ( res != CegoDbHandler::DB_OK )
- {
- Chain msg = pSH->getMsg();
- delete pSH;
- cerr << msg << endl;
- return 1;
- }
-
- Chain msg;
- dispatchCmd(pSH, 0, command, rawMode, exitCode, msg);
-
- pSH->closeSession();
-
- delete pSH;
- delete pN;
-
- break;
-
- }
- case BATCH:
- {
- int lineNo=0;
-
- Net n ( NETMNG_MSG_BUFLEN, NETMNG_SIZEBUFLEN );
- NetHandler* pN;
-
- try
- {
- pN = n.connect(serverName, portNo);
- }
- catch ( Exception e )
- {
- cerr << "Cannot connect to database" << endl;
- return 1;
- }
-
- CegoDbHandler* pSH = new CegoDbHandler(pN, protType, pModule);
-
- CegoDbHandler::ResultType res = pSH->requestSession(tableSet, user, password);
- if ( res != CegoDbHandler::DB_OK )
- {
- Chain msg = pSH->getMsg();
- delete pSH;
- cerr << msg << endl;
- return 1;
- }
-
- File cmdFile(batchFileName);
- if ( cmdFile.exists() == false )
- {
- cerr << "File " << batchFileName << " does not exist" << endl;
- return 1;
- }
-
- try
- {
- cmdFile.open(File::READ);
- }
- catch ( Exception e)
- {
- cout << "Cannot open batchfile " + batchFileName << endl;
- return 1;
- }
-
- try
- {
-
- Chain cmd;
- Chain line;
- bool disableDelimiter=false;
- bool goOn = true;
-
- while (goOn && cmdFile.readLine(line, MAXCMDLEN))
- {
- lineNo++;
- line = line.cutTrailing(" \t");
-
- bool isCommentLine = false;
-
- if ( line.length() >= 2 )
- {
- if (line.cutTrailing(" \t").subChain(1, 2) == Chain("--"))
- {
- isCommentLine = true;
- }
- }
-
- if ( ! isCommentLine )
- {
-
- if ( line == Chain("@") )
- {
- if ( disableDelimiter == false )
- disableDelimiter=true;
- else
- disableDelimiter=false;
- }
- else
- {
- // cmd = line;
- cmd = cmd + Chain(" ") + line;
- cmd = cmd.cutTrailing(" \t");
- }
-
- if ( cmd.length() > 0 )
- {
-
- if (cmd.subChain(cmd.length()-1, cmd.length()) == Chain(";")
- && disableDelimiter==false)
- {
-
- // send command to server here
-
- Timer t(6,3);
- t.start();
-
- Chain msg;
- goOn = dispatchCmd(pSH, 0, cmd, rawMode, exitCode, msg);
-
- t.stop();
-
- if ( exitCode != 0 )
- {
- cerr << "Line Number " + Chain(lineNo) + " : " << msg << endl;
- }
- else
- {
- cout << msg << endl;
- cout << "ok ( " << t << " s )" << endl;
- }
-
- if ( exitCode != 0 && ignoreError )
- goOn = true;
-
- cmd = Chain("");
-
- }
- }
- }
- }
- if ( cmd.length() > 1 )
- {
- cout << "Incomplete command ..<" << cmd << ">" << endl;
- }
-
- cmdFile.close();
-
- pSH->closeSession();
-
- delete pSH;
- delete pN;
-
- }
- catch ( Exception e)
- {
- Chain msg;
- e.pop(msg);
- cerr << msg << endl;
- return 1;
- }
-
- break;
-
- }
- case DUMP:
- {
-
- Chain logMode("notice");
- if ( debug )
- logMode=Chain("debug");
-
- CegoNet *pCegoNet = new CegoNet( protType, logFile, logMode );
-
- try
- {
- pCegoNet->connect(serverName, portNo, tableSet, user, password);
- }
- catch ( Exception e )
- {
- cerr << "Cannot connect to database" << endl;
- delete pCegoNet;
- return 1;
- }
-
- dumpTableSet(pCegoNet, dumpFileName, isStructure);
-
- delete pCegoNet;
-
- exitCode = 0;
- break;
-
- }
- case INTERACTIVE:
- {
-
- Net n ( NETMNG_MSG_BUFLEN, NETMNG_SIZEBUFLEN );
- NetHandler* pN;
-
- try
- {
- pN = n.connect(serverName, portNo);
- }
- catch ( Exception e )
- {
- cerr << "Cannot connect to database" << endl;
- return 1;
- }
-
- CegoDbHandler* pSH = new CegoDbHandler(pN, protType, pModule);
-
-#ifdef DEBUG
- pModule->log(modId, Logger::DEBUG, Chain("Requesting session ..."));
-#endif
-
- CegoDbHandler::ResultType res = pSH->requestSession(tableSet, user, password);
- if ( res != CegoDbHandler::DB_OK )
- {
- Chain msg = pSH->getMsg();
- delete pSH;
- cerr << msg << endl;
- return 1;
- }
-
-
- try
- {
-
- long tid = pSH->getTid();
-
- AbortHandler *pAH = new AbortHandler(serverName, portNo, tableSet, user, password, tid, pModule);
-
-#ifdef DEBUG
- pModule->log(modId, Logger::DEBUG, Chain("Got session ..."));
-#endif
-
- read_history((char*)histPath);
-
- bool goOn = true;
- while ( goOn )
- {
-
- char *pC = 0;
-
- Chain cs;
-
- pC = readline(promptString);
-
- if (pC)
- {
- cs = Chain(pC);
-
- bool stmtComplete = false;
- while (! stmtComplete )
- {
- add_history(pC);
-
- if (pC)
- free(pC);
-
- cs = cs.cutTrailing(Chain(" \t"));
-
- if ( cs.length() > 1)
- {
- if ( cs[cs.length()-2] == ';')
- stmtComplete = true;
- }
-
- if ( ! stmtComplete )
- {
- if ( cs.length() > 1 )
- {
- pC = readline(PROMPT2);
- }
- else
- {
- pC = readline(promptString);
- }
- if (pC)
- cs = cs + Chain(" ") + Chain(pC);
- }
-
- }
-
- Timer t(6,3);
- t.start();
-
- Chain msg;
- goOn = dispatchCmd(pSH, pAH, cs, rawMode, exitCode, msg);
-
- t.stop();
-
- if ( exitCode != 0 )
- {
- cerr << "Error : " << msg << endl;
- cerr << "Query failed" << endl;
- goOn = true;
- }
- else
- {
- cout << msg << endl;
- cout << "ok ( " << t << " s )" << endl;
- }
- write_history((char*)histPath);
- }
- else
- {
- cout << "Bye" << endl;
- goOn=false;
- }
- }
-
- pSH->closeSession();
-
- delete pSH;
- delete pN;
- delete pAH;
-
- }
- catch ( Exception e)
- {
- Chain msg;
- e.pop(msg);
- cerr << msg << endl;
- return 1;
- }
-
- break;
-
- }
- }
- return exitCode;
-}
-
-
-bool dispatchCmd(CegoDbHandler *pSH, AbortHandler *pAH, Chain cmd, bool outMode, int& exitCode, Chain& msg)
-{
-
- exitCode = 0;
-
- if ( cmd.cutTrailing(" ;") == Chain("quit") )
- {
- msg = Chain("Goodbye");
- return false;
- }
-
- Tokenizer tok(cmd, Chain(" ;"));
- Chain flowTok;
- if ( tok.nextToken(flowTok) )
- {
-
- if ( flowTok == Chain("flowctl") )
- {
- Chain flowOpt;
- if ( tok.nextToken(flowOpt) )
- {
- if ( flowOpt == Chain("off") )
- {
- flowCtl=false;
- cout << "Flow control disabled" << endl;
- }
- else
- {
- flowCtl=true;
- if ( flowOpt.asInteger() > 0 )
- flowCount=flowOpt.asInteger();
- cout << "Flow control enabled" << endl;
- }
- }
- return true;
- }
- }
-
- CegoDbHandler::ResultType res;
-
- if ( pAH )
- pAH->setQueryAbort(true);
-
- res = pSH->reqQueryOp(cmd);
-
- if ( pAH )
- pAH->setQueryAbort(false);
-
-
- if ( res == CegoDbHandler::DB_OK )
- {
- msg = pSH->getMsg();
- long affCount = pSH->getAffected();
-
- // if ( msg == Chain("Goodbye") )
- // return true;
-
- // cout << msg << endl; // " ( " << affCount << " affected )" << endl;
-
- }
- else if ( res == CegoDbHandler::DB_FIN )
- {
- msg = Chain("No rows");
- }
- else if ( res == CegoDbHandler::DB_INFO )
- {
-
- CegoObject::ObjectType objType = pSH->getObjType();
-
- switch ( objType )
- {
- case CegoObject::SYSTEM:
- case CegoObject::TABLE:
- case CegoObject::PINDEX:
- case CegoObject::UINDEX:
- case CegoObject::INDEX:
- {
- CegoTableObject to;
- to.putElement( pSH->getObjElement() );
- cout << to.getFormatted();
- break;
- }
- case CegoObject::VIEW:
- {
- CegoViewObject vo;
- vo.putElement( pSH->getObjElement() );
- cout << vo.getFormatted();
- break;
- }
- case CegoObject::PROCEDURE:
- {
- CegoProcObject po;
- po.putElement( pSH->getObjElement() );
- cout << po.getFormatted();
- break;
- }
- case CegoObject::FKEY:
- {
- CegoKeyObject ko;
- ko.putElement( pSH->getObjElement() );
- cout << ko.getFormatted();
- break;
- }
- default:
- break;
- }
- }
- else if ( res == CegoDbHandler::DB_DATA )
- {
- ListT<CegoField> schema;
- Chain format;
-
- schema = pSH->getSchema();
- format = pSH->getFormat();
-
- CegoOutput output(schema, format);
-
- output.setRawMode(outMode);
-
- output.headOut();
-
- // CegoDbHandler::QuerySync querySync;
-
- // querySync=CegoDbHandler::QUERY_MOREDATA;
-
- ListT<CegoFieldValue> fvl;
- long count=0;
-
- while ( ( res = pSH->receiveTableData(schema, fvl) ) == CegoDbHandler::DB_DATA )
- {
- count++;
-
- output.rowOut(fvl);
- fvl.Empty();
-
- if ( flowCtl )
- {
- if ( count % flowCount == 0 )
- {
- cout << "Next, Reset, Abort ? ( n, r, a ) ";
- char resp;
- cin >> resp;
- if ( resp == 'a' )
- {
- pSH->abortQuery();
- break;
- }
- if ( resp == 'r' )
- {
- pSH->resetQuery();
- }
- else
- {
- // nothing
- }
- }
- }
-
- }
- output.tailOut();
- msg=Chain(count) + Chain(" tuples");
- }
- if ( res == CegoDbHandler::DB_ERROR )
- {
- msg = pSH->getMsg();
- // cerr << msg << endl;
- // cout << "Query failed" << endl;
- exitCode = 1;
- return false;
- }
-
- return true;
-}
-
-void dumpTableSet(CegoNet *pCegoNet, const Chain& dumpFileName, bool isStructure)
-{
-
- File* pDF = new File(dumpFileName);
- pDF->open(File::WRITE);
-
- try
- {
- dumpCounter(pCegoNet, pDF);
- dumpTable(pCegoNet, pDF, isStructure);
- dumpIndex(pCegoNet, pDF);
- dumpKey(pCegoNet, pDF);
- dumpCheck(pCegoNet, pDF);
- dumpView(pCegoNet, pDF);
- dumpProcedure(pCegoNet, pDF);
- }
- catch ( Exception e)
- {
- Chain msg;
- e.pop(msg);
- cerr << msg << endl;
- }
-
- pDF->close();
- delete pDF;
-
-}
-
-void dumpCounter(CegoNet *pCegoNet, File *pDF)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list counter;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain counterName = pFV->valAsChain();
- pFV = fvl.Next();
- Chain counterValue = pFV->valAsChain();
-
- Chain cmd;
-
- cmd=Chain("drop if exists counter ") + counterName + Chain(";\n");
- pDF->writeChain(cmd);
-
-
- cmd=Chain("create counter ") + counterName + Chain(";\n");
- pDF->writeChain(cmd);
- cmd=Chain("set counter ") + counterName + Chain(" to ") + counterValue + Chain(";\n");
- pDF->writeChain(cmd);
- fvl.Empty();
- }
-}
-
-void dumpTable(CegoNet *pCegoNet, File *pDF, bool isStructure)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list table;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<Chain> tableList;
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain tableName = pFV->valAsChain();
- tableList.Insert(tableName);
- fvl.Empty();
- }
-
- Chain *pTable = tableList.First();
- while ( pTable )
- {
- res = pCegoNet->doQuery(Chain("desc table ") + *pTable + Chain(";"));
-
- Chain cmd;
-
- cmd=Chain("drop if exists table ") + *pTable + Chain(";\n");
- pDF->writeChain(cmd);
-
- cmd=Chain("create table ") + *pTable + Chain("(");
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<CegoFieldValue> fvl;
- bool isFirst=true;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- if ( isFirst == false )
- cmd += Chain(", ");
- isFirst=false;
-
- CegoFieldValue *pFV = fvl.First();
- Chain attrName = pFV->valAsChain();
- pFV = fvl.Next();
- Chain attrType = pFV->valAsChain();
- pFV = fvl.Next();
- Chain attrSize = pFV->valAsChain();
- pFV = fvl.Next();
- Chain attrDef = pFV->valAsChain();
- pFV = fvl.Next();
- Chain attrNull = pFV->valAsChain();
-
- cmd += attrName + Chain(" ") + attrType;
- if ( attrType == Chain(XML_STRING_VALUE)
- || attrType == Chain(XML_BIGINT_VALUE)
- || attrType == Chain(XML_DECIMAL_VALUE)
- || attrType == Chain(XML_FIXED_VALUE))
- cmd += Chain("(") + attrSize + Chain(")");
- if ( attrDef != Chain(XML_NULL_VALUE))
- cmd += Chain(" default ") + attrDef;
- if ( attrNull == Chain("no"))
- cmd += Chain(" not null");
- fvl.Empty();
- }
-
- cmd += Chain(");\n");
- pDF->writeChain(cmd);
-
-
- if ( isStructure == false )
- {
- // dump table content
- res = pCegoNet->doQuery(Chain("select * from ") + *pTable + Chain(";"));
-
- schema.Empty();
- fvl.Empty();
-
- pCegoNet->getSchema(schema);
-
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- Chain cmd=Chain("insert into ") + *pTable + Chain(" values (");
-
- CegoFieldValue *pFV = fvl.First();
- while ( pFV )
- {
- Chain val = pFV->toChain();
- cmd += val;
- pFV = fvl.Next();
-
- if ( pFV )
- cmd += Chain(", ");
- }
- cmd += Chain(");\n");
- pDF->writeChain(cmd);
- fvl.Empty();
- }
- }
-
- pTable = tableList.Next();
- }
-}
-
-
-void dumpIndex(CegoNet *pCegoNet, File *pDF)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list index;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<Chain> indexList;
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain indexName = pFV->valAsChain();
- indexList.Insert(indexName);
- fvl.Empty();
- }
-
- Chain *pIndex = indexList.First();
- while ( pIndex )
- {
- res = pCegoNet->doQuery(Chain("desc index ") + *pIndex + Chain(";"));
-
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- Chain tableName;
- Chain indexType;
- ListT<Chain> attrList;
-
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain attrName = pFV->valAsChain();
- attrList.Insert(attrName);
- pFV = fvl.Next();
- tableName = pFV->valAsChain();
- pFV = fvl.Next();
- indexType = pFV->valAsChain();
-
- fvl.Empty();
- }
-
- Chain cmd;
-
- cmd=Chain("drop if exists index ") + *pIndex + Chain(";\n");
- pDF->writeChain(cmd);
-
- if ( indexType == Chain(XML_PINDEX_VALUE) )
- cmd=Chain("create primary index ");
- else if ( indexType == Chain(XML_UINDEX_VALUE) )
- cmd=Chain("create unique index ") + *pIndex;
- else
- cmd=Chain("create index ") + *pIndex;
-
- cmd += Chain(" on ") + tableName + Chain("(");
-
- Chain *pAttr = attrList.First();
- bool isFirst=true;
- while ( pAttr )
- {
- if ( isFirst == false )
- cmd += Chain(",");
- isFirst=false;
-
- cmd += *pAttr;
- pAttr = attrList.Next();
- }
-
- cmd += Chain(");\n");
- pDF->writeChain(cmd);
-
- pIndex = indexList.Next();
- }
-}
-
-
-void dumpKey(CegoNet *pCegoNet, File *pDF)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list key;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<Chain> keyList;
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain keyName = pFV->valAsChain();
- keyList.Insert(keyName);
- fvl.Empty();
- }
-
- Chain *pKey = keyList.First();
- while ( pKey )
- {
- res = pCegoNet->doQuery(Chain("desc key ") + *pKey + Chain(";"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- Chain keyTable;
- Chain refTable;
- ListT<Chain> keyAttrList;
- ListT<Chain> refAttrList;
-
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
-
- CegoFieldValue *pFV = fvl.First();
-
- Chain tableName = pFV->valAsChain();
- pFV = fvl.Next();
- Chain attrName = pFV->valAsChain();
- pFV = fvl.Next();
- Chain attrType = pFV->valAsChain();
-
- if ( attrType == Chain("key") )
- {
- keyTable=tableName;
- keyAttrList.Insert(attrName);
- }
- else if ( attrType == Chain("reference") )
- {
- refTable=tableName;
- refAttrList.Insert(attrName);
- }
-
- fvl.Empty();
- }
-
- Chain cmd;
-
- cmd=Chain("drop if exists foreign key ") + *pKey + Chain(";\n");
- pDF->writeChain(cmd);
-
-
- cmd=Chain("alter table ") + keyTable + Chain(" add foreign key ") + *pKey + Chain("(");
- Chain *pKeyAttr = keyAttrList.First();
- while ( pKeyAttr )
- {
- cmd += *pKeyAttr;
- pKeyAttr = keyAttrList.Next();
- if ( pKeyAttr )
- cmd += Chain(",");
- }
-
- cmd+=Chain(") references ") + refTable + Chain("(");
- Chain *pRefAttr = refAttrList.First();
- while ( pRefAttr )
- {
- cmd += *pRefAttr;
- pRefAttr = refAttrList.Next();
- if ( pRefAttr )
- cmd += Chain(",");
- }
-
- cmd += Chain(");\n");
- pDF->writeChain(cmd);
-
- pKey = keyList.Next();
- }
-}
-
-void dumpCheck(CegoNet *pCegoNet, File *pDF)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list check;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<Chain> checkList;
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain checkName = pFV->valAsChain();
- checkList.Insert(checkName);
- fvl.Empty();
- }
-
- Chain *pCheck = checkList.First();
- while ( pCheck )
- {
- res = pCegoNet->doQuery(Chain("desc check ") + *pCheck + Chain(";"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<CegoFieldValue> fvl;
- bool isFirst=true;
- while ( pCegoNet->fetchData(schema, fvl) );
-
- CegoFieldValue *pFV = fvl.First();
- Chain checkTable = pFV->valAsChain();
- pFV = fvl.Next();
- Chain checkCondition = pFV->valAsChain();
-
- fvl.Empty();
-
- Chain cmd;
-
- cmd=Chain("drop if exists check ") + *pCheck + Chain(";\n");
- pDF->writeChain(cmd);
-
- cmd=Chain("alter table ") + checkTable + Chain(" add check ") + *pCheck + Chain(" on ") + checkCondition + Chain(";\n");
- pDF->writeChain(cmd);
-
- pCheck = checkList.Next();
- }
-}
-
-void dumpView(CegoNet *pCegoNet, File *pDF)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list view;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<Chain> viewList;
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain viewName = pFV->valAsChain();
- viewList.Insert(viewName);
- fvl.Empty();
- }
-
- Chain *pView = viewList.First();
- while ( pView )
- {
- res = pCegoNet->doQuery(Chain("show view ") + *pView + Chain(";"));
-
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<CegoFieldValue> fvl;
- bool isFirst=true;
- Chain viewText;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- viewText = pFV->valAsChain();
- fvl.Empty();
- }
-
- Chain cmd;
-
- cmd=Chain("drop if exists view ") + *pView + Chain(";\n");
- pDF->writeChain(cmd);
-
- cmd=Chain("create ") + viewText;
- cmd += Chain("\n");
- pDF->writeChain(cmd);
-
- pView = viewList.Next();
- }
-}
-
-void dumpProcedure(CegoNet *pCegoNet, File *pDF)
-{
-
- long res;
- res = pCegoNet->doQuery(Chain("list procedure;"));
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<Chain> procList;
- ListT<CegoFieldValue> fvl;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- Chain procName = pFV->valAsChain();
- procList.Insert(procName);
- fvl.Empty();
- }
-
- Chain *pProc = procList.First();
- while ( pProc )
- {
- res = pCegoNet->doQuery(Chain("show procedure ") + *pProc + Chain(";"));
-
-
- ListT<CegoField> schema;
- pCegoNet->getSchema(schema);
-
- ListT<CegoFieldValue> fvl;
- Chain procText;
- while ( pCegoNet->fetchData(schema, fvl) )
- {
- CegoFieldValue *pFV = fvl.First();
- procText = pFV->valAsChain();
- fvl.Empty();
- }
-
- Chain cmd;
-
- cmd=Chain("drop if exists procedure ") + *pProc + Chain(";\n");
- pDF->writeChain(cmd);
-
- cmd=Chain("@\ncreate ") + procText;
- cmd += Chain("\n@\n");
- pDF->writeChain(cmd);
-
- pProc = procList.Next();
- }
-}
-
-void loadProfile(const Chain& rcFileName, ListT<ProfileEntry>& pfeList)
-{
- File rcFile(rcFileName);
- if ( rcFile.exists() )
- {
-
- rcFile.open(File::READ);
-
- Chain rcLine;
- while ( rcFile.readLine(rcLine) )
- {
- Tokenizer tok(rcLine, Chain(":"));
-
- Chain pid;
- Chain serverName;
- Chain portNo;
- Chain protocol;
- Chain tableSet;
- Chain prompt;
- Chain user;
- Chain pwd;
-
- if ( tok.nextToken(pid) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(serverName) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(portNo) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(protocol) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(tableSet) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(prompt) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(user) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
- if ( tok.nextToken(pwd) == false)
- {
- throw Exception(EXLOC, Chain("Incomplete profile entry <") + rcLine + Chain(">"));
- }
-
- Chain auth = user + Chain("/") + pwd;
- ProfileEntry pfe(pid, serverName, portNo.asInteger(), protocol, tableSet, auth, prompt);
- pfeList.Insert(pfe);
-
- }
- }
-}
-
-AbortHandler::AbortHandler(const Chain& serverName,
- int portNo,
- const Chain& tableSet,
- const Chain& user,
- const Chain& password,
- long tid,
- CegoModule *pModule) : SigHandler()
-{
- init();
- install(SIGINT);
-#ifndef HAVE_MINGW32
- install(SIGPIPE);
-#endif
- _tid = tid;
- _pModule = pModule;
- _portNo = portNo;
- _tableSet = tableSet;
- _user = user;
- _password = password;
- _serverName = serverName;
-}
-
-AbortHandler::~AbortHandler()
-{
-}
-
-void AbortHandler::sigCatch(int sig)
-{
-
- try {
- install(SIGINT);
-#ifndef HAVE_MINGW32
- install(SIGPIPE);
-#endif
-
- if ( _doAbort )
- {
-
- cout << endl << "Aborting query .." << endl;
-
-
- Net n ( NETMNG_MSG_BUFLEN, NETMNG_SIZEBUFLEN );
- NetHandler* pN;
-
- pN = n.connect(_serverName, _portNo);
-
- CegoDbHandler* pSH = new CegoDbHandler(pN, protType, _pModule);
-
- CegoDbHandler::ResultType res = pSH->requestSession(_tableSet, _user, _password);
- if ( res != CegoDbHandler::DB_OK )
- {
- Chain msg = pSH->getMsg();
- throw Exception(EXLOC, msg);
- }
-
- Chain msg;
-
- res = pSH->reqQueryAbort(_tid);
-
- if ( res == CegoDbHandler::DB_OK )
- {
- Chain msg = pSH->getMsg();
- }
-
- pSH->closeSession();
-
- delete pSH;
- delete pN;
-
- }
- else
- {
- cout << "Use quit to quit" << endl;
- }
- }
- catch ( Exception e)
- {
- Chain msg;
- e.pop(msg);
- cout << "Error : " << msg << endl;
- }
-
-}
-
-void AbortHandler::setQueryAbort(bool doAbort)
-{
- _doAbort = doAbort;
-}
-
-
-ProfileEntry::ProfileEntry()
-{
-}
-
-ProfileEntry::ProfileEntry(const Chain& pid)
-{
- _pid = pid;
-}
-
-ProfileEntry::ProfileEntry(const Chain& pid,
- const Chain& serverName,
- int portNo,
- const Chain& protocol,
- const Chain& tableSet,
- const Chain& auth,
- const Chain& prompt)
-{
- _pid = pid;
- _serverName = serverName;
- _portNo = portNo;
- _protocol = protocol;
- _tableSet = tableSet;
- _auth = auth;
- _prompt = prompt;
-}
-
-ProfileEntry::~ProfileEntry()
-{
-}
-
-
-const Chain& ProfileEntry::getId() const
-{
- return _pid;
-}
-
-const Chain& ProfileEntry::getServerName() const
-{
- return _serverName;
-}
-
-int ProfileEntry::getPortNo() const
-{
- return _portNo;
-}
-
-const Chain& ProfileEntry::getProtocol() const
-{
- return _protocol;
-}
-
-const Chain& ProfileEntry::getTableSet() const
-{
- return _tableSet;
-}
-
-const Chain& ProfileEntry::getAuth() const
-{
- return _auth;
-}
-
-const Chain& ProfileEntry::getPrompt() const
-{
- return _prompt;
-}
-
-ProfileEntry& ProfileEntry::operator = ( const ProfileEntry& pe)
-{
- _pid = pe._pid;
- _serverName = pe._serverName;
- _portNo = pe._portNo;
- _protocol = pe._protocol;
- _tableSet = pe._tableSet;
- _auth = pe._auth;
- _prompt = pe._prompt;
- return (*this);
-}
-
-bool ProfileEntry::operator == ( const ProfileEntry& pe)
-{
- if ( _pid == pe._pid )
- return true;
- return false;
-}
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/README
^
|
@@ -4,7 +4,7 @@
----
A relational and transactional database system
- Version 2.13.2
+ Version 2.13.4
(C)opyright 2006,2007,2008,2009,2010,2011,2012 by Bjoern Lemke
@@ -14,7 +14,7 @@
-----------
To build Cego, you need the following library packages available from www.lemke-it.com:
- lfc-1.3.0.tar.gz
+ lfc-1.3.2.tar.gz
lfcxml-1.0.26.tar.gz
Furthermore, you need the GNU readline library available via http://tiswww.case.edu/php/chet/readline/rltop.html
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/samples/chkdb/cleanchkdb
^
|
@@ -1,6 +1,6 @@
#!/bin/sh
-rm -rf chkdb.xml
+rm -rf db/chkdb.xml
rm -rf db/chkdb_TS1.sys
rm -rf db/chkdb_TS1.temp
rm -rf db/ts1data01.dbf
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/src/CegoClient.cc
^
|
@@ -418,8 +418,19 @@
pModule->logModule(id, "CegoDbHandler", Logger::NOTICE);
}
- int exitCode = execute();
-
+ int exitCode = 0;
+ try
+ {
+ exitCode = execute();
+ }
+ catch ( Exception e )
+ {
+ Chain msg;
+ e.pop(msg);
+ cerr << msg << endl;
+ exitCode = 1;
+ }
+
delete pModule;
exit(exitCode);
}
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/src/CegoDbHandler.cc
^
|
@@ -104,6 +104,8 @@
_pModule = pModule;
_pRow = 0;
+ _pSer = new CegoSerial(_pN);
+
_protType = pt;
if ( _protType == CegoDbHandler::XML )
@@ -126,6 +128,8 @@
pDoc->clear();
delete pDoc;
}
+ if ( _pSer )
+ delete _pSer;
}
CegoDbHandler::ResultType CegoDbHandler::requestSession(const Chain& tableSet, const Chain& user, const Chain& password, bool doEncrypt)
@@ -171,12 +175,12 @@
{
pwd = password;
}
-
- _ser.clear();
- _ser.writeChain(Chain(SER_SESSION));
- _ser.writeChain(tableSet);
- _ser.writeChain(user);
- _ser.writeChain(pwd);
+
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_SESSION));
+ _pSer->writeChain(tableSet);
+ _pSer->writeChain(user);
+ _pSer->writeChain(pwd);
return sendSerialReq();
@@ -192,8 +196,8 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_SESSION_CLOSE));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_SESSION_CLOSE));
return sendSerialReq();
}
}
@@ -274,28 +278,31 @@
{
#ifdef CGDEBUG
- _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+
#endif
- _ser.setSerial(_pN->getMsg());
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
// cout << "READING REQ = " << req << endl;
if ( req != Chain(SER_SESSION))
{
- _ser.clear();
- _ser.writeChain(Chain(SER_ERROR));
- _ser.writeChain(Chain("Invalid request"));
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_ERROR));
+ _pSer->writeChain(Chain("Invalid request"));
_pN->writeMsg();
return false;
}
else
{
- _tableSet = _ser.readChain();
- _user = _ser.readChain();
- _password = _ser.readChain();
+ _tableSet = _pSer->readChain();
+ _user = _pSer->readChain();
+ _password = _pSer->readChain();
// cout << "SESSION OK" << endl;
return true;
}
@@ -377,10 +384,9 @@
}
else
{
-
- _ser.clear();
- _ser.writeChain(Chain(SER_QUERY));
- _ser.writeChain(cmd);
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_QUERY));
+ _pSer->writeChain(cmd);
return sendSerialReq();
}
@@ -398,9 +404,9 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_QUERYABORT));
- _ser.writeChain(Chain(idx));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_QUERYABORT));
+ _pSer->writeChain(Chain(idx));
return sendSerialReq();
}
}
@@ -629,7 +635,6 @@
outParamList = _outParamList;
retValue = _retValue;
}
-
}
CegoDbHandler::ResultType CegoDbHandler::receiveTableData(const ListT<CegoField>& schema)
@@ -646,9 +651,7 @@
pF = schema.Next();
pFV = fvl.Next();
}
-
return res;
-
}
CegoDbHandler::ResultType CegoDbHandler::receiveTableData(const ListT<CegoField>& schema, ListT<CegoFieldValue>& fvl)
@@ -777,15 +780,20 @@
else
{
- // cout << "Num Ahead = " << _ser.numAhead() << endl;
+ // cout << "Num Ahead = " << _pSer->numAhead() << endl;
- if ( _ser.numAhead() == 0 )
+ if ( _pSer->numAhead() > 0 )
+ {
+ fvl = _pSer->readRow(schema);
+ return DB_DATA;
+ }
+ else
{
ResultType res = getMoreTableData();
switch ( res )
{
case DB_DATA:
- fvl = _ser.readRow(schema);
+ fvl = _pSer->readRow(schema);
break;
case DB_OK:
case DB_ERROR:
@@ -793,11 +801,7 @@
}
return res;
}
- else
- {
- fvl = _ser.readRow(schema);
- return DB_DATA;
- }
+
}
}
@@ -840,7 +844,7 @@
}
else
{
- _ser.clear();
+ _pSer->reset();
}
}
@@ -887,7 +891,7 @@
}
else
{
- _ser.clear();
+ _pSer->reset();
}
}
else if ( c == QUERY_MOREDATA )
@@ -917,13 +921,12 @@
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
_pN->writeMsg();
- _ser.clear();
+ _pSer->reset();
_serSync = true;
}
}
@@ -1002,16 +1005,15 @@
}
else
{
- _ser.clear();
- _ser.writeChain(SER_FIN);
+ _pSer->reset();
+ _pSer->writeChain(SER_FIN);
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
}
_pN->writeMsg();
@@ -1062,19 +1064,16 @@
else
{
- _ser.clear();
- _ser.writeChain(SER_ERROR);
- _ser.writeChain(msg);
+ _pSer->reset();
+ _pSer->writeChain(SER_ERROR);
+ _pSer->writeChain(msg);
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
-
-
}
_pN->writeMsg();
@@ -1116,14 +1115,20 @@
}
else
{
- _ser.clear();
+ _pSer->reset();
+
+ _pSer->writeChain(Chain(SER_SACK));
+ _pSer->writeChain(msg);
+ _pSer->writeChain(Chain(tid));
+ _pSer->writeChain(dbName);
+ _pSer->writeChain(dbVersion);
+
+#ifdef CGDEBUG
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
+ _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
+#endif
- _ser.writeChain(Chain(SER_SACK));
- _ser.writeChain(msg);
- _ser.writeChain(Chain(tid));
- _ser.writeChain(dbName);
- _ser.writeChain(dbVersion);
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
}
_pN->writeMsg();
@@ -1161,19 +1166,16 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_OK));
- _ser.writeChain(msg);
- _ser.writeChain(Chain(affected));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_OK));
+ _pSer->writeChain(msg);
+ _pSer->writeChain(Chain(affected));
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
-
-
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
}
_pN->writeMsg();
@@ -1208,18 +1210,15 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_ERROR));
- _ser.writeChain(msg);
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_ERROR));
+ _pSer->writeChain(msg);
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
-
-
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
}
@@ -1256,11 +1255,11 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_BLOBINFO));
- _ser.writeChain(Chain(fileId));
- _ser.writeChain(Chain(pageId));
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_BLOBINFO));
+ _pSer->writeChain(Chain(fileId));
+ _pSer->writeChain(Chain(pageId));
+
}
_pN->writeMsg();
@@ -1294,10 +1293,9 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_BLOBSIZE));
- _ser.writeChain(Chain(blobSize));
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_BLOBSIZE));
+ _pSer->writeChain(Chain(blobSize));
}
_pN->writeMsg();
@@ -1328,12 +1326,11 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_PUTBLOB));
- _ser.writeChain(Chain(tableSet));
- _ser.writeChain(Chain(blob.getSize()));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_PUTBLOB));
+ _pSer->writeChain(Chain(tableSet));
+ _pSer->writeChain(Chain(blob.getSize()));
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
}
_pN->writeMsg();
@@ -1365,19 +1362,16 @@
else
{
- _ser.setSerial( _pN->getMsg() );
-
- // cout << "READ msg : " << _ser.getSerial() << endl;
-
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
if ( req == Chain(SER_ERROR) )
{
return DB_ERROR;
}
- blob.setFileId(_ser.readChain().asInteger());
- blob.setPageId(_ser.readChain().asInteger());
+ blob.setFileId(_pSer->readChain().asInteger());
+ blob.setPageId(_pSer->readChain().asInteger());
}
blob.reset();
@@ -1423,14 +1417,12 @@
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_GETBLOB));
- _ser.writeChain(Chain(tableSet));
- _ser.writeChain(Chain(blob.getFileId()));
- _ser.writeChain(Chain(blob.getPageId()));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_GETBLOB));
+ _pSer->writeChain(Chain(tableSet));
+ _pSer->writeChain(Chain(blob.getFileId()));
+ _pSer->writeChain(Chain(blob.getPageId()));
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
-
}
_pN->writeMsg();
@@ -1462,22 +1454,18 @@
else
{
- _ser.setSerial( _pN->getMsg() );
-
- // cout << "READ msg : " << _ser.getSerial() << endl;
-
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
if ( req == Chain(SER_ERROR) )
{
return DB_ERROR;
}
- blobSize = _ser.readChain().asInteger();
+ blobSize = _pSer->readChain().asInteger();
}
-
blob.allocate(blobSize);
blob.reset();
@@ -1520,14 +1508,12 @@
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_DELBLOB));
- _ser.writeChain(Chain(tableSet));
- _ser.writeChain(Chain(blob.getFileId()));
- _ser.writeChain(Chain(blob.getPageId()));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_DELBLOB));
+ _pSer->writeChain(Chain(tableSet));
+ _pSer->writeChain(Chain(blob.getFileId()));
+ _pSer->writeChain(Chain(blob.getPageId()));
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
-
}
_pN->writeMsg();
@@ -1558,11 +1544,8 @@
else
{
- _ser.setSerial( _pN->getMsg() );
-
- // cout << "READ msg : " << _ser.getSerial() << endl;
-
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
if ( req == Chain(SER_ERROR) )
{
@@ -1632,36 +1615,35 @@
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_PROCRES));
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_PROCRES));
CegoTypeConverter tc;
if ( pRetValue )
{
- _ser.writeChain(Chain("@OUT"));
- _ser.writeChain(tc.getTypeString(pRetValue->getType()));
- _ser.writeChain(pRetValue->valAsChain());
+ _pSer->writeChain(Chain("@OUT"));
+ _pSer->writeChain(tc.getTypeString(pRetValue->getType()));
+ _pSer->writeChain(pRetValue->valAsChain());
}
CegoProcVar *pVar = outParamList.First();
while ( pVar )
{
- _ser.writeChain(pVar->getName());
- _ser.writeChain(tc.getTypeString(pVar->getValue().getType()));
- _ser.writeChain(pVar->getValue().valAsChain());
+ _pSer->writeChain(pVar->getName());
+ _pSer->writeChain(tc.getTypeString(pVar->getValue().getType()));
+ _pSer->writeChain(pVar->getValue().valAsChain());
pVar = outParamList.Next();
}
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
}
_pN->writeMsg();
@@ -1697,12 +1679,10 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_PRODINFO));
- _ser.writeChain(CEGO_PRODUCT);
- _ser.writeChain(CEGO_VERSION);
-
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_PRODINFO));
+ _pSer->writeChain(CEGO_PRODUCT);
+ _pSer->writeChain(CEGO_VERSION);
}
@@ -1729,8 +1709,6 @@
if ( _protType == CegoDbHandler::XML )
{
-
-
_xml.getDocument()->clear();
_xml.setChain( _pN->getMsg() );
@@ -1772,15 +1750,12 @@
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _ser.setSerial( _pN->getMsg() );
-
- // cout << "READ msg : " << _ser.getSerial() << endl;
-
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
// cout << "Reading req " << req << endl;
if ( req == Chain(SER_SDATA) )
@@ -1793,12 +1768,12 @@
}
else if ( req == Chain(SER_FIN) )
{
- _ser.clear();
+ _pSer->reset();
return DB_FIN;
}
else if ( req == Chain(SER_ERROR) )
{
- _ser.clear();
+ _pSer->reset();
return DB_ERROR;
}
}
@@ -1957,22 +1932,21 @@
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _pN->getMsg());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
-
- _ser.setSerial( _pN->getMsg() );
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
if ( req == Chain(SER_QUERY) )
{
- _serQueryCmd = _ser.readChain();
+ _serQueryCmd = _pSer->readChain();
return CegoDbHandler::QUERY;
}
else if ( req == Chain(SER_QUERYABORT) )
{
- _serTid = _ser.readChain().asLong();
+ _serTid = _pSer->readChain().asLong();
return CegoDbHandler::QUERYABORT;
}
else if ( req == Chain(SER_DBPRODINFO) )
@@ -2009,12 +1983,12 @@
}
else if ( req == Chain(SER_DELETE) )
{
- _serAffected = _ser.readChain().asInteger();
+ _serAffected = _pSer->readChain().asInteger();
return CegoDbHandler::DELETE;
}
else if ( req == Chain(SER_UPDATE) )
{
- _serAffected = _ser.readChain().asInteger();
+ _serAffected = _pSer->readChain().asInteger();
return CegoDbHandler::UPDATE;
}
else if ( req == Chain(SER_OBJECTINFO) )
@@ -2055,15 +2029,15 @@
}
else if ( req == Chain(SER_PUTBLOB) )
{
- _serTableSet = _ser.readChain();
- _serBlobSize = _ser.readChain().asLong();
+ _serTableSet = _pSer->readChain();
+ _serBlobSize = _pSer->readChain().asLong();
return CegoDbHandler::PUTBLOB;
}
else if ( req == Chain(SER_GETBLOB) )
{
- _serTableSet = _ser.readChain();
- _serFileId = _ser.readChain().asInteger();
- _serPageId = _ser.readChain().asInteger();
+ _serTableSet = _pSer->readChain();
+ _serFileId = _pSer->readChain().asInteger();
+ _serPageId = _pSer->readChain().asInteger();
return CegoDbHandler::GETBLOB;
}
else if ( req == Chain(SER_DELBLOB) )
@@ -2157,16 +2131,13 @@
fileId = _serFileId;
pageId = _serPageId;
}
-
}
-
-
void CegoDbHandler::collectSchema(const ListT<CegoField>& schema, const Chain& format)
{
#ifdef CGDEBUG
- _pModule->log(_modId, Logger::DEBUG, Chain("Sending schema ..."));
+ _pModule->log(_modId, Logger::DEBUG, Chain("Collecting schema ..."));
#endif
if ( _protType == CegoDbHandler::XML )
@@ -2222,24 +2193,11 @@
}
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_SDATA));
- _ser.writeChain(format);
- _ser.writeSchema(schema);
- _serSync = false;
-/*
-#ifdef CGDEBUG
- _pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
- _pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
-#endif
-
- _pN->setMsg((char*)_ser.getSerial(), _ser.getSerial().length());
- _pN->writeMsg();
- _ser.clear();
-
-*/
-
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_SDATA));
+ _pSer->writeChain(format);
+ _pSer->writeSchema(schema);
+ _serSync = false;
}
}
@@ -2274,19 +2232,18 @@
else
{
- _ser.clear();
- _ser.writeChain(Chain(SER_INFO));
- _ser.writeObject(oe);
+ _pSer->reset();
+ _pSer->writeChain(Chain(SER_INFO));
+ _pSer->writeObject(oe);
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- SER ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _pN->setMsg((char*)_ser.getSerial(), _ser.getSerial().length());
_pN->writeMsg();
- _ser.clear();
+ _pSer->reset();
}
@@ -2326,10 +2283,10 @@
}
else
{
- if ( _ser.isClear() )
- _ser.writeChain(SER_FDATA);
+ if ( _pSer->isReset() )
+ _pSer->writeChain(SER_FDATA);
- _ser.writeRow(schema);
+ _pSer->writeRow(schema);
}
}
@@ -2370,9 +2327,9 @@
}
else
{
- if ( _ser.isClear() )
- _ser.writeChain(SER_FDATA);
- _ser.writeRow(fvl);
+ if ( _pSer->isReset() )
+ _pSer->writeChain(SER_FDATA);
+ _pSer->writeRow(fvl);
}
}
@@ -2458,23 +2415,21 @@
#ifdef CGDEBUG
_pModule->log(_modId, Logger::DEBUG, Chain("--- Ser ---"));
- _pModule->log(_modId, Logger::DEBUG, _ser.getSerial());
+ _pModule->log(_modId, Logger::DEBUG, Chain(_pN->getMsg(), _pN->getMsgSize()));
_pModule->log(_modId, Logger::DEBUG, Chain("--- --- ---"));
#endif
- _pN->setMsg(_ser.getSerial(), _ser.getSerial().length());
-
_pN->writeMsg();
_pN->readMsg();
- _ser.setSerial(_pN->getMsg());
- Chain req = _ser.readChain();
+ _pSer->reset();
+ Chain req = _pSer->readChain();
if ( req == Chain(SER_OK))
{
- _serMsg = _ser.readChain();
- _serAffected = _ser.readChain().asInteger();
+ _serMsg = _pSer->readChain();
+ _serAffected = _pSer->readChain().asInteger();
return DB_OK;
}
else if ( req == Chain(SER_FIN))
@@ -2485,10 +2440,10 @@
}
else if ( req == Chain(SER_SACK))
{
- _serMsg = _ser.readChain();
- _serTid = _ser.readChain().asLong();
- _serDbName = _ser.readChain();
- _serDbVersion = _ser.readChain();
+ _serMsg = _pSer->readChain();
+ _serTid = _pSer->readChain().asLong();
+ _serDbName = _pSer->readChain();
+ _serDbVersion = _pSer->readChain();
return DB_OK;
}
@@ -2497,11 +2452,11 @@
_serMsg = Chain("Procedure executed");
- while ( _ser.numAhead() > 0 )
+ while ( _pSer->numAhead() > 0 )
{
- Chain paramName = _ser.readChain();
- Chain paramType = _ser.readChain();
- Chain paramValue = _ser.readChain();
+ Chain paramName = _pSer->readChain();
+ Chain paramType = _pSer->readChain();
+ Chain paramValue = _pSer->readChain();
CegoTypeConverter tc;
CegoDataType datatype = tc.getTypeId(paramType);
@@ -2522,18 +2477,18 @@
else if ( req == Chain(SER_ERROR) )
{
- _serMsg = _ser.readChain();
+ _serMsg = _pSer->readChain();
return DB_ERROR;
}
else if ( req == Chain(SER_INFO) )
{
- _serMsg = _ser.readChain();
+ _serMsg = _pSer->readChain();
return DB_INFO;
}
else if ( req == Chain(SER_SDATA) )
{
- _serFormat = _ser.readChain();
- _serSchema = _ser.readSchema();
+ _serFormat = _pSer->readChain();
+ _serSchema = _pSer->readSchema();
return DB_DATA;
}
else
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/src/CegoDbHandler.h
^
|
@@ -188,7 +188,7 @@
ListT<Element*> _rowList;
// for native protocol
- CegoSerial _ser;
+ CegoSerial* _pSer;
Chain _serQueryCmd;
long _serTid;
long _serAffected;
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/src/CegoDefs.h
^
|
@@ -40,7 +40,7 @@
#endif
#define CEGO_PRODUCT "Cego"
-#define CEGO_VERSION "2.13.2"
+#define CEGO_VERSION "2.13.4"
#define CEGO_COPYRIGHT "Copyright (C) 2000-2012 by Bjoern Lemke. All rights reserved"
/*******************************/
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/src/CegoSerial.cc
^
|
@@ -44,11 +44,13 @@
#define SERSEP "@"
#define SERNULL "-"
#define QSIGN '\''
-#define ESIGN '!'
+#define ESIGN '^'
+#define CESIGN "!^&"
-CegoSerial::CegoSerial()
+CegoSerial::CegoSerial(NetHandler *pN)
{
- _pTok = 0;
+ _pN = pN;
+ _pTok = new Tokenizer(pN->getMsg(), 0, Chain(SERSEP), QSIGN, ESIGN);
}
CegoSerial::~CegoSerial()
@@ -57,18 +59,24 @@
delete _pTok;
}
-void CegoSerial::clear()
+void CegoSerial::reset()
{
- _serial = Chain();
+ if ( _pN )
+ _pN->concatReset();
+ if ( _pTok )
+ {
+ _pTok->reset(_pN->getMsg(), _pN->getMsgSize());
+ }
}
-bool CegoSerial::isClear() const
+bool CegoSerial::isReset() const
{
- if ( _serial == Chain() )
+ if ( _pN->concatPos() == 0 )
return true;
return false;
}
+/*
void CegoSerial::setSerial(const Chain& serial)
{
_serial = serial;
@@ -83,6 +91,7 @@
{
return _serial;
}
+*/
int CegoSerial::numAhead() const
{
@@ -97,20 +106,21 @@
void CegoSerial::writeChain(const Chain& s)
{
- if ( _serial != Chain() )
- _serial += Chain(SERSEP);
+ if ( _pN->concatPos() != 0 )
+ _pN->concatAdd(Chain(SERSEP));
if ( s.length() < 2 )
- _serial += Chain(SERNULL);
+ _pN->concatAdd(Chain(SERNULL));
else
{
+
// treat escape charater
int pos;
Chain ec;
bool isMod=false;
if ( s.posStr(Chain(ESIGN), pos) )
{
- s.replaceAll(Chain(ESIGN), Chain(ESIGN) + Chain(ESIGN), ec);
+ s.replaceAll(Chain(ESIGN), Chain(CESIGN), ec);
isMod = true;
if ( ec.posStr(Chain(SERSEP), pos) )
{
@@ -127,9 +137,9 @@
}
if ( isMod )
- _serial += ec;
+ _pN->concatAdd(ec);
else
- _serial += s;
+ _pN->concatAdd(s);
}
}
@@ -190,13 +200,12 @@
n.replaceAll(Chain(ESIGN) + Chain(SERSEP), Chain(SERSEP), es);
n = es;
}
- if ( n.posStr(Chain(ESIGN) + Chain(ESIGN), pos) )
+ if ( n.posStr(Chain(CESIGN), pos) )
{
Chain es;
- n.replaceAll(Chain(ESIGN) + Chain(ESIGN), Chain(ESIGN), es);
+ n.replaceAll(Chain(CESIGN), Chain(ESIGN), es);
n = es;
}
-
return n;
}
@@ -322,12 +331,14 @@
}
-
+/*
CegoSerial& CegoSerial::operator = ( const CegoSerial& ser)
{
- _serial = ser._serial;
+ _pN = ser._pN;
+ _p
return (*this);
}
+*/
Chain CegoSerial::toChain() const
|
[-]
[+]
|
Changed |
cego-2.13.4.tar.bz2/src/CegoSerial.h
^
|
@@ -40,6 +40,7 @@
// lfc includes
#include <lfc/Chain.h>
#include <lfc/Tokenizer.h>
+#include <lfc/NetHandler.h>
// cego includes
#include "CegoField.h"
@@ -50,11 +51,11 @@
public:
- CegoSerial();
+ CegoSerial(NetHandler *pN);
~CegoSerial();
- void clear();
- bool isClear() const;
+ void reset();
+ bool isReset() const;
void writeChain(const Chain& s);
void writeSchema(const ListT<CegoField>& schema);
@@ -67,21 +68,21 @@
ListT<CegoField> readSchema();
ListT<CegoFieldValue> readRow(const ListT<CegoField>& schema);
- void setSerial(const Chain& serial);
- const Chain& getSerial() const;
+ // void setSerial(const Chain& serial);
+ // const Chain& getSerial() const;
int numAhead() const;
- CegoSerial& operator = ( const CegoSerial& ser);
+ // CegoSerial& operator = ( const CegoSerial& ser);
Chain toChain() const;
friend ostream& operator << (ostream& s, const CegoSerial& ser);
private:
-
- Chain _serial;
- Tokenizer* _pTok;
+ NetHandler* _pN;
+ // Chain _serial;
+ Tokenizer* _pTok;
};
#endif
|