~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump_data.h

  • Committer: Andrew Hutchings
  • Date: 2010-10-15 18:30:08 UTC
  • mto: (1856.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 1857.
  • Revision ID: andrew@linuxjedi.co.uk-20101015183008-zkjr1nz08f8rhgbm
Fix several bugs dumping tables with many rows
Fix error handling on database destination

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
 
227
227
    void writeString(std::string &str)
228
228
    {
229
 
      connection->queryNoResult(str);
 
229
      if (not connection->queryNoResult(str))
 
230
        throw 1;
230
231
    }
231
232
 
232
233
    void setConnection(DrizzleDumpConnection *conn) { connection= conn; }
255
256
 
256
257
    int sync()
257
258
    {
258
 
        size_t len = size_t(pptr() - pbase());
259
 
        std::string temp(pbase(), len);
260
 
 
261
 
        /* Drop newlines */
262
 
        temp.erase(std::remove(temp.begin(), temp.end(), '\n'), temp.end());
263
 
 
264
 
        if (temp.compare(0, 2, "--") == 0)
265
 
        {
266
 
          /* Drop comments */
267
 
          setp(pbase(), epptr());
268
 
        }
269
 
        if (temp.find(";") != std::string::npos)
270
 
        {
271
 
            writeString(temp);
272
 
            setp(pbase(), epptr());
273
 
        }
274
 
        return 0;
 
259
      size_t len = size_t(pptr() - pbase());
 
260
      std::string temp(pbase(), len);
 
261
 
 
262
      /* Drop newlines */
 
263
      temp.erase(std::remove(temp.begin(), temp.end(), '\n'), temp.end());
 
264
 
 
265
      if (temp.compare(0, 2, "--") == 0)
 
266
      {
 
267
        /* Drop comments */
 
268
        setp(pbase(), epptr());
 
269
      }
 
270
      if (temp.find(";") != std::string::npos)
 
271
      {
 
272
        writeString(temp);
 
273
        setp(pbase(), epptr());
 
274
      }
 
275
      return 0;
275
276
    }
276
277
};
277
278