// ============================================================================= void dropfunction(char *tablename) { if ( arguments.pTest == false ) { if ( tableExists(tablename) ) db->executeUpdate(dbq->getSqlDropTable(tablename)); } else { ofstream *seperateOutFile = new ofstream(); string filename = tablename; filename += ".sql"; seperateOutFile->open(filename.c_str()); *seperateOutFile << dbq->getSqlDropTable(tablename) << ";" << endl; seperateOutFile->close(); delete seperateOutFile; } } // ============================================================================= // ============================================================================= 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; int tmpCounter = 0; pb = new ProgressBar('=',80,arguments.pDropCounter,"Drop Tables"); sw->start(); try { if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ALTRO_FEC") > 0) ) { dropfunction((char*)"ALTRO_FEC"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEC_RCU") > 0) ) { dropfunction((char*)"FEC_RCU"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("RCU_SECTOR") > 0) ) { dropfunction((char*)"RCU_SECTOR"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("SECTOR_TPC") > 0) ) { dropfunction((char*)"SECTOR_TPC"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("TPC") > 0) ) { dropfunction((char*)"TPC"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("SECTOR") > 0) ) { dropfunction((char*)"SECTOR"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("RCU") > 0) ) { dropfunction((char*)"RCU"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEC") > 0) ) { dropfunction((char*)"FEC"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("ALTRO") > 0) ) { dropfunction((char*)"ALTRO"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEE_A") > 0) ) { dropfunction((char*)"FEE_A"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEE_C") > 0) ) { dropfunction((char*)"FEE_C"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEESERVICES_A") > 0) ) { dropfunction((char*)"FEESERVICES_A"); pb->print(tmpCounter++); } if ( (arguments.pDropList.count("ALL") > 0) || (arguments.pDropList.count("FEESERVICES_C") > 0) ) { dropfunction((char*)"FEESERVICES_C"); pb->print(tmpCounter++); } } catch(SQLException& ea) { cout << ea.what() << endl; return 0; } sw->stop(); delete pb; cout << "Drop Table | " << sw->formatRealTime() << " s, " << sw->formatSysTime() << "s" << endl; return 1; }