/[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 1458 by torben, Wed May 11 10:14:11 2011 UTC revision 1459 by torben, Wed May 11 11:11:42 2011 UTC
# Line 101  int main(int argc, char** argv) { Line 101  int main(int argc, char** argv) {
101                  return 2;                  return 2;
102          }          }
103    
104          time_t start = time(NULL);          time_t start = time(NULL);
105    
106            const char* SEARCH = "CREATE DATABASE";
107            const int SEARCHLEN = strlen(SEARCH);
108    
109          while ( in.good() ) {          while ( in.good() ) {
110                  in.getline(linebuf, BUFSIZE);                  in.getline(linebuf, BUFSIZE);
111    
                 string line(linebuf);  
   
112    
113                  //if (line.substr(0, 15) == "CREATE DATABASE" ) {                  //if (line.substr(0, 15) == "CREATE DATABASE" ) {
114                  if ( boost::starts_with(line, "CREATE DATABASE") ) {                  //if ( boost::starts_with(line, "CREATE DATABASE") ) {
115                    if (strncmp(linebuf,SEARCH, SEARCHLEN) == 0) {
116    
117                string line(linebuf);
118                          if (out.is_open() ) {                          if (out.is_open() ) {
119                                  out.close();                                  out.close();
120                          }                          }
# Line 145  int main(int argc, char** argv) { Line 148  int main(int argc, char** argv) {
148    
149    
150                  if (out.is_open() ) {                  if (out.is_open() ) {
151                          out << line << endl;                          out << linebuf << endl;
152                  } else {                  } else {
153                          header << line << endl; //collect preamble for later use                          header << linebuf << endl; //collect preamble for later use
154                  }                  }
155    
156          }          }

Legend:
Removed from v.1458  
changed lines
  Added in v.1459

  ViewVC Help
Powered by ViewVC 1.1.20