--- misc/mysql_splitter/splitter.cpp 2011/04/10 20:37:28 1282 +++ misc/mysql_splitter/splitter.cpp 2011/05/11 10:14:11 1458 @@ -15,17 +15,39 @@ const int BUFSIZE = 1024*1024; -string getLastWord(string input) { +string remove_comments(string in) { + bool isComment = false; + ostringstream out; + for (int i=0; i words; words = boost::split(words, input, boost::is_any_of(" ") ); string last = words.back(); - - boost::erase_all(last, ";"); boost::trim(last); - - return last; } @@ -67,7 +89,7 @@ cout << "No file named " << inputfile << endl; return 1; } - + ifstream in( inputfile.c_str() ); ofstream out; @@ -77,7 +99,9 @@ if (!in.is_open() ) { cout << "Could not open " << argv[1] << endl; return 2; - } + } + + time_t start = time(NULL); while ( in.good() ) { in.getline(linebuf, BUFSIZE); @@ -93,7 +117,7 @@ } boost::trim(line); - string dbname = getLastWord(line); + string dbname = get_db_name(line); cout << ">" << dbname << endl; @@ -130,7 +154,11 @@ if(out.is_open()) - out.close(); + out.close(); + + time_t end = time(NULL); + + cout << "Elapsed " << (end-start) << " seconds" << endl; in.close();