// ============================================================================= void dropfunction(char *tablename) { if ( arguments.pTest ) { ofstream *outFile = new ofstream(); string filename = "DROP_"; filename += tablename; filename += ".sql"; outFile->open(filename.c_str()); *outFile << dbq->getSqlDropTable(tablename) << ";" << endl; outFile->close(); delete outFile; } else { if ( tableExists(tablename) ) { try { Statement st(con); st.Execute(dbq->getSqlDropTable(tablename)); } catch (exception &ex) { cout << ex.what() << endl; } cout << "*Table " << tablename << " dropped!" << endl; } else cout << "Table " << tablename << " does not exist. Nothing done!" << endl; } } // ============================================================================= // ============================================================================= int droptables() { // // Drop Tables // cout << "?????????????????????????????????????????????????????????" << endl; cout << "Are you sure you want to drop the selected tables? [y/n]" << endl; cout << "?????????????????????????????????????????????????????????" << endl; if ( getchar() != 'y' ) return 1; sw->start(); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ITCORR1_CRU") > 0) ) dropfunction((char*)"ITCORR1_CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ITCORR2_CRU") > 0) ) dropfunction((char*)"ITCORR2_CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("CMCORR_CRU") > 0) ) dropfunction((char*)"CMCORR_CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ONCHANNEL_CRU") > 0) ) dropfunction((char*)"ONCHANNEL_CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ZSTHR_CRU") > 0) ) dropfunction((char*)"ZSTHR_CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("PEDESTAL_CRU") > 0) ) dropfunction((char*)"PEDESTAL_CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("CRU_PARTITION") > 0) ) dropfunction((char*)"CRU_PARTITION"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEC_PARTITION") > 0) ) dropfunction((char*)"FEC_PARTITION"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("PARTITION_SECTOR") > 0) ) dropfunction((char*)"PARTITION_SECTOR"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("SECTOR_TPC") > 0) ) dropfunction((char*)"SECTOR_TPC"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("TPC") > 0) ) dropfunction((char*)"TPC"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("SECTOR") > 0) ) dropfunction((char*)"SECTOR"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("PARTITION") > 0) ) dropfunction((char*)"PARTITION"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEC") > 0) ) dropfunction((char*)"FEC"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("CRU") > 0) ) dropfunction((char*)"CRU"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("PEDESTAL") > 0) ) dropfunction((char*)"PEDESTAL"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ZSTHR") > 0) ) dropfunction((char*)"ZSTHR"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ON_CHANNEL") > 0) ) dropfunction((char*)"ON_CHANNEL"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("CMCORR") > 0) ) dropfunction((char*)"CMCORR"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ITCORR1") > 0) ) dropfunction((char*)"ITCORR1"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ITCORR2") > 0) ) dropfunction((char*)"ITCORR2"); if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("GBTX1") > 0) ) dropfunction((char*)"GBTX1"); sw->stop(); cout << "Drop Table | " << sw->formatRealTime() << " s, " << sw->formatSysTime() << "s" << endl; return 1; }