/* * This file is part of rasdaman community. * * Rasdaman community 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 3 of the License, or * (at your option) any later version. * * Rasdaman community 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 rasdaman community. If not, see . * * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / rasdaman GmbH. * * For more information please see * or contact Peter Baumann via . / /** * SOURCE: test_dbcontent.cc * * MODULE: test * * PURPOSE: * Reads the contents of the specified collection and prints * it on the screen. * * COMMENTS: * none * */ #include #include #include "o2template_CC.hxx" // declaration of O2 ref and coll classes #include "ulongtype.hh" #include "cachetamgr/persmddcoll.hh" #include "cachetamgr/persmddobj.hh" #include "cachetamgr/perstile.hh" #include "cachetamgr/persmddcolliter.hh" #include "adminif.hh" #include "databaseif.hh" #include "transactionif.hh" #include RMINITGLOBALS('C') extern char* myExecArgv0 = ""; static void insertObj( char* dbName, OId o, char* cn ) { MDDBaseType* mddType = (MDDBaseType*)TypeFactory::mapMDDType( "GreyImage" ); r_Minterval domain( "[0:9,0:9]" ); // cout << " " << o << "," << cn << " ... " << flush; PersMDDObj* obj = new PersMDDObj( mddType, domain, dbName, o ); PersMDDColl objsSet( cn ); objsSet.insert( obj ); delete obj; } static void removeObj( char* dbName, char* collName, OId o ) { // open collection PersMDDColl* coll = 0; char answer = 'n'; cout << endl << "SCAN (y/n) ?" << flush; cin >> answer; if( answer == 'y' ) { coll = new PersMDDColl( collName ); MDDCollIter* collIter = coll->createIterator(); MDDObj* mddObj; for( collIter->reset(); collIter->notDone(); collIter->advance() ) { mddObj = collIter->getElement(); /* if( mddObj->isPersistent() ) { EOId eOId; ((PersMDDObj*)mddObj)->getEOId( &eOId ); cout << "MDD " << eOId.getOId() << flush; } */ } /* cout << endl << "PRINT OBJECT (y/n) ?" << flush; cin >> answer; if( answer == 'y' ) mddObj->printStatus( ); */ delete collIter; coll->releaseAll(); delete coll; cout << endl << "SCAN end" << endl; } coll = new PersMDDColl( collName ); if( coll ) { cout <<"o == " << o << " dbName == " << dbName << endl; coll->remove( o, dbName ); coll->releaseAll(); delete coll; } } int checkArguments( int argc, char** argv, const char* searchText, int& optionValueIndex ) { int found = 0; int i=1; while( !found && i