/[projects]/misc/mysql_splitter/splitter.cpp
ViewVC logotype

Diff of /misc/mysql_splitter/splitter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1283 by torben, Sun Apr 10 21:15:14 2011 UTC revision 1284 by torben, Mon Apr 11 05:14:37 2011 UTC
# Line 35  string remove_comments(string in) { Line 35  string remove_comments(string in) {
35          return out.str();          return out.str();
36  }  }
37    
38  string getLastWord(string input) {  string get_db_name(string input) {
39          input = remove_comments(input);          input = remove_comments(input);
40    
41          boost::erase_all(input,"`");          boost::erase_all(input,"`");
42            boost::erase_all(input, ";");
43          boost::trim(input);          boost::trim(input);
44    
45          vector<string> words;          vector<string> words;
46          words = boost::split(words, input, boost::is_any_of(" ") );          words = boost::split(words, input, boost::is_any_of(" ") );
47    
48          string last = words.back();          string last = words.back();
   
         boost::erase_all(last, ";");  
49          boost::trim(last);          boost::trim(last);
50    
   
51          return last;          return last;
52  }  }
53    
# Line 116  int main(int argc, char** argv) { Line 115  int main(int argc, char** argv) {
115                          }                          }
116    
117                          boost::trim(line);                          boost::trim(line);
118                          string dbname = getLastWord(line);                          string dbname = get_db_name(line);
119                          cout << ">" << dbname << endl;                          cout << ">" << dbname << endl;
120    
121    

Legend:
Removed from v.1283  
changed lines
  Added in v.1284

  ViewVC Help
Powered by ViewVC 1.1.20